コード例 #1
0
        protected override void WriteAttributes(Layer layer)
        {
            base.WriteAttributes(layer);

            Client.Bing.TileLayer tileLayer = layer as Client.Bing.TileLayer;
            if (tileLayer != null)
            {
                if (tileLayer.ServerType != default(ESRI.ArcGIS.Client.Bing.ServerType))
                {
                    WriteAttribute("ServerType", tileLayer.ServerType.ToString());
                }
                if (tileLayer.LayerStyle != default(ESRI.ArcGIS.Client.Bing.TileLayer.LayerType))
                {
                    WriteAttribute("LayerStyle", tileLayer.LayerStyle.ToString());
                }
                if (!string.IsNullOrEmpty(tileLayer.Token))
                {
                    WriteAttribute("Token", tileLayer.Token);
                }
            }
        }
コード例 #2
0
        private void apply(object commandParameter)
        {
            if (ViewerApplication != null)
            {
                if (ViewerApplication.BingMapsAppId != BingMapsAppId)
                {
                    if (View.Instance != null && View.Instance.ConfigurationStore != null)
                    {
                        View.Instance.ConfigurationStore.BingMapsAppId = BingMapsAppId;
                    }
                    ViewerApplication.BingMapsAppId = BingMapsAppId;
                    if (View.Instance != null && View.Instance.Map != null)
                    {
                        foreach (Layer layer in View.Instance.Map.Layers)
                        {
                            Client.Bing.TileLayer bingLayer = layer as Client.Bing.TileLayer;
                            if (bingLayer != null && ESRI.ArcGIS.Mapping.Core.LayerExtensions.GetUsesBingAppID(bingLayer))
                            {
                                bingLayer.Token = ConfigurationStore.Current.BingMapsAppId;
                                bingLayer.Refresh();
                            }
                        }
                    }
                }
                if (ViewerApplication.PortalAppId != PortalAppId)
                {
                    if (View.Instance != null && View.Instance.ConfigurationStore != null)
                    {
                        View.Instance.ConfigurationStore.PortalAppId = PortalAppId;
                    }
                    ViewerApplication.PortalAppId = PortalAppId;
                }
                if (ViewerApplication.GeometryService != GeometryServiceUrl)
                {
                    if (View.Instance != null)
                    {
                        View.Instance.SetGeometryServiceUrl(GeometryServiceUrl);
                    }
                    ViewerApplication.GeometryService = GeometryServiceUrl;
                }

                bool portalChanged = false;
                if (ViewerApplication.ArcGISOnlineSharing != ArcGISOnlineSharing)
                {
                    if (View.Instance != null)
                    {
                        View.Instance.ArcGISOnlineSharing = ArcGISOnlineSharing;
                    }
                    ViewerApplication.ArcGISOnlineSharing = ArcGISOnlineSharing;
                    portalChanged = true;
                }
                if (ViewerApplication.ArcGISOnlineSecure != ArcGISOnlineSecure)
                {
                    if (View.Instance != null)
                    {
                        View.Instance.ArcGISOnlineSecure = ArcGISOnlineSecure;
                    }
                    ViewerApplication.ArcGISOnlineSecure = ArcGISOnlineSecure;
                    portalChanged = true;
                }
                if (ViewerApplication.Proxy != Proxy)
                {
                    if (View.Instance != null)
                    {
                        View.Instance.ProxyUrl = Proxy;
                    }
                    ViewerApplication.Proxy = Proxy;
                }

                if (portalChanged)
                {
                    ArcGISPortal portal = new ArcGISPortal()
                    {
                        Url = View.Instance.BaseUrl.ToLower().StartsWith("https://") ? ArcGISOnlineSecure
                            : ArcGISOnlineSharing,
                        ProxyUrl = ViewerApplication.ArcGISOnlineProxy
                    };

                    BuilderApplication.Instance.UpdatingSettings = true;
                    portal.InitializeAsync(portal.Url, (o, ex) =>
                    {
                        View.Instance.Portal = portal;
                        BuilderApplication.Instance.UpdatingSettings = false;
                    });
                }
            }
            raiseChange();
        }