mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-12 10:19:20 +08:00
Enable PowerLauncher toggle
This commit is contained in:
parent
4331e9ae80
commit
c35e70173b
@ -16,6 +16,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
this.FileExplorerPreview = false;
|
||||
this.PowerRename = false;
|
||||
this.ShortcutGuide = false;
|
||||
this.PowerLauncher = false;
|
||||
}
|
||||
|
||||
[JsonPropertyName("FancyZones")]
|
||||
@ -34,6 +35,9 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
|
||||
[JsonPropertyName("Keyboard Manager")]
|
||||
public bool KeyboardManager { get; set; }
|
||||
|
||||
[JsonPropertyName("Launcher")]
|
||||
public bool PowerLauncher { get; set; }
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
|
@ -14,6 +14,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
private const string POWERTOYNAME = "PowerLauncher";
|
||||
private PowerLauncherSettings settings;
|
||||
private GeneralSettings generalSettings;
|
||||
|
||||
public PowerLauncherViewModel()
|
||||
{
|
||||
@ -25,6 +26,16 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
settings = new PowerLauncherSettings();
|
||||
}
|
||||
|
||||
if (SettingsUtils.SettingsExists())
|
||||
{
|
||||
generalSettings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
generalSettings = new GeneralSettings();
|
||||
SettingsUtils.SaveSettings(generalSettings.ToJsonString(), string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateSettings([CallerMemberName] string propertyName = null)
|
||||
@ -49,15 +60,18 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return settings.properties.enable_powerlauncher;
|
||||
return generalSettings.Enabled.PowerLauncher;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.properties.enable_powerlauncher != value)
|
||||
if (generalSettings.Enabled.PowerLauncher != value)
|
||||
{
|
||||
settings.properties.enable_powerlauncher = value;
|
||||
UpdateSettings();
|
||||
generalSettings.Enabled.PowerLauncher = value;
|
||||
OnPropertyChanged(nameof(EnablePowerLauncher));
|
||||
SettingsUtils.SaveSettings(generalSettings.ToJsonString(), string.Empty);
|
||||
OutGoingGeneralSettings outgoing = new OutGoingGeneralSettings(generalSettings);
|
||||
ShellPage.DefaultSndMSGCallback(outgoing.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +60,7 @@
|
||||
SelectedItem="{x:Bind Mode=TwoWay, Path=SelectedSearchResultPreference}"
|
||||
SelectedValuePath="Item2"
|
||||
DisplayMemberPath="Item1"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
/>
|
||||
|
||||
<ComboBox x:Uid="PowerLauncher_SearchTypePreference"
|
||||
@ -69,6 +70,7 @@
|
||||
SelectedItem="{x:Bind Mode=TwoWay, Path=SelectedSearchTypePreference}"
|
||||
SelectedValuePath="Item2"
|
||||
DisplayMemberPath="Item1"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
/>
|
||||
|
||||
<muxc:NumberBox x:Uid="PowerLauncher_MaximumNumberOfResults"
|
||||
@ -77,7 +79,8 @@
|
||||
SpinButtonPlacementMode="Inline"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Minimum="1"/>
|
||||
Minimum="1"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"/>
|
||||
|
||||
<TextBlock x:Uid="PowerLauncher_Shortcuts"
|
||||
Width="320"
|
||||
@ -89,37 +92,42 @@
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HotkeySettings="{x:Bind Path=ViewModel.OpenPowerLauncher, Mode=TwoWay}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
/>
|
||||
<Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenFileLocation"
|
||||
Width="320"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HotkeySettings="{x:Bind Path=ViewModel.OpenFileLocation, Mode=TwoWay}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
/>
|
||||
<Custom:HotkeySettingsControl x:Uid="PowerLauncher_CopyPathLocation"
|
||||
Width="320"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HotkeySettings="{x:Bind Path=ViewModel.CopyPathLocation, Mode=TwoWay}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
/>
|
||||
<Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenConsole"
|
||||
Width="320"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HotkeySettings="{x:Bind Path=ViewModel.OpenConsole, Mode=TwoWay}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
/>
|
||||
|
||||
<CheckBox x:Uid="PowerLauncher_OverrideWinRKey"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.OverrideWinRKey}"/>
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.OverrideWinRKey}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
/>
|
||||
|
||||
<CheckBox x:Uid="PowerLauncher_OverrideWinSKey"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.OverrideWinSKey}" />
|
||||
|
||||
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.OverrideWinSKey}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel
|
||||
x:Name="SidePanel"
|
||||
Orientation="Vertical"
|
||||
|
Loading…
Reference in New Issue
Block a user