void onSettingsGet(object sender, GetSettingsXmlCompletedEventArgs args)
        {
            if (args.Error != null)
            {
                // Create a default viewer application
                BuilderApplication.Instance.TitleText = ESRI.ArcGIS.Mapping.Builder.Resources.Strings.ArcGISViewerForMicrosoftSilverlight;
                loadAllExtensions();
                return;
            }
            BuilderApplication.InitFromXml(args.SettingsXml);

            EventHandler <EventArgs> onAgolInitialized = null;

            onAgolInitialized = (o, e) =>
            {
                ArcGISOnlineEnvironment.ArcGISOnline.Initialized -= onAgolInitialized;

                // Mark Builder as initialized.  Delay for half a second to allow bindings to update.
                DispatcherTimer timer = new DispatcherTimer()
                {
                    Interval = TimeSpan.FromSeconds(0.5)
                };
                timer.Tick += (s, a) =>
                {
                    timer.Stop();
                    BuilderApplication.Instance.IsInitialized = true;
                };
                timer.Start();
            };
            ArcGISOnlineEnvironment.ArcGISOnline.Initialized += onAgolInitialized;
            ESRI.ArcGIS.Mapping.Controls.ArcGISOnline.ArcGISOnlineEnvironment.LoadConfig(BuilderApplication.Instance.ArcGISOnlineSharing, BuilderApplication.Instance.ArcGISOnlineSecure, BuilderApplication.Instance.ArcGISOnlineProxy);

            loadAllExtensions();
        }
        public override void Execute(object parameter)
        {
            BuilderApplication ba = BuilderApplication.Instance;

            if (ba != null)
            {
                BuilderApplication.Instance.WindowManager.HideAllWindows();
            }

            if (View.Instance != null)
            {
                View.Instance.WindowManager.HideAllWindows();
            }

            if (ba.SettingsPageVisibility == Visibility.Collapsed)
            {
                // Save whether the user can from builder screen or catalog screen for later
                isPrevPageTheBuilderScreen = BuilderApplication.Instance.BuilderScreenVisibility == Visibility.Visible;

                ba.BuilderScreenVisibility = Visibility.Collapsed;
                ba.CatalogScreenVisibility = Visibility.Collapsed;
                ba.SettingsPageVisibility  = Visibility.Visible;
            }
            else
            {
                ba.SettingsPageVisibility = Visibility.Collapsed;
                if (isPrevPageTheBuilderScreen)
                {
                    ba.CatalogScreenVisibility = Visibility.Collapsed;
                    ba.BuilderScreenVisibility = Visibility.Visible;
                }
                else
                {
                    if (ViewerApplicationControl.Instance != null)
                    {
                        ViewerApplicationControl.Instance.ViewerApplication = null;
                    }
                    ba.CatalogScreenVisibility = Visibility.Visible;
                    ba.BuilderScreenVisibility = Visibility.Collapsed;
                }
            }
        }
        void MainPage_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "CurrentSite")
            {
                BuilderApplication app = (BuilderApplication)sender;
                if (app.CurrentSite != null && !string.IsNullOrEmpty(app.CurrentSite.Name))
                {
                    Title.Blocks.Clear();
                    Run r = new Run()
                    {
                        Text = string.Format(Strings.ArcGISApplicationBuilder, app.CurrentSite.Name)
                    };
                    Paragraph p = new Paragraph();
                    p.Inlines.Add(r);
                    Title.Blocks.Add(p);

                    if (!string.IsNullOrEmpty(app.CurrentSite.Url))
                    {
                        Title.Hyperlink(app.CurrentSite.Name, app.CurrentSite.Url);
                    }
                }
            }
        }
        public string ResolveUrl(string url)
        {
            if (string.IsNullOrEmpty(url))
            {
                return(url);
            }
            BuilderApplication instance = BuilderApplication.Instance;
            Site currentSite            = instance.CurrentSite;

            if (currentSite == null) // not editing a site
            {
                if (instance.Templates == null)
                {
                    return(url);
                }

                Template defaultTemplate = instance.Templates.FirstOrDefault <Template>(t => t.IsDefault);
                if (defaultTemplate == null && instance.Templates.Count > 0)
                {
                    defaultTemplate = instance.Templates[0];
                }

                if (defaultTemplate != null)
                {
                    return(string.Format("{0}/{1}", defaultTemplate.BaseUrl.TrimEnd('/'), url.TrimStart('/')));
                }
            }
            else
            {
                if (currentSite.Url != null)
                {
                    return(string.Format("{0}/{1}", currentSite.Url.TrimEnd('/'), url.TrimStart('/')));
                }
            }

            return(url);
        }
 static BuilderApplication()
 {
     Instance = new BuilderApplication();
 }
Esempio n. 6
0
 static BuilderApplication()
 {
     Instance = new BuilderApplication();
 }