[FZ Settings] replaced checkbox with radiobuttons (#9438)

This commit is contained in:
Seraphima Zykova
2021-02-03 14:12:53 +03:00
committed by GitHub
parent 4cffc825c8
commit 32d164a786
3 changed files with 48 additions and 9 deletions

View File

@@ -26,6 +26,12 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private string settingsConfigFileFolder = string.Empty;
private enum MoveWindowBehaviour
{
MoveWindowBasedOnZoneIndex = 0,
MoveWindowBasedOnPosition,
}
public FancyZonesViewModel(ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<FancyZonesSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
{
// To obtain the general settings configurations of PowerToys Settings.
@@ -51,7 +57,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
_mouseSwitch = Settings.Properties.FancyzonesMouseSwitch.Value;
_overrideSnapHotkeys = Settings.Properties.FancyzonesOverrideSnapHotkeys.Value;
_moveWindowsAcrossMonitors = Settings.Properties.FancyzonesMoveWindowsAcrossMonitors.Value;
_moveWindowsBasedOnPosition = Settings.Properties.FancyzonesMoveWindowsBasedOnPosition.Value;
_moveWindowBehaviour = Settings.Properties.FancyzonesMoveWindowsBasedOnPosition.Value ? MoveWindowBehaviour.MoveWindowBasedOnPosition : MoveWindowBehaviour.MoveWindowBasedOnZoneIndex;
_displayChangemoveWindows = Settings.Properties.FancyzonesDisplayChangeMoveWindows.Value;
_zoneSetChangeMoveWindows = Settings.Properties.FancyzonesZoneSetChangeMoveWindows.Value;
_appLastZoneMoveWindows = Settings.Properties.FancyzonesAppLastZoneMoveWindows.Value;
@@ -85,7 +91,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private bool _mouseSwitch;
private bool _overrideSnapHotkeys;
private bool _moveWindowsAcrossMonitors;
private bool _moveWindowsBasedOnPosition;
private MoveWindowBehaviour _moveWindowBehaviour;
private bool _displayChangemoveWindows;
private bool _zoneSetChangeMoveWindows;
private bool _appLastZoneMoveWindows;
@@ -217,20 +223,40 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
{
get
{
return _moveWindowsBasedOnPosition;
return _moveWindowBehaviour == MoveWindowBehaviour.MoveWindowBasedOnPosition;
}
set
{
if (value != _moveWindowsBasedOnPosition)
var settingsValue = Settings.Properties.FancyzonesMoveWindowsBasedOnPosition.Value;
if (value != settingsValue)
{
_moveWindowsBasedOnPosition = value;
_moveWindowBehaviour = value ? MoveWindowBehaviour.MoveWindowBasedOnPosition : MoveWindowBehaviour.MoveWindowBasedOnZoneIndex;
Settings.Properties.FancyzonesMoveWindowsBasedOnPosition.Value = value;
NotifyPropertyChanged();
}
}
}
public bool MoveWindowsBasedOnZoneIndex
{
get
{
return _moveWindowBehaviour == MoveWindowBehaviour.MoveWindowBasedOnZoneIndex;
}
set
{
var settingsValue = Settings.Properties.FancyzonesMoveWindowsBasedOnPosition.Value;
if (value == settingsValue)
{
_moveWindowBehaviour = value ? MoveWindowBehaviour.MoveWindowBasedOnZoneIndex : MoveWindowBehaviour.MoveWindowBasedOnPosition;
Settings.Properties.FancyzonesMoveWindowsBasedOnPosition.Value = !value;
NotifyPropertyChanged();
}
}
}
public bool DisplayChangeMoveWindows
{
get