コード例 #1
0
        private void loadAllExtensions()
        {
            ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy();

            client.GetExtensionLibrariesCompleted += new EventHandler <GetExtensionLibrariesCompletedEventArgs>(client_GetExtensionLibrariesCompleted);
            client.GetExtensionLibrariesAsync();
        }
コード例 #2
0
        public static ApplicationBuilderClient CreateApplicationBuilderProxy()
        {
            TimeSpan timeout = TimeSpan.FromMinutes(3);
            ApplicationBuilderClient client = new ApplicationBuilderClient(UserId);

            return(client);
        }
コード例 #3
0
        public void Execute(object parameter)
        {
            if (ParentDropDownButton != null)
            {
                ParentDropDownButton.IsContentPopupOpen = false;
            }

            if (ViewerApplicationControl.Instance == null || BuilderApplication.Instance == null ||
                BuilderApplication.Instance.CurrentSite == null)
            {
                return;
            }

            ViewerApplicationControl va = ViewerApplicationControl.Instance;

            if (va != null)
            {
                IncrementVersionNumber(va.ViewerApplication);
                va.View.SaveExtensionsConfigData();

                // Get add-in configuration (tools, controls, and behaviors) before map configuration so add-ins have a chance
                // to perform map-related cleanup (e.g. removing temp layers) before the map is saved
                string toolsXml = va.ToolPanels != null?va.ToolPanels.GetToolPanelsXml() : string.Empty;

                string controlsXml = va.View.GetConfigurationOfControls();

                // Publish only Xaps in use
                string behaviorsXml = null;
                ObservableCollection <string> usedXaps = BuilderApplication.Instance.GetXapsInUse(out behaviorsXml);
                BuilderApplication.Instance.SyncExtensionsInUse(usedXaps);

                string mapXaml = va.View.GetMapConfiguration(null);

                // Now that the extensions list has been updated - serialize the applicationXml
                string appXml            = va.ViewerApplication.ToXml();
                string colorsXaml        = va.GetColorXaml();
                byte[] previewImageBytes = BuilderApplication.Instance.GetPreviewImage();

                SitePublishInfo info = new SitePublishInfo()
                {
                    ApplicationXml      = appXml,
                    BehaviorsXml        = behaviorsXml,
                    ColorsXaml          = colorsXaml,
                    ControlsXml         = controlsXml,
                    ExtensionsXapsInUse = usedXaps.ToArray(),
                    MapXaml             = mapXaml,
                    PreviewImageBytes   = previewImageBytes,
                    ToolsXml            = toolsXml,
                };
                var title = "";
                if (ViewerApplicationControl.Instance != null && ViewerApplicationControl.Instance.ViewerApplication != null)
                {
                    title = ViewerApplicationControl.Instance.ViewerApplication.TitleText;
                }
                ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy();
                client.SaveConfigurationForSiteCompleted += new EventHandler <SaveConfigurationForSiteCompletedEventArgs>(client_SaveConfigurationForSiteCompleted);
                client.SaveConfigurationForSiteAsync(BuilderApplication.Instance.CurrentSite.ID, info, title);
            }
        }
コード例 #4
0
        void WriteChanges()
        {
            //Write builder settings
            string xml = BuilderApplication.Instance.ToXml();
            ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy();

            client.SaveSettingsAsync(SETTINGSCONFIGPATH, xml);
        }
コード例 #5
0
        private void SitesCatalog_Loaded(object sender, RoutedEventArgs e)
        {
            ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy();

            client.GetSitesCompleted += new EventHandler <GetSitesCompletedEventArgs>(client_GetSitesCompleted);
            startProgressIndicator(Strings.LoadingSites);
            client.GetSitesAsync();
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (validateInput())
            {
                enableDisableUI(true);
                showHideProgressIndicator(Visibility.Visible);
                ViewerApplicationControl va = ViewerApplicationControl.Instance;
                if (va != null)
                {
                    va.View.SaveExtensionsConfigData();

                    // Get add-in configuration (tools, controls, and behaviors) before map configuration so add-ins have a chance
                    // to perform map-related cleanup (e.g. removing temp layers) before the map is saved
                    string toolsXml = va.ToolPanels != null?va.ToolPanels.GetToolPanelsXml() : string.Empty;

                    string controlsXml = va.View.GetConfigurationOfControls();

                    // Publish only Xaps in use
                    string behaviorsXml = null;
                    ObservableCollection <string> usedXaps = BuilderApplication.Instance.GetXapsInUse(out behaviorsXml);
                    BuilderApplication.Instance.SyncExtensionsInUse(usedXaps);

                    string mapXaml = va.View.GetMapConfiguration(null);

                    // Now that the extensions list has been updated - serialize the applicationXml
                    string   appXml            = va.ViewerApplication.ToXml();
                    string   colorsXaml        = va.GetColorXaml();
                    byte[]   previewImageBytes = BuilderApplication.Instance.GetPreviewImage();
                    Template template          = BuilderApplication.Instance.Templates.FirstOrDefault <Template>(t => t.IsDefault);
                    string   templateId        = template != null ? template.ID : "Default";

                    SitePublishInfo info = new SitePublishInfo()
                    {
                        ApplicationXml      = appXml,
                        BehaviorsXml        = behaviorsXml,
                        ColorsXaml          = colorsXaml,
                        ControlsXml         = controlsXml,
                        ExtensionsXapsInUse = usedXaps.ToArray(),
                        MapXaml             = mapXaml,
                        PreviewImageBytes   = previewImageBytes,
                        ToolsXml            = toolsXml
                    };

                    var title = "";
                    if (ViewerApplicationControl.Instance != null && ViewerApplicationControl.Instance.ViewerApplication != null)
                    {
                        title = ViewerApplicationControl.Instance.ViewerApplication.TitleText;
                    }
                    ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy();
                    client.CreateViewerApplicationFromTemplateCompleted += new EventHandler <CreateViewerApplicationFromTemplateCompletedEventArgs>(client_CreateViewerApplicationFromTemplateCompleted);
                    client.CreateViewerApplicationFromTemplateAsync(NameTextBox.Text.Trim(), title,
                                                                    DescriptionTextBox.Text.Trim(), templateId, info);
                }
            }
        }
