/// <summary> /// Gets the settings of dock window manager to save. /// </summary> /// <returns></returns> protected override StorableSettings GetSettingsCore() { StorableSettings settings = base.GetSettingsCore(); settings.GlobalSettings[themeKey] = Theme.ToString(); return(settings); }
public void ApplySettings(StorableSettings storableSettings) { if (storableSettings != null && storableSettings.GlobalSettings.ContainsKey("Items")) { ApplySettingsCore(JsonConvert.DeserializeObject <XElement>(storableSettings.GlobalSettings["Items"])); } }
/// <summary> /// Applies the settings core. /// </summary> /// <param name="settings">The settings.</param> protected override void ApplySettingsCore(StorableSettings settings) { bool useWizard = false; base.ApplySettingsCore(settings); if (settings.GlobalSettings.ContainsKey("UseWizard") && bool.TryParse(settings.GlobalSettings["UseWizard"], out useWizard)) { UseWizard = useWizard; } if (settings.GlobalSettings.ContainsKey("StyleLibraryFolders")) { try { folders.Clear(); var xEl = XDocument.Parse(settings.GlobalSettings["StyleLibraryFolders"]); foreach (var folderElement in xEl.Descendants("Folder")) { if (Directory.Exists(folderElement.Value)) { folders.Add(folderElement.Value); } } } catch (Exception exception) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, exception.Message, new ExceptionInfo(exception)); } } }
public StorableSettings GetSettings() { StorableSettings settings = new StorableSettings(); settings.GlobalSettings["Items"] = JsonConvert.SerializeObject(GetSettingsCore()); return(settings); }
private void ApplySettingsInternal(IEnumerable <IStorableSettings> settings) { IonicZipFileAdapter globalsZipAdapter = null; IonicZipFileAdapter projectZipAdapter = null; try { globalsZipAdapter = new IonicZipFileAdapter(GlobalsSettingsPathFileName); projectZipAdapter = new IonicZipFileAdapter(ProjectSettingsPathFileName); foreach (var item in settings) { string typeFullName = item.GetType().FullName; StorableSettings tmpSettings = new StorableSettings(); FillSettings(globalsZipAdapter, typeFullName, tmpSettings, s => s.GlobalSettings); FillSettings(projectZipAdapter, typeFullName, tmpSettings, s => tmpSettings.ProjectSettings); item.ApplySettings(tmpSettings); } } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); } finally { if (globalsZipAdapter != null) { globalsZipAdapter.Dispose(); } if (projectZipAdapter != null) { projectZipAdapter.Dispose(); } } }
/// <summary> /// Applies the settings to this plugin. /// </summary> /// <param name="settings">The settings to be applied to this plugin.</param> public void ApplySettings(StorableSettings settings) { //PluginHelper.RestoreBoolean(settings.GlobalSettings, "IsRequired", v => IsRequired = v); PluginHelper.RestoreBoolean(settings.GlobalSettings, "IsActive", v => IsActive = IsRequired || v); PluginHelper.RestoreInteger(settings.GlobalSettings, "Index", v => Index = v); ApplySettingsCore(settings); }
/// <summary> /// Applies the settings core. /// </summary> /// <param name="settings">The settings.</param> protected override void ApplySettingsCore(StorableSettings settings) { base.ApplySettingsCore(settings); PluginHelper.RestoreInteger(settings.GlobalSettings, "Language", v => { LanguageSetting.Instance.Language = new CultureInfo(v); SetCurrentLanguage(LanguageSetting.Instance.Language); }); }
/// <summary> /// Applies the settings core. /// </summary> /// <param name="settings">The settings.</param> protected override void ApplySettingsCore(StorableSettings settings) { base.ApplySettingsCore(settings); if (settings.ProjectSettings.ContainsKey("Setting")) { try { LoadProjectSettingInternal(XElement.Parse(settings.ProjectSettings["Setting"])); } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); } } }
protected override void ApplySettingsCore(StorableSettings settings) { base.ApplySettingsCore(settings); RestoreBool(settings.GlobalSettings, autoSaveKey, a => AutoSave = a); RestoreEnum <MouseCoordinateType>(settings.GlobalSettings, mouseCoordinateKey, m => MouseCoordinateType = m); RestoreString(settings.GlobalSettings, windowLocationKey, w => windowLocation = w); RestoreInt(settings.GlobalSettings, ThreadMaxCountKey, w => ThreadMaxCount = w); RestoreInt(settings.GlobalSettings, ThreadMinCountKey, w => ThreadMinCount = w); RestoreString(settings.GlobalSettings, recentProjectFilesKey, r => recentProjectFiles = r); RestoreBool(settings.GlobalSettings, IsDisplayAutoSaveKey, r => IsDisplayAutoSave = r); if (!settings.GlobalSettings.ContainsKey("ShowHints")) { settings.GlobalSettings["ShowHints"] = new XElement("ShowHints", "").ToString(); } if (!settings.GlobalSettings.ContainsKey(currentExtentKey)) { settings.GlobalSettings[currentExtentKey] = new XElement(currentExtentKey, "").ToString(); } if (Application.Current != null && Application.Current.MainWindow.Tag is Dictionary <string, string> ) { (Application.Current.MainWindow.Tag as Dictionary <string, string>)["ShowHintSettings"] = settings.GlobalSettings["ShowHints"]; (Application.Current.MainWindow.Tag as Dictionary <string, string>)[currentExtentKey] = settings.GlobalSettings[currentExtentKey]; } if (settings.GlobalSettings.ContainsKey("Scales")) { try { var xEl = XDocument.Parse(settings.GlobalSettings["Scales"]); scales.Clear(); foreach (var item in xEl.Descendants("scale")) { double scale = 0; if (double.TryParse(item.Value, out scale)) { scales.Add(scale); } } } catch { } } }
/// <summary> /// Applies the settings of dock window manager. /// </summary> /// <param name="settings">The settings.</param> protected override void ApplySettingsCore(StorableSettings settings) { base.ApplySettingsCore(settings); PluginHelper.RestoreEnum <Theme>(settings.GlobalSettings, themeKey, t => Theme = t); }
private void FillSettings(IonicZipFileAdapter zipAdapter, string typeFullName, StorableSettings settings, Func <StorableSettings, Dictionary <string, string> > getSettingDictionary) { string entryName = typeFullName + ".xml"; XElement xml = null; Stream xmlStream = zipAdapter.GetEntryStreamByName(entryName); if (xmlStream != null) { xml = XElement.Load(xmlStream); } if (xml != null) { var currentSettingStateXml = xml; Dictionary <string, string> sourceStateDictionary = SettingAdapter.FromXml(currentSettingStateXml); Dictionary <string, string> targetStateDictionary = getSettingDictionary(settings); foreach (var stateItem in sourceStateDictionary) { targetStateDictionary.Add(stateItem.Key, stateItem.Value); } } }
protected override void ApplySettingsCore(StorableSettings settings) { base.ApplySettingsCore(settings); var gisEidtorControl = quickAccessToolbarSettingViewModel.GisEditorUserControl; if (gisEidtorControl != null) { if (settings.GlobalSettings.ContainsKey("QuickAccessToolbarOrder")) { var orderString = settings.GlobalSettings["QuickAccessToolbarOrder"]; string[] orders = orderString.Split(','); if (Application.Current != null) { Application.Current.Dispatcher.BeginInvoke(() => { quickAccessToolbarSettingViewModel.ListItemSource.Clear(); foreach (var order in orders) { var ribbonControl = gisEidtorControl.ribbonContainer.Items.OfType <RibbonTab>().SelectMany(g => g.Items.OfType <RibbonGroup>()) .SelectMany(g => g.Items.OfType <IInputElement>()) .FirstOrDefault(i => CheckCanAddToQuickAccessBar(i, order)); if (ribbonControl != null) { RibbonCommands.AddToQuickAccessToolBarCommand.Execute(null, ribbonControl); } else { var ribbonMenu = gisEidtorControl.ribbonContainer.ApplicationMenu.Items.OfType <IInputElement>().FirstOrDefault(i => CheckCanAddToQuickAccessBar(i, order)); if (ribbonMenu != null) { RibbonCommands.AddToQuickAccessToolBarCommand.Execute(null, ribbonMenu); } else { gisEidtorControl.ApplicationMenu_DropDownOpened(null, null); var ribbonTheme = GisEditor.UIManager.GetActiveUIPlugins <UIPlugin>() .SelectMany(p => p.ApplicationMenuItems) .SelectMany(i => i.Items.OfType <IInputElement>()) .FirstOrDefault(i => CheckCanAddToQuickAccessBar(i, order)); if (ribbonTheme != null) { RibbonCommands.AddToQuickAccessToolBarCommand.Execute(null, ribbonTheme); } } } } }, DispatcherPriority.Background); } } else { Application.Current.Dispatcher.BeginInvoke(() => { InitializeQuickAccessToolBarItems(gisEidtorControl); }, DispatcherPriority.Background); } } }
/// <summary> /// Applies the settings to this manager. /// </summary> /// <param name="settings">The settings to be applied to this manager.</param> protected virtual void ApplySettingsCore(StorableSettings settings) { }
/// <summary> /// Applies the settings to this manager. /// </summary> /// <param name="settings">The settings to be applied to this manager.</param> public void ApplySettings(StorableSettings settings) { ApplySettingsCore(settings); }
public override Dictionary <string, string> GetSetting(StorableSettings settings) { return(settings.ProjectSettings); }
public abstract Dictionary <string, string> GetSetting(StorableSettings settings);