public async override void Initialize()
{
if (!this.isInitializing && !base.IsInitialized)
{
if (string.IsNullOrEmpty(this.Url))
{
Error = new ArgumentNullException(SuperMap.WinRT.REST.Resources.ExceptionStrings.InvalidUrl);
Initialize();
return;
}
if (IsSkipGetSMMapServiceInfo)
{
if (Rectangle2D.IsNullOrEmpty(Bounds))
{
Error = new ArgumentNullException("Bounds");
}
Dpi = ScaleHelper.GetSmDpi(ReferViewBounds, ReferViewer, ReferScale, this.CRS);
Dpi *= AdjustFactor;
this.isInitializing = true;
base.Initialize();
return;
}
this.isInitializing = true;
try
{
this._mapServiceDefault = new SmMapService(this.Url.Trim());
await this._mapServiceDefault.Initialize();
this.mapService = new SmMapService(this.Url.Trim());
if (this.CRS != null && this.CRS.WKID > 0)
{
await this.mapService.Initialize(this.CRS.WKID);
}
else
{
await this.mapService.Initialize();
}
mapService_Initialized();
}
catch (Exception ex)
{
if (ex is SecurityException)
{
base.Error = new SecurityException(SuperMap.WinRT.Resources.ExceptionStrings.InvalidURISchemeHost, ex);
}
else
{
base.Error = ex;
}
base.Initialize();
}
}
}