コード例 #7
0
        // Upgrade site to the current version
        private void SiteUpgrade_Click(object sender, RoutedEventArgs e)
        {
            // Give the user feedback
            startProgressIndicator(Strings.UpgradingApplication);

            // Get the button that was clicked
            FrameworkElement element = (FrameworkElement)sender;

            // Get the site to be upgraded
            Site site = element.DataContext as Site;

            // Hook to the upgrade completed event
            ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy();

            client.UpgradeSiteCompleted += (o, args) =>
            {
                if (args.Error != null)
                {
                    ESRIControls.MessageBoxDialog.Show(args.Error.Message);
                }
                else
                {
                    // update the product version on the current site object
                    site.ProductVersion = args.Site.ProductVersion;

                    // Since the Site object is not a dependency object,
                    Grid parent = element.FindAncestorOfType <Grid>();
                    if (parent != null)
                    {
                        parent.DataContext = null;
                        parent.DataContext = site;
                    }
                }

                // Hide progress indicator
                stopProgressIndicator();
            };

            // Get ID of current template
            string templateID = null;

            if (BuilderApplication.Instance != null && BuilderApplication.Instance.Templates != null)
            {
                templateID = BuilderApplication.Instance.Templates.FirstOrDefault(t => t.IsDefault).ID;
            }

            if (templateID == null)
            {
                templateID = "Default";
            }

            // Do upgrade
            client.UpgradeSiteAsync(site.ID, templateID);
        }
コード例 #8
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            // Make sure input is valid
            if (validateInput())
            {
                // Disable UI, display progress indicator
                enableDisableUI(true);
                showHideProgressIndicator(false);

                // Asynchronously invoke server method to copy source site to target
                ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy();
                client.CopySiteCompleted += new EventHandler <CopySiteCompletedEventArgs>(client_CopySiteCompleted);
                client.CopySiteAsync(sourceSiteId, NameTextBox.Text.Trim(), DescriptionTextBox.Text.Trim());
            }
        }
コード例 #9
0
 private void SiteDelete_Click(object sender, RoutedEventArgs e)
 {
     ESRIControls.MessageBoxDialog.Show(ESRI.ArcGIS.Mapping.Builder.Resources.Strings.AreYouSureYouWantToDeleteWebSite, ESRI.ArcGIS.Mapping.Builder.Resources.Strings.ConfirmDelete, MessageBoxButton.OKCancel,
                                        new ESRIControls.MessageBoxClosedEventHandler(delegate(object obj, ESRIControls.MessageBoxClosedArgs args)
     {
         if (args.Result == MessageBoxResult.OK)
         {
             Site site = ((FrameworkElement)sender).DataContext as Site;
             startProgressIndicator(ESRI.ArcGIS.Mapping.Builder.Resources.Strings.DeletingSite);
             ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy();
             client.DeleteWebSiteCompleted  += new EventHandler <DeleteWebSiteCompletedEventArgs>(client_DeleteWebSiteCompleted);
             client.DeleteWebSiteAsync(site.ID, site);
         }
     }));
 }
コード例 #10
0
        public MainPage()
        {
            InitializeComponent();
            Language = XmlLanguage.GetLanguage(CultureInfo.CurrentUICulture.Name);
            ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy();

            client.GetConfigurationStoreXmlCompleted += new EventHandler <GetConfigurationStoreXmlCompletedEventArgs>(client_GetConfigurationStoreXmlCompleted);
            client.GetConfigurationStoreXmlAsync();

            DataContextChanged += MainPage_DataContextChanged;

            if (ViewerApplicationControl.Instance != null && BuilderApplication.Instance != null)
            {
                ViewerApplicationControl.Instance.BuilderApplication = BuilderApplication.Instance;
            }
        }
コード例 #11
0
        private void StartupAfterGettingResources(object sender, StartupEventArgs e)
        {
            if (e.InitParams.ContainsKey("userId"))
            {
                BuilderApplication.Instance.UserId = WCFProxyFactory.UserId = e.InitParams["userId"];
            }

            ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy();

            client.GetTemplatesCompleted += (s, e1) =>
            {
                BuilderApplication.Instance.Templates = e1.Templates;

                ApplicationBuilderClient builderClient = WCFProxyFactory.CreateApplicationBuilderProxy();
                builderClient.GetSettingsXmlCompleted += onSettingsGet;
                builderClient.GetSettingsXmlAsync();
            };
            client.GetTemplatesAsync();
        }