예제 #1
0
        private void DownloadConfigXMLCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            string themeName = GetAppParamValue("Theme");

            try
            {
                AppConfig = ApplicationConfig.Deserialize(e.Result);
                if (AppConfig == null)
                {
                    MessageBox.Show("Sorry! Loading the application configuration failed. Please validate configuration file AppConfig.xml");
                    return;
                }

                if (string.IsNullOrEmpty(themeName))
                {
                    themeName = AppConfig.Theme.Trim();
                }

                if (!string.IsNullOrEmpty(themeName))
                {
                    //if (!UriParser.IsKnownScheme("pack")) UriParser.Register(new GenericUriParser(GenericUriParserOptions.GenericAuthority), "pack", -1);
                    string             themeUri = string.Format("/ESRI.SilverlightViewer;component/Themes/{0}.xaml", themeName);
                    ResourceDictionary themeRes = new ResourceDictionary();
                    themeRes.Source = new Uri(themeUri, UriKind.Relative);
                    this.Resources.MergedDictionaries.Add(themeRes);
                }

                ResourceDictionary SymbolRes = new ResourceDictionary();
                SymbolRes.Source = new Uri("/ESRI.SilverlightViewer;component/Symbols/EsriSymbols.xaml", UriKind.Relative);
                this.Resources.MergedDictionaries.Add(SymbolRes);

                // Load the main control here
                MapPage mapPage = new MapPage();
                this.RootVisual = mapPage;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Load Theme Error: " + ex.Message);
            }
        }