public SettingsWindow() { InitializeComponent(); this.DataContext = this; IsSettingsReadOnly = false; DefaultDatabaseChanged = false; IsSelectDBEnabled = false; SymbologyStandards = new ObservableCollection <string>(); SymbologyStandards.Add(ProSymbolUtilities.GetStandardLabel(ProSymbolUtilities.SupportedStandardsType.mil2525b)); SymbologyStandards.Add(ProSymbolUtilities.GetStandardLabel(ProSymbolUtilities.SupportedStandardsType.mil2525d)); SymbologyStandards.Add(ProSymbolUtilities.GetStandardLabel(ProSymbolUtilities.SupportedStandardsType.mil2525c)); if ((ProSymbolUtilities.ProMajorVersion >= 2) && (ProSymbolUtilities.ProMinorVersion >= 2)) { // APP6D only available after 2.2 SymbologyStandards.Add(ProSymbolUtilities.GetStandardLabel(ProSymbolUtilities.SupportedStandardsType.app6d)); } if ((ProSymbolUtilities.ProMajorVersion >= 2) && (ProSymbolUtilities.ProMinorVersion >= 4)) { // APP6B only available after 2.4 SymbologyStandards.Add(ProSymbolUtilities.GetStandardLabel(ProSymbolUtilities.SupportedStandardsType.app6b)); } }
private async void Button_Click(object sender, RoutedEventArgs e) { // or give user the option of selecting workspace: string selectedGDB = ProSymbolUtilities.BrowseItem(ArcGIS.Desktop.Catalog.ItemFilters.geodatabases); if (string.IsNullOrEmpty(selectedGDB)) { return; } if (DefaultDatabase != selectedGDB) { DefaultDatabaseChanged = true; DefaultDatabase = selectedGDB; // See if the selected database already contains a standard, // if so set the standard, and disable the control var selectedGDBasItem = ArcGIS.Desktop.Core.ItemFactory. Instance.Create(selectedGDB); bool hasStandard = false; ProSymbolUtilities.SupportedStandardsType standardFound = ProSymbolUtilities.SupportedStandardsType.mil2525d; foreach (ProSymbolUtilities.SupportedStandardsType standard in Enum.GetValues(typeof(ProSymbolUtilities.SupportedStandardsType))) { bool containsStandard = await ProSymbolEditorModule.Current.MilitaryOverlaySchema. GDBContainsMilitaryOverlay( selectedGDBasItem as ArcGIS.Desktop.Catalog.GDBProjectItem, standard); if (containsStandard) { hasStandard = true; standardFound = standard; break; } } if (hasStandard) { ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show( "Database: " + selectedGDB + "\n" + "contains a schema for standard: \n" + ProSymbolUtilities.GetStandardLabel(standardFound) + ".\n" + "Setting standard to this value." , "Database Contains Schema", MessageBoxButton.OK, MessageBoxImage.Information); Standard = standardFound; RaisePropertyChanged("SelectedSymbologyStandard"); } // Disable/enable the standard button if GDB had schema IsSettingsReadOnly = hasStandard; RaisePropertyChanged("IsSettingsNotReadOnly"); RaisePropertyChanged("DefaultDatabase"); } }