protected virtual void OnGetConfigurationStoreCompleted(GetConfigurationStoreCompletedEventArgs args)
 {
     DefaultConfigurationStore = args.ConfigurationStore;
     if (GetConfigurationStoreCompleted != null)
     {
         GetConfigurationStoreCompleted(this, args);
     }
 }
        protected override void OnGetConfigurationStoreCompleted(GetConfigurationStoreCompletedEventArgs args)
        {
            ConfigurationStore store = args.ConfigurationStore;

            if (store != null)
            {
                bool isHttps = "https".Equals(Application.Current.Host.Source.Scheme);
                if (store.BaseMaps != null)
                {
                    foreach (BaseMapInfo baseMapInfo in store.BaseMaps)
                    {
                        if (isHttps && baseMapInfo.BaseMapType == BaseMapType.OpenStreetMap)
                        {
                            // Open street map doesn't have a secure end point, so don't show it in https mode
                            store.BaseMaps.Remove(baseMapInfo);
                            break;
                        }

                        if (string.IsNullOrWhiteSpace(baseMapInfo.Url))
                        {
                            continue;
                        }

                        if (isHttps)
                        {
                            baseMapInfo.Url = baseMapInfo.Url.Replace("http://", "https://");
                        }
                        else
                        {
                            baseMapInfo.Url = baseMapInfo.Url.Replace("https://", "http://");
                        }
                    }
                }

                if (store.GeometryServices != null)
                {
                    foreach (GeometryServiceInfo serviceInfo in store.GeometryServices)
                    {
                        if (isHttps)
                        {
                            serviceInfo.Url = serviceInfo.Url.Replace("http://", "https://");
                        }
                        else
                        {
                            serviceInfo.Url = serviceInfo.Url.Replace("https://", "http://");
                        }
                    }
                }
            }

            base.OnGetConfigurationStoreCompleted(args);
        }
        protected override void OnGetConfigurationStoreCompleted(GetConfigurationStoreCompletedEventArgs args)
        {
            ConfigurationStore store = args.ConfigurationStore;
            if (store != null)
            {
                bool isHttps = "https".Equals(Application.Current.Host.Source.Scheme);
                if (store.BaseMaps != null)
                {
                    foreach (BaseMapInfo baseMapInfo in store.BaseMaps)
                    {
                        if (isHttps && baseMapInfo.BaseMapType == BaseMapType.OpenStreetMap)
                        {
                            // Open street map doesn't have a secure end point, so don't show it in https mode
                            store.BaseMaps.Remove(baseMapInfo);
                            break;
                        }

                        if (string.IsNullOrWhiteSpace(baseMapInfo.Url))
                            continue;

                        if(isHttps)
                            baseMapInfo.Url = baseMapInfo.Url.Replace("http://", "https://");
                        else
                            baseMapInfo.Url = baseMapInfo.Url.Replace("https://", "http://");
                    }
                }

                if (store.GeometryServices != null)
                {
                    foreach (GeometryServiceInfo serviceInfo in store.GeometryServices)
                    {
                        if (isHttps)
                            serviceInfo.Url = serviceInfo.Url.Replace("http://", "https://");
                        else
                            serviceInfo.Url = serviceInfo.Url.Replace("https://", "http://");
                    }
                }
            }

            base.OnGetConfigurationStoreCompleted(args);
        }
        void ConnectionStoreProvider_ConfigurationStoreLoaded(object sender, GetConfigurationStoreCompletedEventArgs e)
        {
            if (e.ConfigurationStore == null)
            {
                Dispatcher.BeginInvoke((Action)delegate() // switch to UI thread
                {
                    Logger.Instance.LogError(ESRI.ArcGIS.Mapping.Controls.Resources.Strings.LogUnableToRetrieveConfigurationInformation);
                    OnConfigurationLoadFailed(new ExceptionEventArgs(new Exception(ESRI.ArcGIS.Mapping.Controls.Resources.Strings.ExceptionUnableToRetrieveConfigurationInformation), null));
                });
                return;
            }

            ConfigurationStore = e.ConfigurationStore;
            ConfigurationStore.Current = e.ConfigurationStore;
            Urls.GeometryServiceUrl = new ConfigurationStoreHelper().GetGeometryServiceUrl(ConfigurationStore);
            if (ESRI.ArcGIS.Mapping.Controls.ArcGISOnline.ArcGISOnlineEnvironment.ConfigurationUrls != null)
                ESRI.ArcGIS.Mapping.Controls.ArcGISOnline.ArcGISOnlineEnvironment.ConfigurationUrls.GeometryServer = Urls.GeometryServiceUrl;
        }
 protected virtual void OnGetConfigurationStoreCompleted(GetConfigurationStoreCompletedEventArgs args)
 {
     DefaultConfigurationStore = args.ConfigurationStore;
     if(GetConfigurationStoreCompleted != null)
         GetConfigurationStoreCompleted(this, args);
 }