public FancyZonesViewModel() { try { Settings = SettingsUtils.GetSettings <FancyZonesSettings>(ModuleName); } catch { Settings = new FancyZonesSettings(); SettingsUtils.SaveSettings(Settings.ToJsonString(), ModuleName); } this.LaunchEditorEventHandler = new ButtonClickCommand(LaunchEditor); this._shiftDrag = Settings.Properties.FancyzonesShiftDrag.Value; this._mouseSwitch = Settings.Properties.FancyzonesMouseSwitch.Value; this._overrideSnapHotkeys = Settings.Properties.FancyzonesOverrideSnapHotkeys.Value; this._moveWindowsAcrossMonitors = Settings.Properties.FancyzonesMoveWindowsAcrossMonitors.Value; this._displayChangemoveWindows = Settings.Properties.FancyzonesDisplayChangeMoveWindows.Value; this._zoneSetChangeMoveWindows = Settings.Properties.FancyzonesZoneSetChangeMoveWindows.Value; this._appLastZoneMoveWindows = Settings.Properties.FancyzonesAppLastZoneMoveWindows.Value; this._openWindowOnActiveMonitor = Settings.Properties.FancyzonesOpenWindowOnActiveMonitor.Value; this._restoreSize = Settings.Properties.FancyzonesRestoreSize.Value; this._useCursorPosEditorStartupScreen = Settings.Properties.UseCursorposEditorStartupscreen.Value; this._showOnAllMonitors = Settings.Properties.FancyzonesShowOnAllMonitors.Value; this._makeDraggedWindowTransparent = Settings.Properties.FancyzonesMakeDraggedWindowTransparent.Value; this._highlightOpacity = Settings.Properties.FancyzonesHighlightOpacity.Value; this._excludedApps = Settings.Properties.FancyzonesExcludedApps.Value; this.EditorHotkey = Settings.Properties.FancyzonesEditorHotkey.Value; string inactiveColor = Settings.Properties.FancyzonesInActiveColor.Value; this._zoneInActiveColor = inactiveColor != string.Empty ? inactiveColor.ToColor() : "#F5FCFF".ToColor(); string borderColor = Settings.Properties.FancyzonesBorderColor.Value; this._zoneBorderColor = borderColor != string.Empty ? borderColor.ToColor() : "#FFFFFF".ToColor(); string highlightColor = Settings.Properties.FancyzonesZoneHighlightColor.Value; this._zoneHighlightColor = highlightColor != string.Empty ? highlightColor.ToColor() : "#0078D7".ToColor(); GeneralSettings generalSettings; try { generalSettings = SettingsUtils.GetSettings <GeneralSettings>(string.Empty); } catch { generalSettings = new GeneralSettings(); SettingsUtils.SaveSettings(generalSettings.ToJsonString(), string.Empty); } this._isEnabled = generalSettings.Enabled.FancyZones; }
public FancyZonesViewModel() { try { Settings = SettingsUtils.GetSettings <FancyZonesSettings>(ModuleName); } catch { Settings = new FancyZonesSettings(); SettingsUtils.SaveSettings(Settings.ToJsonString(), ModuleName); } this.LaunchEditorEventHandler = new ButtonClickCommand(LaunchEditor); this._shiftDrag = Settings.Properties.FancyzonesShiftDrag.Value; this._overrideSnapHotkeys = Settings.Properties.FancyzonesOverrideSnapHotkeys.Value; this._flashZones = Settings.Properties.FancyzonesZoneSetChangeFlashZones.Value; this._displayChangemoveWindows = Settings.Properties.FancyzonesDisplayChangeMoveWindows.Value; this._zoneSetChangeMoveWindows = Settings.Properties.FancyzonesZoneSetChangeMoveWindows.Value; this._virtualDesktopChangeMoveWindows = Settings.Properties.FancyzonesVirtualDesktopChangeMoveWindows.Value; this._appLastZoneMoveWindows = Settings.Properties.FancyzonesAppLastZoneMoveWindows.Value; this._useCursorPosEditorStartupScreen = Settings.Properties.UseCursorposEditorStartupscreen.Value; this._showOnAllMonitors = Settings.Properties.FancyzonesShowOnAllMonitors.Value; this._zoneHighlightColor = Settings.Properties.FancyzonesZoneHighlightColor.Value; this._highlightOpacity = Settings.Properties.FancyzonesHighlightOpacity.Value; this._excludedApps = Settings.Properties.FancyzonesExcludedApps.Value; this._editorHotkey = Settings.Properties.FancyzonesEditorHotkey.Value; this._zoneBorderColor = Settings.Properties.FancyzonesBorderColor.Value; this._zoneInActiveColor = Settings.Properties.FancyzonesInActiveColor.Value; GeneralSettings generalSettings; try { generalSettings = SettingsUtils.GetSettings <GeneralSettings>(string.Empty); } catch { generalSettings = new GeneralSettings(); SettingsUtils.SaveSettings(generalSettings.ToJsonString(), string.Empty); } this._isEnabled = generalSettings.Enabled.FancyZones; }
public FancyZonesViewModel(Func <string, int> ipcMSGCallBackFunc, string configFileSubfolder = "") { settingsConfigFileFolder = configFileSubfolder; try { Settings = SettingsUtils.GetSettings <FancyZonesSettings>(GetSettingsSubPath()); } catch { Settings = new FancyZonesSettings(); SettingsUtils.SaveSettings(Settings.ToJsonString(), GetSettingsSubPath()); } LaunchEditorEventHandler = new ButtonClickCommand(LaunchEditor); _shiftDrag = Settings.Properties.FancyzonesShiftDrag.Value; _mouseSwitch = Settings.Properties.FancyzonesMouseSwitch.Value; _overrideSnapHotkeys = Settings.Properties.FancyzonesOverrideSnapHotkeys.Value; _moveWindowsAcrossMonitors = Settings.Properties.FancyzonesMoveWindowsAcrossMonitors.Value; _moveWindowsBasedOnPosition = Settings.Properties.FancyzonesMoveWindowsBasedOnPosition.Value; _displayChangemoveWindows = Settings.Properties.FancyzonesDisplayChangeMoveWindows.Value; _zoneSetChangeMoveWindows = Settings.Properties.FancyzonesZoneSetChangeMoveWindows.Value; _appLastZoneMoveWindows = Settings.Properties.FancyzonesAppLastZoneMoveWindows.Value; _openWindowOnActiveMonitor = Settings.Properties.FancyzonesOpenWindowOnActiveMonitor.Value; _restoreSize = Settings.Properties.FancyzonesRestoreSize.Value; _useCursorPosEditorStartupScreen = Settings.Properties.UseCursorposEditorStartupscreen.Value; _showOnAllMonitors = Settings.Properties.FancyzonesShowOnAllMonitors.Value; _makeDraggedWindowTransparent = Settings.Properties.FancyzonesMakeDraggedWindowTransparent.Value; _highlightOpacity = Settings.Properties.FancyzonesHighlightOpacity.Value; _excludedApps = Settings.Properties.FancyzonesExcludedApps.Value; EditorHotkey = Settings.Properties.FancyzonesEditorHotkey.Value; // set the callback functions value to hangle outgoing IPC message. SendConfigMSG = ipcMSGCallBackFunc; string inactiveColor = Settings.Properties.FancyzonesInActiveColor.Value; _zoneInActiveColor = inactiveColor != string.Empty ? inactiveColor : "#F5FCFF"; string borderColor = Settings.Properties.FancyzonesBorderColor.Value; _zoneBorderColor = borderColor != string.Empty ? borderColor : "#FFFFFF"; string highlightColor = Settings.Properties.FancyzonesZoneHighlightColor.Value; _zoneHighlightColor = highlightColor != string.Empty ? highlightColor : "#0078D7"; GeneralSettings generalSettings; try { generalSettings = SettingsUtils.GetSettings <GeneralSettings>(string.Empty); } catch { generalSettings = new GeneralSettings(); SettingsUtils.SaveSettings(generalSettings.ToJsonString(), string.Empty); } _isEnabled = generalSettings.Enabled.FancyZones; }