mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add property change for settings class & Add localize support for enum
This commit is contained in:
parent
5b6ea73513
commit
d363cf8137
1 changed files with 114 additions and 9 deletions
|
|
@ -1,24 +1,121 @@
|
|||
using System.Collections.Generic;
|
||||
using Flow.Launcher.Localization.Attributes;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Shell
|
||||
{
|
||||
public class Settings
|
||||
public class Settings : BaseModel
|
||||
{
|
||||
public Shell Shell { get; set; } = Shell.Cmd;
|
||||
private Shell _shell = Shell.Cmd;
|
||||
public Shell Shell
|
||||
{
|
||||
get => _shell;
|
||||
set
|
||||
{
|
||||
if (_shell != value)
|
||||
{
|
||||
_shell = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReplaceWinR { get; set; } = false;
|
||||
private bool _replaceWinR = false;
|
||||
public bool ReplaceWinR
|
||||
{
|
||||
get => _replaceWinR;
|
||||
set
|
||||
{
|
||||
if (_replaceWinR != value)
|
||||
{
|
||||
_replaceWinR = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool CloseShellAfterPress { get; set; } = false;
|
||||
private bool _closeShellAfterPress = false;
|
||||
public bool CloseShellAfterPress
|
||||
{
|
||||
get => _closeShellAfterPress;
|
||||
set
|
||||
{
|
||||
if (_closeShellAfterPress != value)
|
||||
{
|
||||
_closeShellAfterPress = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool LeaveShellOpen { get; set; }
|
||||
private bool _leaveShellOpen;
|
||||
public bool LeaveShellOpen
|
||||
{
|
||||
get => _leaveShellOpen;
|
||||
set
|
||||
{
|
||||
if (_leaveShellOpen != value)
|
||||
{
|
||||
_leaveShellOpen = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool RunAsAdministrator { get; set; } = true;
|
||||
private bool _runAsAdministrator = true;
|
||||
public bool RunAsAdministrator
|
||||
{
|
||||
get => _runAsAdministrator;
|
||||
set
|
||||
{
|
||||
if (_runAsAdministrator != value)
|
||||
{
|
||||
_runAsAdministrator = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool UseWindowsTerminal { get; set; } = false;
|
||||
private bool _useWindowsTerminal = false;
|
||||
public bool UseWindowsTerminal
|
||||
{
|
||||
get => _useWindowsTerminal;
|
||||
set
|
||||
{
|
||||
if (_useWindowsTerminal != value)
|
||||
{
|
||||
_useWindowsTerminal = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowOnlyMostUsedCMDs { get; set; }
|
||||
private bool _showOnlyMostUsedCMDs;
|
||||
public bool ShowOnlyMostUsedCMDs
|
||||
{
|
||||
get => _showOnlyMostUsedCMDs;
|
||||
set
|
||||
{
|
||||
if (_showOnlyMostUsedCMDs != value)
|
||||
{
|
||||
_showOnlyMostUsedCMDs = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int ShowOnlyMostUsedCMDsNumber { get; set; }
|
||||
private int _showOnlyMostUsedCMDsNumber;
|
||||
public int ShowOnlyMostUsedCMDsNumber
|
||||
{
|
||||
get => _showOnlyMostUsedCMDsNumber;
|
||||
set
|
||||
{
|
||||
if (_showOnlyMostUsedCMDsNumber != value)
|
||||
{
|
||||
_showOnlyMostUsedCMDsNumber = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, int> CommandHistory { get; set; } = [];
|
||||
|
||||
|
|
@ -31,11 +128,19 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
}
|
||||
}
|
||||
|
||||
[EnumLocalize]
|
||||
public enum Shell
|
||||
{
|
||||
[EnumLocalizeValue("CMD")]
|
||||
Cmd = 0,
|
||||
|
||||
[EnumLocalizeValue("PowerShell")]
|
||||
Powershell = 1,
|
||||
|
||||
[EnumLocalizeValue("RunCommand")]
|
||||
RunCommand = 2,
|
||||
|
||||
[EnumLocalizeValue("Pwsh")]
|
||||
Pwsh = 3,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue