private void loadAllExtensions() { ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy(); client.GetExtensionLibrariesCompleted += new EventHandler <GetExtensionLibrariesCompletedEventArgs>(client_GetExtensionLibrariesCompleted); client.GetExtensionLibrariesAsync(); }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { FrameworkElement elem = sender as FrameworkElement; if (elem == null) { return; } Extension extension = elem.DataContext as Extension; if (extension == null || string.IsNullOrWhiteSpace(extension.Name)) { return; } MessageBoxDialog.Show(string.Format(ESRI.ArcGIS.Mapping.Builder.Resources.Strings.DeletingExtensionWillMakeItUnavailableForFurtherUse, System.Environment.NewLine), ESRI.ArcGIS.Mapping.Builder.Resources.Strings.ConfirmDelete, MessageBoxButton.OKCancel, (s, args) => { if (args.Result == MessageBoxResult.OK) { ApplicationBuilder.ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy(); client.DeleteExtensionLibraryCompleted += new EventHandler <ApplicationBuilder.DeleteExtensionLibraryCompletedEventArgs>(client_DeleteExtensionLibraryCompleted); client.DeleteExtensionLibraryAsync(extension.Name, extension); } }); }
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); } }
void WriteChanges() { //Write builder settings string xml = BuilderApplication.Instance.ToXml(); ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy(); client.SaveSettingsAsync(SETTINGSCONFIGPATH, xml); }
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 uploadFile(OpenFileDialog dialog, IEnumerable <string> assemblyNames) { string selectedFileName; byte[] fileBuffer = null; try { using (FileStream strm = dialog.File.OpenRead()) { selectedFileName = dialog.File.Name; // remove the .xap extension if (selectedFileName.EndsWith(".xap", StringComparison.OrdinalIgnoreCase)) { selectedFileName = selectedFileName.Substring(0, selectedFileName.Length - 4); } using (BinaryReader rdr = new BinaryReader(strm)) { fileBuffer = rdr.ReadBytes((int)strm.Length); } } if (fileBuffer != null) { Extension extension = new Extension() { Name = selectedFileName, Url = string.Format("{0}/{1}.xap", BuilderApplication.Instance.ExtensionsRepositoryBaseUrl, selectedFileName), Assemblies = new List <ESRI.ArcGIS.Mapping.Builder.Common.Assembly>(), }; ObservableCollection <string> assemblies = new ObservableCollection <string>(); if (assemblyNames != null) { foreach (string assemblyInExtension in assemblyNames) { if (!AssemblyManager.IsBuiltInAssembly(assemblyInExtension)) { assemblies.Add(assemblyInExtension); extension.Assemblies.Add(new ESRI.ArcGIS.Mapping.Builder.Common.Assembly() { Name = assemblyInExtension }); } } } showHideProgressIndicator(false); byte[] msgBody = fileBuffer.ToArray(); ApplicationBuilder.ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy(); client.UploadExtensionLibraryCompleted += client_UploadExtensionLibraryCompleted; client.UploadExtensionLibraryAsync(selectedFileName, msgBody, assemblies, extension); } } catch (Exception ex) { Logger.Instance.LogError(ex); } }
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); } } }
// 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); }
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()); } }
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); } })); }
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; } }
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(); }
private void getFiles(string relativePath) { string siteId = null; bool isTemplate = BuilderApplication.Instance.CurrentSite == null; if (isTemplate) { if (BuilderApplication.Instance.CurrentTemplate != null) { siteId = BuilderApplication.Instance.CurrentTemplate.ID; } else if (BuilderApplication.Instance.Templates.Count > 0) { siteId = BuilderApplication.Instance.Templates[0].ID; } } else { siteId = BuilderApplication.Instance.CurrentSite.ID; } if (string.IsNullOrEmpty(siteId)) { return; } RelativeUrl = relativePath; if (Files.Items != null) { Files.Items.Clear(); } btnOk.IsEnabled = false; FileExplorerClient client = WCFProxyFactory.CreateFileExplorerProxy(); client.GetFilesCompleted += new EventHandler <GetFilesCompletedEventArgs>(client_GetFilesCompleted); showHideProgressBar(true); Dispatcher.BeginInvoke(() => { client.GetFilesAsync(siteId, isTemplate, relativePath, FileExtensions); }); }
public override void Execute(object parameter) { ApplicationBuilder.ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy(); client.SaveConfigurationStoreXmlCompleted += new EventHandler <ApplicationBuilder.SaveConfigurationStoreXmlCompletedEventArgs>(client_SaveConfigurationStoreXmlCompleted); client.SaveConfigurationStoreXmlAsync(XmlSerializer.Serialize <ConfigurationStore>(BuilderApplication.Instance.ConfigurationStore)); }
private void Upload_Click(object sender, RoutedEventArgs e) { OpenFileDialog openDialog = new OpenFileDialog() { Multiselect = false, Filter = "Image Files|*.png;*.jpg;*.jpeg", }; if (openDialog.ShowDialog() == true) { FileInfo selectedFile = openDialog.File; if (selectedFile == null) { return; } byte[] fileBuffer = null; try { using (FileStream strm = openDialog.File.OpenRead()) { selectedFile = openDialog.File; using (BinaryReader rdr = new BinaryReader(strm)) { fileBuffer = rdr.ReadBytes((int)strm.Length); } } if (fileBuffer != null) { string siteId = null; bool isTemplate = BuilderApplication.Instance.CurrentSite == null; if (isTemplate) { if (BuilderApplication.Instance.CurrentTemplate != null) { siteId = BuilderApplication.Instance.CurrentTemplate.ID; } else if (BuilderApplication.Instance.Templates.Count > 0) { siteId = BuilderApplication.Instance.Templates[0].ID; } } else { siteId = BuilderApplication.Instance.CurrentSite.ID; } if (string.IsNullOrEmpty(siteId)) { return; } showHideProgressBar(false); FileExplorerClient client = WCFProxyFactory.CreateFileExplorerProxy(); client.UploadFileToSiteCompleted += new EventHandler <UploadFileToSiteCompletedEventArgs>(client_UploadFileToSiteCompleted); client.UploadFileToSiteAsync(siteId, isTemplate, RelativeUrl, selectedFile.Name, fileBuffer.ToArray(), "image/png"); } } catch (Exception ex) { Logger.Instance.LogError(ex); } } }