mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-23 19:49:43 +01:00
[Settings] Migrate PT Run Settings (#5768)
* added MSTest project * Migrated PT Run Tests * reverted changes to xaml file * fixed Sttings.UI.csproj file * added parameter for default key code
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib.Helpers;
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib.ViewModels
|
||||
{
|
||||
public class PowerLauncherViewModel : Observable
|
||||
{
|
||||
@@ -19,34 +18,46 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
private readonly SendCallback callback;
|
||||
|
||||
public PowerLauncherViewModel()
|
||||
{
|
||||
callback = (PowerLauncherSettings settings) =>
|
||||
{
|
||||
// Propagate changes to Power Launcher through IPC
|
||||
ShellPage.DefaultSndMSGCallback(
|
||||
string.Format("{{ \"powertoys\": {{ \"{0}\": {1} }} }}", PowerLauncherSettings.ModuleName, JsonSerializer.Serialize(settings)));
|
||||
};
|
||||
if (SettingsUtils.SettingsExists(PowerLauncherSettings.ModuleName))
|
||||
{
|
||||
settings = SettingsUtils.GetSettings<PowerLauncherSettings>(PowerLauncherSettings.ModuleName);
|
||||
}
|
||||
else
|
||||
{
|
||||
settings = new PowerLauncherSettings();
|
||||
settings.Properties.OpenPowerLauncher.Alt = true;
|
||||
settings.Properties.OpenPowerLauncher.Code = (int)Windows.System.VirtualKey.Space;
|
||||
settings.Properties.MaximumNumberOfResults = 4;
|
||||
callback(settings);
|
||||
}
|
||||
private Func<string, int> SendConfigMSG { get; }
|
||||
|
||||
if (SettingsUtils.SettingsExists())
|
||||
public PowerLauncherViewModel(Func<string, int> ipcMSGCallBackFunc, int defaultKeyCode)
|
||||
{
|
||||
try
|
||||
{
|
||||
generalSettings = SettingsUtils.GetSettings<GeneralSettings>();
|
||||
callback = (PowerLauncherSettings settings) =>
|
||||
{
|
||||
// Propagate changes to Power Launcher through IPC
|
||||
SendConfigMSG(
|
||||
string.Format("{{ \"powertoys\": {{ \"{0}\": {1} }} }}", PowerLauncherSettings.ModuleName, JsonSerializer.Serialize(settings)));
|
||||
};
|
||||
if (SettingsUtils.SettingsExists(PowerLauncherSettings.ModuleName))
|
||||
{
|
||||
settings = SettingsUtils.GetSettings<PowerLauncherSettings>(PowerLauncherSettings.ModuleName);
|
||||
}
|
||||
else
|
||||
{
|
||||
settings = new PowerLauncherSettings();
|
||||
settings.Properties.OpenPowerLauncher.Alt = true;
|
||||
settings.Properties.OpenPowerLauncher.Code = defaultKeyCode;
|
||||
settings.Properties.MaximumNumberOfResults = 4;
|
||||
callback(settings);
|
||||
}
|
||||
|
||||
if (SettingsUtils.SettingsExists())
|
||||
{
|
||||
generalSettings = SettingsUtils.GetSettings<GeneralSettings>();
|
||||
}
|
||||
else
|
||||
{
|
||||
generalSettings = new GeneralSettings();
|
||||
}
|
||||
|
||||
// set the callback functions value to hangle outgoing IPC message.
|
||||
SendConfigMSG = ipcMSGCallBackFunc;
|
||||
}
|
||||
else
|
||||
catch
|
||||
{
|
||||
generalSettings = new GeneralSettings();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +89,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
generalSettings.Enabled.PowerLauncher = value;
|
||||
OnPropertyChanged(nameof(EnablePowerLauncher));
|
||||
OutGoingGeneralSettings outgoing = new OutGoingGeneralSettings(generalSettings);
|
||||
ShellPage.DefaultSndMSGCallback(outgoing.ToString());
|
||||
SendConfigMSG(outgoing.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -168,23 +179,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings OpenConsole
|
||||
{
|
||||
get
|
||||
{
|
||||
return settings.Properties.OpenConsole;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.Properties.OpenConsole != value)
|
||||
{
|
||||
settings.Properties.OpenConsole = value;
|
||||
UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings CopyPathLocation
|
||||
{
|
||||
get
|
||||
@@ -1,32 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ViewModelTests
|
||||
{
|
||||
[TestClass]
|
||||
public class SampleTest
|
||||
{
|
||||
[TestInitialize]
|
||||
public void Setup()
|
||||
{
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void CleanUp()
|
||||
{
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SampleTest_For_Settings()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib.ViewModels;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ViewModelTests
|
||||
{
|
||||
[TestClass]
|
||||
public class PowerLauncherViewModelTest
|
||||
{
|
||||
private class SendCallbackMock
|
||||
{
|
||||
public int TimesSent { get; set; }
|
||||
|
||||
public void OnSend(PowerLauncherSettings settings)
|
||||
{
|
||||
TimesSent++;
|
||||
}
|
||||
}
|
||||
|
||||
private PowerLauncherViewModel viewModel;
|
||||
private PowerLauncherSettings mockSettings;
|
||||
private SendCallbackMock sendCallbackMock;
|
||||
|
||||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
mockSettings = new PowerLauncherSettings();
|
||||
sendCallbackMock = new SendCallbackMock();
|
||||
|
||||
viewModel = new PowerLauncherViewModel(
|
||||
mockSettings,
|
||||
new PowerLauncherViewModel.SendCallback(sendCallbackMock.OnSend));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SearchPreference_ShouldUpdatePreferences()
|
||||
{
|
||||
viewModel.SearchResultPreference = "SearchOptionsAreNotValidated";
|
||||
viewModel.SearchTypePreference = "SearchOptionsAreNotValidated";
|
||||
|
||||
Assert.AreEqual(sendCallbackMock.TimesSent, 2);
|
||||
Assert.IsTrue(mockSettings.Properties.SearchResultPreference == "SearchOptionsAreNotValidated");
|
||||
Assert.IsTrue(mockSettings.Properties.SearchTypePreference == "SearchOptionsAreNotValidated");
|
||||
}
|
||||
|
||||
public void AssertHotkeySettings(HotkeySettings setting, bool win, bool ctrl, bool alt, bool shift, int code)
|
||||
{
|
||||
Assert.AreEqual(win, setting.Win);
|
||||
Assert.AreEqual(ctrl, setting.Ctrl);
|
||||
Assert.AreEqual(alt, setting.Alt);
|
||||
Assert.AreEqual(shift, setting.Shift);
|
||||
Assert.AreEqual(code, setting.Code);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Hotkeys_ShouldUpdateHotkeys()
|
||||
{
|
||||
var openPowerLauncher = new HotkeySettings();
|
||||
openPowerLauncher.Win = true;
|
||||
openPowerLauncher.Code = 83;
|
||||
|
||||
var openFileLocation = new HotkeySettings();
|
||||
openFileLocation.Ctrl = true;
|
||||
openFileLocation.Code = 65;
|
||||
|
||||
var openConsole = new HotkeySettings();
|
||||
openConsole.Alt = true;
|
||||
openConsole.Code = 68;
|
||||
|
||||
var copyFileLocation = new HotkeySettings();
|
||||
copyFileLocation.Shift = true;
|
||||
copyFileLocation.Code = 70;
|
||||
|
||||
viewModel.OpenPowerLauncher = openPowerLauncher;
|
||||
viewModel.OpenFileLocation = openFileLocation;
|
||||
viewModel.CopyPathLocation = copyFileLocation;
|
||||
|
||||
Assert.AreEqual(3, sendCallbackMock.TimesSent);
|
||||
|
||||
AssertHotkeySettings(
|
||||
mockSettings.Properties.OpenPowerLauncher,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
83);
|
||||
AssertHotkeySettings(
|
||||
mockSettings.Properties.OpenFileLocation,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
65);
|
||||
AssertHotkeySettings(
|
||||
mockSettings.Properties.CopyPathLocation,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
70);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Override_ShouldUpdateOverrides()
|
||||
{
|
||||
viewModel.OverrideWinRKey = true;
|
||||
viewModel.OverrideWinSKey = false;
|
||||
|
||||
Assert.AreEqual(1, sendCallbackMock.TimesSent);
|
||||
|
||||
Assert.IsTrue(mockSettings.Properties.OverrideWinkeyR);
|
||||
Assert.IsFalse(mockSettings.Properties.OverrideWinkeyS);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DriveDetectionViewModel_WhenSet_MustUpdateOverrides()
|
||||
{
|
||||
// Act
|
||||
viewModel.DisableDriveDetectionWarning = true;
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, sendCallbackMock.TimesSent);
|
||||
Assert.IsTrue(mockSettings.Properties.DisableDriveDetectionWarning);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,6 @@
|
||||
<Compile Include="Services\ActivationService.cs" />
|
||||
<Compile Include="Services\NavigationService.cs" />
|
||||
<Compile Include="ViewModels\Commands\ButtonClickCommand.cs" />
|
||||
<Compile Include="ViewModels\PowerLauncherViewModel.cs" />
|
||||
<Compile Include="ViewModels\ShellViewModel.cs" />
|
||||
<Compile Include="Views\ColorPickerPage.xaml.cs">
|
||||
<DependentUpon>ColorPickerPage.xaml</DependentUpon>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<Page
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerLauncherPage"
|
||||
xmlns:viewModel="using:Microsoft.PowerToys.Settings.UI.ViewModels"
|
||||
xmlns:CustomControls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Page
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerLauncherPage"
|
||||
xmlns:viewModel="using:Microsoft.PowerToys.Settings.UI.ViewModels"
|
||||
xmlns:CustomControls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid RowSpacing="{StaticResource DefaultRowSpacing}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="LayoutVisualStates">
|
||||
@@ -35,136 +35,136 @@
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Orientation="Vertical" x:Name="LauncherView">
|
||||
<ToggleSwitch x:Uid="PowerLauncher_EnablePowerLauncher"
|
||||
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.EnablePowerLauncher}"/>
|
||||
|
||||
<TextBlock x:Uid="PowerLauncher_Shortcuts"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<CustomControls:HotkeySettingsControl x:Uid="PowerLauncher_OpenPowerLauncher"
|
||||
Width="240"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HotkeySettings="{x:Bind Path=ViewModel.OpenPowerLauncher, Mode=TwoWay}"
|
||||
Keys="Win, Ctrl, Alt, Shift"
|
||||
Enabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"/>
|
||||
<!--<Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenFileLocation"
|
||||
Width="320"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HotkeySettings="{Binding Path=ViewModel.OpenFileLocation, Mode=TwoWay}"
|
||||
IsEnabled="False"
|
||||
/>
|
||||
<Custom:HotkeySettingsControl x:Uid="PowerLauncher_CopyPathLocation"
|
||||
Width="320"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HotkeySettings="{Binding Path=ViewModel.CopyPathLocation, Mode=TwoWay}"
|
||||
Keys="Win, Ctrl, Alt, Shift"
|
||||
IsEnabled="False"
|
||||
/>
|
||||
<Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenConsole"
|
||||
Width="320"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HotkeySettings="{Binding Path=ViewModel.OpenConsole, Mode=TwoWay}"
|
||||
Keys="Win, Ctrl, Alt, Shift"
|
||||
IsEnabled="False"
|
||||
/>-->
|
||||
|
||||
<!--<CheckBox x:Uid="PowerLauncher_OverrideWinRKey"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsChecked="False"
|
||||
IsEnabled="False"
|
||||
/>-->
|
||||
|
||||
<!--<CheckBox x:Uid="PowerLauncher_OverrideWinSKey"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsChecked="{Binding Mode=TwoWay, Path=ViewModel.OverrideWinSKey}"
|
||||
IsEnabled="False"
|
||||
/>-->
|
||||
|
||||
<CheckBox x:Uid="PowerLauncher_IgnoreHotkeysInFullScreen"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.IgnoreHotkeysInFullScreen}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
/>
|
||||
|
||||
<TextBlock x:Uid="PowerLauncher_SearchResults"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<!--<ComboBox x:Uid="PowerLauncher_SearchResultPreference"
|
||||
MinWidth="320"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
ItemsSource="{Binding searchResultPreferencesOptions}"
|
||||
SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchResultPreference}"
|
||||
SelectedValuePath="Item2"
|
||||
DisplayMemberPath="Item1"
|
||||
IsEnabled="False"
|
||||
/>
|
||||
|
||||
<ComboBox x:Uid="PowerLauncher_SearchTypePreference"
|
||||
MinWidth="320"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
ItemsSource="{Binding searchTypePreferencesOptions}"
|
||||
SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchTypePreference}"
|
||||
SelectedValuePath="Item2"
|
||||
DisplayMemberPath="Item1"
|
||||
IsEnabled="False"
|
||||
/>-->
|
||||
|
||||
<TextBlock x:Uid="PowerLauncher_MaximumNumberOfResults"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<muxc:NumberBox Value="{Binding Mode=TwoWay, Path=MaximumNumberOfResults}"
|
||||
Width="240"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
HorizontalAlignment="Left"
|
||||
Minimum="1"
|
||||
Margin="{StaticResource HeaderTextTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"/>
|
||||
|
||||
<CheckBox x:Uid="PowerLauncher_ClearInputOnLaunch"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.ClearInputOnLaunch}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
/>
|
||||
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Orientation="Vertical" x:Name="LauncherView">
|
||||
<ToggleSwitch x:Uid="PowerLauncher_EnablePowerLauncher"
|
||||
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.EnablePowerLauncher}"/>
|
||||
|
||||
<TextBlock x:Uid="PowerLauncher_Shortcuts"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<CustomControls:HotkeySettingsControl x:Uid="PowerLauncher_OpenPowerLauncher"
|
||||
Width="240"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HotkeySettings="{x:Bind Path=ViewModel.OpenPowerLauncher, Mode=TwoWay}"
|
||||
Keys="Win, Ctrl, Alt, Shift"
|
||||
Enabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"/>
|
||||
<!--<Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenFileLocation"
|
||||
Width="320"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HotkeySettings="{Binding Path=ViewModel.OpenFileLocation, Mode=TwoWay}"
|
||||
IsEnabled="False"
|
||||
/>
|
||||
<Custom:HotkeySettingsControl x:Uid="PowerLauncher_CopyPathLocation"
|
||||
Width="320"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HotkeySettings="{Binding Path=ViewModel.CopyPathLocation, Mode=TwoWay}"
|
||||
Keys="Win, Ctrl, Alt, Shift"
|
||||
IsEnabled="False"
|
||||
/>
|
||||
<Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenConsole"
|
||||
Width="320"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HotkeySettings="{Binding Path=ViewModel.OpenConsole, Mode=TwoWay}"
|
||||
Keys="Win, Ctrl, Alt, Shift"
|
||||
IsEnabled="False"
|
||||
/>-->
|
||||
|
||||
<!--<CheckBox x:Uid="PowerLauncher_OverrideWinRKey"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsChecked="False"
|
||||
IsEnabled="False"
|
||||
/>-->
|
||||
|
||||
<!--<CheckBox x:Uid="PowerLauncher_OverrideWinSKey"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsChecked="{Binding Mode=TwoWay, Path=ViewModel.OverrideWinSKey}"
|
||||
IsEnabled="False"
|
||||
/>-->
|
||||
|
||||
<CheckBox x:Uid="PowerLauncher_IgnoreHotkeysInFullScreen"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.IgnoreHotkeysInFullScreen}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
/>
|
||||
|
||||
<TextBlock x:Uid="PowerLauncher_SearchResults"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<!--<ComboBox x:Uid="PowerLauncher_SearchResultPreference"
|
||||
MinWidth="320"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
ItemsSource="{Binding searchResultPreferencesOptions}"
|
||||
SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchResultPreference}"
|
||||
SelectedValuePath="Item2"
|
||||
DisplayMemberPath="Item1"
|
||||
IsEnabled="False"
|
||||
/>
|
||||
|
||||
<ComboBox x:Uid="PowerLauncher_SearchTypePreference"
|
||||
MinWidth="320"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
ItemsSource="{Binding searchTypePreferencesOptions}"
|
||||
SelectedItem="{Binding Mode=TwoWay, Path=SelectedSearchTypePreference}"
|
||||
SelectedValuePath="Item2"
|
||||
DisplayMemberPath="Item1"
|
||||
IsEnabled="False"
|
||||
/>-->
|
||||
|
||||
<TextBlock x:Uid="PowerLauncher_MaximumNumberOfResults"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<muxc:NumberBox Value="{Binding Mode=TwoWay, Path=MaximumNumberOfResults}"
|
||||
Width="240"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
HorizontalAlignment="Left"
|
||||
Minimum="1"
|
||||
Margin="{StaticResource HeaderTextTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"/>
|
||||
|
||||
<CheckBox x:Uid="PowerLauncher_ClearInputOnLaunch"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.ClearInputOnLaunch}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
/>
|
||||
|
||||
<CheckBox x:Uid="PowerLauncher_DisableDriveDetectionWarning"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.DisableDriveDetectionWarning}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<RelativePanel x:Name="SidePanel"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
<StackPanel x:Name="DescriptionPanel">
|
||||
<TextBlock x:Uid="About_PowerLauncher" x:Name="AboutTitle" Grid.ColumnSpan="2"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
<TextBlock x:Uid="PowerLauncher_Description"
|
||||
TextWrapping="Wrap"
|
||||
Grid.Row="1" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<RelativePanel x:Name="SidePanel"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
<StackPanel x:Name="DescriptionPanel">
|
||||
<TextBlock x:Uid="About_PowerLauncher" x:Name="AboutTitle" Grid.ColumnSpan="2"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
<TextBlock x:Uid="PowerLauncher_Description"
|
||||
TextWrapping="Wrap"
|
||||
Grid.Row="1" />
|
||||
</StackPanel>
|
||||
|
||||
<Border x:Name="AboutImage"
|
||||
CornerRadius="4"
|
||||
Grid.Row="2"
|
||||
@@ -173,32 +173,32 @@
|
||||
Margin="{StaticResource SmallTopBottomMargin}"
|
||||
RelativePanel.Below="DescriptionPanel">
|
||||
<Image Source="ms-appx:///Assets/Modules/PowerLauncher.png" />
|
||||
</Border>
|
||||
|
||||
<StackPanel x:Name="LinksPanel"
|
||||
Margin="0,1,0,0"
|
||||
RelativePanel.Below="AboutImage"
|
||||
Orientation="Vertical" >
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_PowerToysRun">
|
||||
<TextBlock x:Uid="Module_overview" />
|
||||
</HyperlinkButton>
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/powerToysGiveFeedback">
|
||||
<TextBlock x:Uid="Give_Feedback" />
|
||||
</HyperlinkButton>
|
||||
|
||||
<TextBlock x:Uid="AttributionTitle"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{ Binding Mode=TwoWay, Path=TextColor}"/>
|
||||
|
||||
<HyperlinkButton Margin="0,-3,0,0" NavigateUri="https://github.com/Wox-launcher/Wox/">
|
||||
<TextBlock Text="Wox"/>
|
||||
</HyperlinkButton>
|
||||
|
||||
<HyperlinkButton NavigateUri="https://github.com/betsegaw/windowwalker/">
|
||||
<TextBlock Text="Beta Tadele's Window Walker" />
|
||||
</HyperlinkButton>
|
||||
|
||||
</StackPanel>
|
||||
</RelativePanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<StackPanel x:Name="LinksPanel"
|
||||
Margin="0,1,0,0"
|
||||
RelativePanel.Below="AboutImage"
|
||||
Orientation="Vertical" >
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_PowerToysRun">
|
||||
<TextBlock x:Uid="Module_overview" />
|
||||
</HyperlinkButton>
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/powerToysGiveFeedback">
|
||||
<TextBlock x:Uid="Give_Feedback" />
|
||||
</HyperlinkButton>
|
||||
|
||||
<TextBlock x:Uid="AttributionTitle"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{ Binding Mode=TwoWay, Path=TextColor}"/>
|
||||
|
||||
<HyperlinkButton Margin="0,-3,0,0" NavigateUri="https://github.com/Wox-launcher/Wox/">
|
||||
<TextBlock Text="Wox"/>
|
||||
</HyperlinkButton>
|
||||
|
||||
<HyperlinkButton NavigateUri="https://github.com/betsegaw/windowwalker/">
|
||||
<TextBlock Text="Beta Tadele's Window Walker" />
|
||||
</HyperlinkButton>
|
||||
|
||||
</StackPanel>
|
||||
</RelativePanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib.ViewModels;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
@@ -18,7 +19,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
public PowerLauncherPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
ViewModel = new PowerLauncherViewModel();
|
||||
ViewModel = new PowerLauncherViewModel(ShellPage.SendDefaultIPCMessage, (int)Windows.System.VirtualKey.Space);
|
||||
DataContext = ViewModel;
|
||||
|
||||
var loader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();
|
||||
|
||||
Reference in New Issue
Block a user