common: refactor common library pt2 (#8588)
- remove common lib - split settings, remove common-md - move ipc interop/kb_layout to interop - rename core -> settings, settings -> old_settings - os-detect header-only; interop -> PowerToysInterop - split notifications, move single-use headers where they're used - winstore lib - rename com utils - rename Updating and Telemetry projects - rename core -> settings-ui and remove examples folder - rename settings-ui folder + consisent common/version include
@@ -0,0 +1,44 @@
|
||||
// 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.Diagnostics.CodeAnalysis;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Activation
|
||||
{
|
||||
// For more information on understanding and extending activation flow see
|
||||
// https://github.com/Microsoft/WindowsTemplateStudio/blob/master/docs/activation.md
|
||||
internal abstract class ActivationHandler
|
||||
{
|
||||
public abstract bool CanHandle(object args);
|
||||
|
||||
public abstract Task HandleAsync(object args);
|
||||
}
|
||||
|
||||
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "abstract T and abstract")]
|
||||
internal abstract class ActivationHandler<T> : ActivationHandler
|
||||
where T : class
|
||||
{
|
||||
public override async Task HandleAsync(object args)
|
||||
{
|
||||
await HandleInternalAsync(args as T).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public override bool CanHandle(object args)
|
||||
{
|
||||
// CanHandle checks the args is of type you have configured
|
||||
return args is T && CanHandleInternal(args as T);
|
||||
}
|
||||
|
||||
// Override this method to add the activation logic in your activation handler
|
||||
protected abstract Task HandleInternalAsync(T args);
|
||||
|
||||
// You can override this method to add extra validation on activation args
|
||||
// to determine if your ActivationHandler should handle this activation args
|
||||
protected virtual bool CanHandleInternal(T args)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// 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.Threading.Tasks;
|
||||
using Microsoft.PowerToys.Settings.UI.Services;
|
||||
using Windows.ApplicationModel.Activation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Activation
|
||||
{
|
||||
internal class DefaultActivationHandler : ActivationHandler<IActivatedEventArgs>
|
||||
{
|
||||
private readonly Type navElement;
|
||||
|
||||
public DefaultActivationHandler(Type navElement)
|
||||
{
|
||||
this.navElement = navElement;
|
||||
}
|
||||
|
||||
protected override async Task HandleInternalAsync(IActivatedEventArgs args)
|
||||
{
|
||||
// When the navigation stack isn't restored, navigate to the first page and configure
|
||||
// the new page by passing required information in the navigation parameter
|
||||
object arguments = null;
|
||||
if (args is LaunchActivatedEventArgs launchArgs)
|
||||
{
|
||||
arguments = launchArgs.Arguments;
|
||||
}
|
||||
|
||||
NavigationService.Navigate(navElement, arguments);
|
||||
await Task.CompletedTask.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
protected override bool CanHandleInternal(IActivatedEventArgs args)
|
||||
{
|
||||
// None of the ActivationHandlers has handled the app activation
|
||||
return NavigationService.Frame.Content == null && navElement != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
29
src/settings-ui/Microsoft.PowerToys.Settings.UI/App.xaml
Normal file
@@ -0,0 +1,29 @@
|
||||
<xaml:XamlApplication
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:xaml="using:Microsoft.Toolkit.Win32.UI.XamlHost"
|
||||
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
|
||||
<ResourceDictionary Source="/Styles/_Colors.xaml" />
|
||||
<ResourceDictionary Source="/Styles/_FontSizes.xaml" />
|
||||
<ResourceDictionary Source="/Styles/_Thickness.xaml" />
|
||||
<ResourceDictionary Source="/Styles/_Sizes.xaml" />
|
||||
<ResourceDictionary Source="/Styles/TextBlock.xaml" />
|
||||
<ResourceDictionary Source="/Styles/Page.xaml"/>
|
||||
<ResourceDictionary Source="/Styles/Button.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<converters:ModuleEnabledToForegroundConverter x:Key="ModuleEnabledToForegroundConverter"/>
|
||||
|
||||
|
||||
<SolidColorBrush x:Key="DarkForegroundDisabledBrush">#66FFFFFF</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="DarkForegroundBrush">#FFFFFFFF</SolidColorBrush>
|
||||
|
||||
<SolidColorBrush x:Key="LightForegroundDisabledBrush">#66000000</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="LightForegroundBrush">#FF000000</SolidColorBrush>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</xaml:XamlApplication>
|
||||
22
src/settings-ui/Microsoft.PowerToys.Settings.UI/App.xaml.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
// 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.Helpers;
|
||||
using Microsoft.Toolkit.Win32.UI.XamlHost;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI
|
||||
{
|
||||
public sealed partial class App : XamlApplication
|
||||
{
|
||||
public App()
|
||||
{
|
||||
Initialize();
|
||||
|
||||
// Hide the Xaml Island window
|
||||
var coreWindow = Windows.UI.Core.CoreWindow.GetForCurrentThread();
|
||||
var coreWindowInterop = Interop.GetInterop(coreWindow);
|
||||
NativeMethods.ShowWindow(coreWindowInterop.WindowHandle, Interop.SW_HIDE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 111 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
BIN
src/settings-ui/Microsoft.PowerToys.Settings.UI/Assets/logo.png
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
@@ -0,0 +1,138 @@
|
||||
// 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.Services;
|
||||
using Microsoft.Xaml.Interactivity;
|
||||
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
using WinUI = Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Behaviors
|
||||
{
|
||||
public class NavigationViewHeaderBehavior : Behavior<WinUI.NavigationView>
|
||||
{
|
||||
private static NavigationViewHeaderBehavior current;
|
||||
private Page currentPage;
|
||||
|
||||
public DataTemplate DefaultHeaderTemplate { get; set; }
|
||||
|
||||
public object DefaultHeader
|
||||
{
|
||||
get { return GetValue(DefaultHeaderProperty); }
|
||||
set { SetValue(DefaultHeaderProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty DefaultHeaderProperty = DependencyProperty.Register("DefaultHeader", typeof(object), typeof(NavigationViewHeaderBehavior), new PropertyMetadata(null, (d, e) => current.UpdateHeader()));
|
||||
|
||||
public static NavigationViewHeaderMode GetHeaderMode(Page item)
|
||||
{
|
||||
return (NavigationViewHeaderMode)item?.GetValue(HeaderModeProperty);
|
||||
}
|
||||
|
||||
public static void SetHeaderMode(Page item, NavigationViewHeaderMode value)
|
||||
{
|
||||
item?.SetValue(HeaderModeProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty HeaderModeProperty =
|
||||
DependencyProperty.RegisterAttached("HeaderMode", typeof(bool), typeof(NavigationViewHeaderBehavior), new PropertyMetadata(NavigationViewHeaderMode.Always, (d, e) => current.UpdateHeader()));
|
||||
|
||||
public static object GetHeaderContext(Page item)
|
||||
{
|
||||
return item?.GetValue(HeaderContextProperty);
|
||||
}
|
||||
|
||||
public static void SetHeaderContext(Page item, object value)
|
||||
{
|
||||
item?.SetValue(HeaderContextProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty HeaderContextProperty =
|
||||
DependencyProperty.RegisterAttached("HeaderContext", typeof(object), typeof(NavigationViewHeaderBehavior), new PropertyMetadata(null, (d, e) => current.UpdateHeader()));
|
||||
|
||||
public static DataTemplate GetHeaderTemplate(Page item)
|
||||
{
|
||||
return (DataTemplate)item?.GetValue(HeaderTemplateProperty);
|
||||
}
|
||||
|
||||
public static void SetHeaderTemplate(Page item, DataTemplate value)
|
||||
{
|
||||
item?.SetValue(HeaderTemplateProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty HeaderTemplateProperty =
|
||||
DependencyProperty.RegisterAttached("HeaderTemplate", typeof(DataTemplate), typeof(NavigationViewHeaderBehavior), new PropertyMetadata(null, (d, e) => current.UpdateHeaderTemplate()));
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
current = this;
|
||||
NavigationService.Navigated += OnNavigated;
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
NavigationService.Navigated -= OnNavigated;
|
||||
}
|
||||
|
||||
private void OnNavigated(object sender, NavigationEventArgs e)
|
||||
{
|
||||
var frame = sender as Frame;
|
||||
if (frame.Content is Page page)
|
||||
{
|
||||
currentPage = page;
|
||||
|
||||
UpdateHeader();
|
||||
UpdateHeaderTemplate();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateHeader()
|
||||
{
|
||||
if (currentPage != null)
|
||||
{
|
||||
var headerMode = GetHeaderMode(currentPage);
|
||||
if (headerMode == NavigationViewHeaderMode.Never)
|
||||
{
|
||||
AssociatedObject.Header = null;
|
||||
AssociatedObject.AlwaysShowHeader = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var headerFromPage = GetHeaderContext(currentPage);
|
||||
if (headerFromPage != null)
|
||||
{
|
||||
AssociatedObject.Header = headerFromPage;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssociatedObject.Header = DefaultHeader;
|
||||
}
|
||||
|
||||
if (headerMode == NavigationViewHeaderMode.Always)
|
||||
{
|
||||
AssociatedObject.AlwaysShowHeader = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssociatedObject.AlwaysShowHeader = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateHeaderTemplate()
|
||||
{
|
||||
if (currentPage != null)
|
||||
{
|
||||
var headerTemplate = GetHeaderTemplate(currentPage);
|
||||
AssociatedObject.HeaderTemplate = headerTemplate ?? DefaultHeaderTemplate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +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.
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Behaviors
|
||||
{
|
||||
public enum NavigationViewHeaderMode
|
||||
{
|
||||
Always,
|
||||
Never,
|
||||
Minimal,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<UserControl
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Controls.HotkeySettingsControl"
|
||||
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.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
AutomationProperties.Name="{x:Bind Header, Mode=OneTime}"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="400">
|
||||
<TextBox x:Name="HotkeyTextBox"
|
||||
x:Uid="SettingsPage_SetShortcut"
|
||||
AutomationProperties.HelpText="{Binding ElementName=ShortcutWarningLabelText, Path=Text}"
|
||||
IsReadOnly="True">
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Name="ShortcutWarningLabelText">
|
||||
<Run x:Uid="ShortcutWarningLabel"/>
|
||||
<LineBreak/>
|
||||
<Run Text="{x:Bind Keys, Mode=OneTime}" FontWeight="SemiBold"/>
|
||||
</TextBlock>
|
||||
</ToolTipService.ToolTip>
|
||||
<TextBox.Header>
|
||||
<TextBlock>
|
||||
<Run Text="{x:Bind Header, Mode=OneTime}"/>
|
||||
<Run Text="" FontFamily="Segoe MDL2 Assets"/>
|
||||
</TextBlock>
|
||||
</TextBox.Header>
|
||||
</TextBox>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,306 @@
|
||||
// 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 Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Windows.UI.Core;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
{
|
||||
public sealed partial class HotkeySettingsControl : UserControl, IDisposable
|
||||
{
|
||||
private readonly UIntPtr ignoreKeyEventFlag = (UIntPtr)0x5555;
|
||||
|
||||
private bool _shiftKeyDownOnEntering;
|
||||
|
||||
private bool _shiftToggled;
|
||||
|
||||
public string Header { get; set; }
|
||||
|
||||
public string Keys { get; set; }
|
||||
|
||||
public static readonly DependencyProperty IsActiveProperty =
|
||||
DependencyProperty.Register(
|
||||
"Enabled",
|
||||
typeof(bool),
|
||||
typeof(HotkeySettingsControl),
|
||||
null);
|
||||
|
||||
private bool _enabled;
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetValue(IsActiveProperty, value);
|
||||
_enabled = value;
|
||||
|
||||
if (value)
|
||||
{
|
||||
HotkeyTextBox.IsEnabled = true;
|
||||
|
||||
// TitleText.IsActive = "True";
|
||||
// TitleGlyph.IsActive = "True";
|
||||
}
|
||||
else
|
||||
{
|
||||
HotkeyTextBox.IsEnabled = false;
|
||||
|
||||
// TitleText.IsActive = "False";
|
||||
// TitleGlyph.IsActive = "False";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty HotkeySettingsProperty =
|
||||
DependencyProperty.Register(
|
||||
"HotkeySettings",
|
||||
typeof(HotkeySettings),
|
||||
typeof(HotkeySettingsControl),
|
||||
null);
|
||||
|
||||
private HotkeySettings hotkeySettings;
|
||||
private HotkeySettings internalSettings;
|
||||
private HotkeySettings lastValidSettings;
|
||||
private HotkeySettingsControlHook hook;
|
||||
private bool _isActive;
|
||||
private bool disposedValue;
|
||||
|
||||
public HotkeySettings HotkeySettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return hotkeySettings;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (hotkeySettings != value)
|
||||
{
|
||||
hotkeySettings = value;
|
||||
SetValue(HotkeySettingsProperty, value);
|
||||
HotkeyTextBox.Text = HotkeySettings.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettingsControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
internalSettings = new HotkeySettings();
|
||||
|
||||
HotkeyTextBox.GettingFocus += HotkeyTextBox_GettingFocus;
|
||||
HotkeyTextBox.LosingFocus += HotkeyTextBox_LosingFocus;
|
||||
HotkeyTextBox.Unloaded += HotkeyTextBox_Unloaded;
|
||||
hook = new HotkeySettingsControlHook(Hotkey_KeyDown, Hotkey_KeyUp, Hotkey_IsActive, FilterAccessibleKeyboardEvents);
|
||||
}
|
||||
|
||||
private void HotkeyTextBox_Unloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Dispose the HotkeySettingsControlHook object to terminate the hook threads when the textbox is unloaded
|
||||
hook.Dispose();
|
||||
}
|
||||
|
||||
private void KeyEventHandler(int key, bool matchValue, int matchValueCode)
|
||||
{
|
||||
switch ((Windows.System.VirtualKey)key)
|
||||
{
|
||||
case Windows.System.VirtualKey.LeftWindows:
|
||||
case Windows.System.VirtualKey.RightWindows:
|
||||
internalSettings.Win = matchValue;
|
||||
break;
|
||||
case Windows.System.VirtualKey.Control:
|
||||
case Windows.System.VirtualKey.LeftControl:
|
||||
case Windows.System.VirtualKey.RightControl:
|
||||
internalSettings.Ctrl = matchValue;
|
||||
break;
|
||||
case Windows.System.VirtualKey.Menu:
|
||||
case Windows.System.VirtualKey.LeftMenu:
|
||||
case Windows.System.VirtualKey.RightMenu:
|
||||
internalSettings.Alt = matchValue;
|
||||
break;
|
||||
case Windows.System.VirtualKey.Shift:
|
||||
case Windows.System.VirtualKey.LeftShift:
|
||||
case Windows.System.VirtualKey.RightShift:
|
||||
_shiftToggled = true;
|
||||
internalSettings.Shift = matchValue;
|
||||
break;
|
||||
case Windows.System.VirtualKey.Escape:
|
||||
internalSettings = new HotkeySettings();
|
||||
HotkeySettings = new HotkeySettings();
|
||||
return;
|
||||
default:
|
||||
internalSettings.Code = matchValueCode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Function to send a single key event to the system which would be ignored by the hotkey control.
|
||||
private void SendSingleKeyboardInput(short keyCode, uint keyStatus)
|
||||
{
|
||||
NativeKeyboardHelper.INPUT inputShift = new NativeKeyboardHelper.INPUT
|
||||
{
|
||||
type = NativeKeyboardHelper.INPUTTYPE.INPUT_KEYBOARD,
|
||||
data = new NativeKeyboardHelper.InputUnion
|
||||
{
|
||||
ki = new NativeKeyboardHelper.KEYBDINPUT
|
||||
{
|
||||
wVk = keyCode,
|
||||
dwFlags = keyStatus,
|
||||
|
||||
// Any keyevent with the extraInfo set to this value will be ignored by the keyboard hook and sent to the system instead.
|
||||
dwExtraInfo = ignoreKeyEventFlag,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
NativeKeyboardHelper.INPUT[] inputs = new NativeKeyboardHelper.INPUT[] { inputShift };
|
||||
|
||||
_ = NativeMethods.SendInput(1, inputs, NativeKeyboardHelper.INPUT.Size);
|
||||
}
|
||||
|
||||
private bool FilterAccessibleKeyboardEvents(int key, UIntPtr extraInfo)
|
||||
{
|
||||
// A keyboard event sent with this value in the extra Information field should be ignored by the hook so that it can be captured by the system instead.
|
||||
if (extraInfo == ignoreKeyEventFlag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the current key press is tab, based on the other keys ignore the key press so as to shift focus out of the hotkey control.
|
||||
if ((Windows.System.VirtualKey)key == Windows.System.VirtualKey.Tab)
|
||||
{
|
||||
// Shift was not pressed while entering and Shift is not pressed while leaving the hotkey control, treat it as a normal tab key press.
|
||||
if (!internalSettings.Shift && !_shiftKeyDownOnEntering && !internalSettings.Win && !internalSettings.Alt && !internalSettings.Ctrl)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Shift was not pressed while entering but it was pressed while leaving the hotkey, therefore simulate a shift key press as the system does not know about shift being pressed in the hotkey.
|
||||
else if (internalSettings.Shift && !_shiftKeyDownOnEntering && !internalSettings.Win && !internalSettings.Alt && !internalSettings.Ctrl)
|
||||
{
|
||||
// This is to reset the shift key press within the control as it was not used within the control but rather was used to leave the hotkey.
|
||||
internalSettings.Shift = false;
|
||||
|
||||
SendSingleKeyboardInput((short)Windows.System.VirtualKey.Shift, (uint)NativeKeyboardHelper.KeyEventF.KeyDown);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Shift was pressed on entering and remained pressed, therefore only ignore the tab key so that it can be passed to the system.
|
||||
// As the shift key is already assumed to be pressed by the system while it entered the hotkey control, shift would still remain pressed, hence ignoring the tab input would simulate a Shift+Tab key press.
|
||||
else if (!internalSettings.Shift && _shiftKeyDownOnEntering && !_shiftToggled && !internalSettings.Win && !internalSettings.Alt && !internalSettings.Ctrl)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Shift was pressed on entering but it was released and later pressed again.
|
||||
// Ignore the tab key and the system already has the shift key pressed, therefore this would simulate Shift+Tab.
|
||||
// However, since the last shift key was only used to move out of the control, reset the status of shift within the control.
|
||||
else if (internalSettings.Shift && _shiftKeyDownOnEntering && _shiftToggled && !internalSettings.Win && !internalSettings.Alt && !internalSettings.Ctrl)
|
||||
{
|
||||
internalSettings.Shift = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Shift was pressed on entering and was later released.
|
||||
// The system still has shift in the key pressed status, therefore pass a Shift KeyUp message to the system, to release the shift key, therefore simulating only the Tab key press.
|
||||
else if (!internalSettings.Shift && _shiftKeyDownOnEntering && _shiftToggled && !internalSettings.Win && !internalSettings.Alt && !internalSettings.Ctrl)
|
||||
{
|
||||
SendSingleKeyboardInput((short)Windows.System.VirtualKey.Shift, (uint)NativeKeyboardHelper.KeyEventF.KeyUp);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private async void Hotkey_KeyDown(int key)
|
||||
{
|
||||
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
|
||||
{
|
||||
KeyEventHandler(key, true, key);
|
||||
|
||||
// Tab and Shift+Tab are accessible keys and should not be displayed in the hotkey control.
|
||||
if (internalSettings.Code > 0 && !internalSettings.IsAccessibleShortcut())
|
||||
{
|
||||
HotkeyTextBox.Text = internalSettings.ToString();
|
||||
lastValidSettings = internalSettings.Clone();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private async void Hotkey_KeyUp(int key)
|
||||
{
|
||||
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
|
||||
{
|
||||
KeyEventHandler(key, false, 0);
|
||||
});
|
||||
}
|
||||
|
||||
private bool Hotkey_IsActive()
|
||||
{
|
||||
return _isActive;
|
||||
}
|
||||
|
||||
private void HotkeyTextBox_GettingFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Reset the status on entering the hotkey each time.
|
||||
_shiftKeyDownOnEntering = false;
|
||||
_shiftToggled = false;
|
||||
|
||||
// To keep track of the shift key, whether it was pressed on entering.
|
||||
if ((NativeMethods.GetAsyncKeyState((int)Windows.System.VirtualKey.Shift) & 0x8000) != 0)
|
||||
{
|
||||
_shiftKeyDownOnEntering = true;
|
||||
}
|
||||
|
||||
_isActive = true;
|
||||
}
|
||||
|
||||
private void HotkeyTextBox_LosingFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (lastValidSettings != null && (lastValidSettings.IsValid() || lastValidSettings.IsEmpty()))
|
||||
{
|
||||
HotkeySettings = lastValidSettings.Clone();
|
||||
}
|
||||
|
||||
HotkeyTextBox.Text = hotkeySettings.ToString();
|
||||
_isActive = false;
|
||||
}
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (!disposedValue)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
// TODO: dispose managed state (managed objects)
|
||||
hook.Dispose();
|
||||
}
|
||||
|
||||
// TODO: free unmanaged resources (unmanaged objects) and override finalizer
|
||||
// TODO: set large fields to null
|
||||
disposedValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// 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.Globalization;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Converters
|
||||
{
|
||||
public sealed class ModuleEnabledToForegroundConverter : IValueConverter
|
||||
{
|
||||
private readonly ISettingsUtils settingsUtils = new SettingsUtils();
|
||||
|
||||
private string selectedTheme = string.Empty;
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
bool isEnabled = (bool)value;
|
||||
|
||||
var defaultTheme = new Windows.UI.ViewManagement.UISettings();
|
||||
|
||||
// Using InvariantCulture as this is an internal string and expected to be in hexadecimal
|
||||
var uiTheme = defaultTheme.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background).ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
// Normalize strings to uppercase according to Fxcop
|
||||
selectedTheme = SettingsRepository<GeneralSettings>.GetInstance(settingsUtils).SettingsConfig.Theme.ToUpperInvariant();
|
||||
|
||||
if (selectedTheme == "DARK" || (selectedTheme == "SYSTEM" && uiTheme == "#FF000000"))
|
||||
{
|
||||
// DARK
|
||||
if (isEnabled)
|
||||
{
|
||||
return (SolidColorBrush)Application.Current.Resources["DarkForegroundBrush"];
|
||||
}
|
||||
else
|
||||
{
|
||||
return (SolidColorBrush)Application.Current.Resources["DarkForegroundDisabledBrush"];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// LIGHT
|
||||
if (isEnabled)
|
||||
{
|
||||
return (SolidColorBrush)Application.Current.Resources["LightForegroundBrush"];
|
||||
}
|
||||
else
|
||||
{
|
||||
return (SolidColorBrush)Application.Current.Resources["LightForegroundDisabledBrush"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
// 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.InteropServices;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
{
|
||||
internal static class NativeKeyboardHelper
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields should begin with upper-case letter", Justification = "Matching Native Structure")]
|
||||
internal struct INPUT
|
||||
{
|
||||
internal INPUTTYPE type;
|
||||
internal InputUnion data;
|
||||
|
||||
internal static int Size
|
||||
{
|
||||
get { return Marshal.SizeOf(typeof(INPUT)); }
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields should begin with upper-case letter", Justification = "Matching Native Structure")]
|
||||
internal struct InputUnion
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
internal MOUSEINPUT mi;
|
||||
[FieldOffset(0)]
|
||||
internal KEYBDINPUT ki;
|
||||
[FieldOffset(0)]
|
||||
internal HARDWAREINPUT hi;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields should begin with upper-case letter", Justification = "Matching Native Structure")]
|
||||
internal struct MOUSEINPUT
|
||||
{
|
||||
internal int dx;
|
||||
internal int dy;
|
||||
internal int mouseData;
|
||||
internal uint dwFlags;
|
||||
internal uint time;
|
||||
internal UIntPtr dwExtraInfo;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields should begin with upper-case letter", Justification = "Matching Native Structure")]
|
||||
internal struct KEYBDINPUT
|
||||
{
|
||||
internal short wVk;
|
||||
internal short wScan;
|
||||
internal uint dwFlags;
|
||||
internal int time;
|
||||
internal UIntPtr dwExtraInfo;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields should begin with upper-case letter", Justification = "Matching Native Structure")]
|
||||
internal struct HARDWAREINPUT
|
||||
{
|
||||
internal int uMsg;
|
||||
internal short wParamL;
|
||||
internal short wParamH;
|
||||
}
|
||||
|
||||
internal enum INPUTTYPE : uint
|
||||
{
|
||||
INPUT_MOUSE = 0,
|
||||
INPUT_KEYBOARD = 1,
|
||||
INPUT_HARDWARE = 2,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
internal enum KeyEventF
|
||||
{
|
||||
KeyDown = 0x0000,
|
||||
ExtendedKey = 0x0001,
|
||||
KeyUp = 0x0002,
|
||||
Unicode = 0x0004,
|
||||
Scancode = 0x0008,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// 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.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
{
|
||||
internal static class NativeMethods
|
||||
{
|
||||
[DllImport("user32.dll")]
|
||||
internal static extern uint SendInput(uint nInputs, NativeKeyboardHelper.INPUT[] pInputs, int cbSize);
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
|
||||
internal static extern short GetAsyncKeyState(int vKey);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool ShowWindow(System.IntPtr hWnd, int nCmdShow);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// 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 Microsoft.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
{
|
||||
public static class NavHelper
|
||||
{
|
||||
// This helper class allows to specify the page that will be shown when you click on a NavigationViewItem
|
||||
//
|
||||
// Usage in xaml:
|
||||
// <winui:NavigationViewItem x:Uid="Shell_Main" Icon="Document" helpers:NavHelper.NavigateTo="views:MainPage" />
|
||||
//
|
||||
// Usage in code:
|
||||
// NavHelper.SetNavigateTo(navigationViewItem, typeof(MainPage));
|
||||
public static Type GetNavigateTo(NavigationViewItem item)
|
||||
{
|
||||
return (Type)item?.GetValue(NavigateToProperty);
|
||||
}
|
||||
|
||||
public static void SetNavigateTo(NavigationViewItem item, Type value)
|
||||
{
|
||||
item?.SetValue(NavigateToProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty NavigateToProperty =
|
||||
DependencyProperty.RegisterAttached("NavigateTo", typeof(Type), typeof(NavHelper), new PropertyMetadata(null));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// 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.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
{
|
||||
public class Observable : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected void Set<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
|
||||
{
|
||||
if (Equals(storage, value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
storage = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
}
|
||||
|
||||
protected void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// 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.Windows.Input;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
{
|
||||
public class RelayCommand : ICommand
|
||||
{
|
||||
private readonly Action _execute;
|
||||
private readonly Func<bool> _canExecute;
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public RelayCommand(Action execute)
|
||||
: this(execute, null)
|
||||
{
|
||||
}
|
||||
|
||||
public RelayCommand(Action execute, Func<bool> canExecute)
|
||||
{
|
||||
_execute = execute ?? throw new ArgumentNullException(nameof(execute));
|
||||
_canExecute = canExecute;
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter) => _canExecute == null || _canExecute();
|
||||
|
||||
public void Execute(object parameter) => _execute();
|
||||
|
||||
public void OnCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "abstract T and abstract")]
|
||||
public class RelayCommand<T> : ICommand
|
||||
{
|
||||
private readonly Action<T> execute;
|
||||
|
||||
private readonly Func<T, bool> canExecute;
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public RelayCommand(Action<T> execute)
|
||||
: this(execute, null)
|
||||
{
|
||||
}
|
||||
|
||||
public RelayCommand(Action<T> execute, Func<T, bool> canExecute)
|
||||
{
|
||||
this.execute = execute ?? throw new ArgumentNullException(nameof(execute));
|
||||
this.canExecute = canExecute;
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter) => canExecute == null || canExecute((T)parameter);
|
||||
|
||||
public void Execute(object parameter) => execute((T)parameter);
|
||||
|
||||
public void OnCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// 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 Windows.ApplicationModel.Resources;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
{
|
||||
internal static class ResourceExtensions
|
||||
{
|
||||
private static readonly ResourceLoader ResLoader = new ResourceLoader();
|
||||
|
||||
public static string GetLocalized(this string resourceKey)
|
||||
{
|
||||
return ResLoader.GetString(resourceKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// 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.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI
|
||||
{
|
||||
[ComImport]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
[Guid("45D64A29-A63E-4CB6-B498-5781D298CB4F")]
|
||||
internal interface ICoreWindowInterop
|
||||
{
|
||||
System.IntPtr WindowHandle { get; }
|
||||
|
||||
void MessageHandled(bool value);
|
||||
}
|
||||
}
|
||||
29
src/settings-ui/Microsoft.PowerToys.Settings.UI/Interop.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
// 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.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI
|
||||
{
|
||||
internal static class Interop
|
||||
{
|
||||
public static ICoreWindowInterop GetInterop(this Windows.UI.Core.CoreWindow @this)
|
||||
{
|
||||
var unkIntPtr = Marshal.GetIUnknownForObject(@this);
|
||||
try
|
||||
{
|
||||
var interopObj = Marshal.GetTypedObjectForIUnknown(unkIntPtr, typeof(ICoreWindowInterop)) as ICoreWindowInterop;
|
||||
return interopObj;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.Release(unkIntPtr);
|
||||
unkIntPtr = System.IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop naming consistency")]
|
||||
public const int SW_HIDE = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"Projects": [
|
||||
{
|
||||
"LanguageSet": "Azure_Languages",
|
||||
"LocItems": [
|
||||
{
|
||||
"SourceFile": "src\\core\\Microsoft.PowerToys.Settings.UI\\Strings\\en-us\\Resources.resw",
|
||||
"CopyOption": "LangIDOnName",
|
||||
"OutputPath": "src\\core\\Microsoft.PowerToys.Settings.UI\\Strings"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<!-- We don't have GenerateAssemblyInfo task until we use .net core, so we generate it with WriteLinesToFile -->
|
||||
<PropertyGroup>
|
||||
<AssemblyTitle>Microsoft.PowerToys.Settings.UI</AssemblyTitle>
|
||||
<AssemblyDescription>PowerToys Settings UI</AssemblyDescription>
|
||||
<AssemblyCompany>Microsoft Corp.</AssemblyCompany>
|
||||
<AssemblyCopyright>Copyright (C) 2020 Microsoft Corp.</AssemblyCopyright>
|
||||
<AssemblyProduct>PowerToys</AssemblyProduct>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<AppxBundlePlatforms>x64</AppxBundlePlatforms>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<AssemblyVersionFiles Include="Generated Files\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Target Name="GenerateAssemblyInfo" BeforeTargets="PrepareForBuild">
|
||||
<ItemGroup>
|
||||
<HeaderLines Include="// Copyright (c) Microsoft Corporation" />
|
||||
<HeaderLines Include="// The Microsoft Corporation licenses this file to you under the MIT license." />
|
||||
<HeaderLines Include="// See the LICENSE file in the project root for more information." />
|
||||
<HeaderLines Include="#pragma warning disable SA1516" />
|
||||
<HeaderLines Include="using System.Reflection%3b" />
|
||||
<HeaderLines Include="using System.Resources%3b" />
|
||||
<HeaderLines Include="using System.Runtime.InteropServices%3b" />
|
||||
<HeaderLines Include="using System.Windows%3b" />
|
||||
<HeaderLines Include="[assembly: AssemblyTitle("$(AssemblyTitle)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyDescription("$(AssemblyDescription)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyConfiguration("")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyCompany("$(AssemblyCompany)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyCopyright("$(AssemblyCopyright)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyProduct("$(AssemblyProduct)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyTrademark("")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyCulture("")]" />
|
||||
<HeaderLines Include="[assembly: ComVisible(false)]" />
|
||||
<HeaderLines Include="[assembly: NeutralResourcesLanguage("en-US")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyVersion("$(Version).0")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyFileVersion("$(Version).0")]" />
|
||||
</ItemGroup>
|
||||
<WriteLinesToFile File="Generated Files\AssemblyInfo.cs" Lines="@(HeaderLines)" Overwrite="true" Encoding="Unicode" WriteOnlyWhenDifferent="true" />
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
|
||||
<ProjectGuid>{A7D5099E-F0FD-4BF3-8522-5A682759F915}</ProjectGuid>
|
||||
<OutputType>AppContainerExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Microsoft.PowerToys.Settings.UI</RootNamespace>
|
||||
<AssemblyName>Microsoft.PowerToys.Settings.UI</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.18362.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.18362.0</TargetPlatformMinVersion>
|
||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview>
|
||||
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\..\..\x64\Debug\SettingsUI\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>8305;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>..\..\..\x64\Release\SettingsUI\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>8305;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\codeAnalysis\GlobalSuppressions.cs">
|
||||
<Link>GlobalSuppressions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Activation\ActivationHandler.cs" />
|
||||
<Compile Include="Activation\DefaultActivationHandler.cs" />
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Behaviors\NavigationViewHeaderBehavior.cs" />
|
||||
<Compile Include="Behaviors\NavigationViewHeaderMode.cs" />
|
||||
<Compile Include="Controls\HotkeySettingsControl.xaml.cs">
|
||||
<DependentUpon>HotkeySettingsControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Converters\ModuleEnabledToForegroundConverter.cs" />
|
||||
<Compile Include="Generated Files\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Helpers\NativeKeyboardHelper.cs" />
|
||||
<Compile Include="Helpers\NativeMethods.cs" />
|
||||
<Compile Include="Helpers\NavHelper.cs" />
|
||||
<Compile Include="Helpers\Observable.cs" />
|
||||
<Compile Include="Helpers\RelayCommand.cs" />
|
||||
<Compile Include="Helpers\ResourceExtensions.cs" />
|
||||
<Compile Include="ICoreWindowInterop.cs" />
|
||||
<Compile Include="Interop.cs" />
|
||||
<Compile Include="Services\ActivationService.cs" />
|
||||
<Compile Include="Services\NavigationService.cs" />
|
||||
<Compile Include="ViewModels\Commands\ButtonClickCommand.cs" />
|
||||
<Compile Include="ViewModels\ShellViewModel.cs" />
|
||||
<Compile Include="Views\ColorPickerPage.xaml.cs">
|
||||
<DependentUpon>ColorPickerPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\GeneralPage.xaml.cs">
|
||||
<DependentUpon>GeneralPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ImageResizerPage.xaml.cs">
|
||||
<DependentUpon>ImageResizerPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\KeyboardManagerPage.xaml.cs">
|
||||
<DependentUpon>KeyboardManagerPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\PowerLauncherPage.xaml.cs">
|
||||
<DependentUpon>PowerLauncherPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\PowerPreviewPage.xaml.cs">
|
||||
<DependentUpon>PowerPreviewPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\FancyZonesPage.xaml.cs">
|
||||
<DependentUpon>FancyZonesPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\PowerRenamePage.xaml.cs">
|
||||
<DependentUpon>PowerRenamePage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ShellPage.xaml.cs">
|
||||
<DependentUpon>ShellPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ShortcutGuidePage.xaml.cs">
|
||||
<DependentUpon>ShortcutGuidePage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\VisibleIfNotEmpty.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\Logo.scale-200.png" />
|
||||
<Content Include="Assets\Modules\ColorPicker.png" />
|
||||
<Content Include="Assets\Modules\FancyZones.png" />
|
||||
<Content Include="Assets\Modules\ImageResizer.png" />
|
||||
<Content Include="Assets\Modules\KBM.png" />
|
||||
<Content Include="Assets\Modules\PowerLauncher.png" />
|
||||
<Content Include="Assets\Modules\PowerPreview.png" />
|
||||
<Content Include="Assets\Modules\PowerRename.png" />
|
||||
<Content Include="Assets\Modules\PT.png" />
|
||||
<Content Include="Assets\Modules\ShortcutGuide.png" />
|
||||
<Content Include="Assets\SplashScreen.png" />
|
||||
<Content Include="Assets\Square150x150Logo.scale-200.png" />
|
||||
<Content Include="Assets\Square44x44Logo.scale-200.png" />
|
||||
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
|
||||
<Content Include="Assets\StoreLogo.png" />
|
||||
<Content Include="Assets\StoreLogo.scale-100.png" />
|
||||
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
|
||||
<Content Include="Properties\Default.rd.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
||||
<Version>6.2.10</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Toolkit.Uwp.UI">
|
||||
<Version>6.1.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Toolkit.Win32.UI.XamlApplication">
|
||||
<Version>6.1.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.UI.Xaml">
|
||||
<Version>2.5.0-prerelease.200923002</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Uwp.Managed">
|
||||
<Version>2.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Newtonsoft.Json">
|
||||
<Version>12.0.3</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="StyleCop.Analyzers">
|
||||
<Version>1.1.118</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers">
|
||||
<Version>3.3.0</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PRIResource Include="Strings\*\Resources.resw" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="Controls\HotkeySettingsControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles\Button.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Styles\Page.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles\TextBlock.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles\_Colors.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles\_FontSizes.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles\_Sizes.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Styles\_Thickness.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\ColorPickerPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\GeneralPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ImageResizerPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\KeyboardManagerPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\PowerLauncherPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\FancyZonesPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\PowerPreviewPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\PowerRenamePage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ShellPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\ShortcutGuidePage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Include="..\..\codeAnalysis\StyleCop.json">
|
||||
<Link>StyleCop.json</Link>
|
||||
</AdditionalFiles>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\common\ManagedTelemetry\Telemetry\ManagedTelemetry.csproj">
|
||||
<Project>{5d00d290-4016-4cfe-9e41-1e7c724509ba}</Project>
|
||||
<Name>ManagedTelemetry</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Microsoft.PowerToys.Settings.UI.Library\Microsoft.PowerToys.Settings.UI.Library.csproj">
|
||||
<Project>{b1bcc8c6-46b5-4bfa-8f22-20f32d99ec6a}</Project>
|
||||
<Name>Microsoft.PowerToys.Settings.UI.Library</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<EnableTypeInfoReflection>false</EnableTypeInfoReflection>
|
||||
<EnableXBindDiagnostics>false</EnableXBindDiagnostics>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'">
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'">
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
IgnorableNamespaces="uap mp">
|
||||
|
||||
<Identity
|
||||
Name="f4f787a5-f0ae-47a9-be89-5408b1dd2b47"
|
||||
Publisher="CN=lamotile"
|
||||
Version="0.20.0.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="f4f787a5-f0ae-47a9-be89-5408b1dd2b47" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<DisplayName>PowerToys</DisplayName>
|
||||
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate"/>
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App"
|
||||
Executable="$targetnametoken$.exe"
|
||||
EntryPoint="Microsoft.PowerToys.Settings.UI.App">
|
||||
<uap:VisualElements
|
||||
DisplayName="PowerToys"
|
||||
Description="Windows system utilities to maximize productivity"
|
||||
BackgroundColor="transparent" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png">
|
||||
<uap:DefaultTile ShortName="PowerToys" Wide310x150Logo="Assets\Wide310x150Logo.png">
|
||||
<uap:ShowNameOnTiles>
|
||||
<uap:ShowOn Tile="square150x150Logo"/>
|
||||
<uap:ShowOn Tile="wide310x150Logo"/>
|
||||
</uap:ShowNameOnTiles>
|
||||
</uap:DefaultTile >
|
||||
<uap:SplashScreen BackgroundColor="#FFFFFF" Image="Assets\SplashScreen.png"/>
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
</Package>
|
||||
@@ -0,0 +1,31 @@
|
||||
<!--
|
||||
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
|
||||
developers. However, you can modify these parameters to modify the behavior of the .NET Native
|
||||
optimizer.
|
||||
|
||||
Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919
|
||||
|
||||
To fully enable reflection for App1.MyClass and all of its public/private members
|
||||
<Type Name="App1.MyClass" Dynamic="Required All"/>
|
||||
|
||||
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
|
||||
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
|
||||
|
||||
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
|
||||
<Namespace Name="DataClasses.ViewModels" Serialize="All" />
|
||||
-->
|
||||
|
||||
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
|
||||
<Application>
|
||||
<!--
|
||||
An Assembly element with Name="*Application*" applies to all assemblies in
|
||||
the application package. The asterisks are not wildcards.
|
||||
-->
|
||||
<Assembly Name="*Application*" Dynamic="Required All" />
|
||||
|
||||
|
||||
<!-- Add your application specific runtime directives here. -->
|
||||
|
||||
|
||||
</Application>
|
||||
</Directives>
|
||||
@@ -0,0 +1,107 @@
|
||||
// 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.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.Activation;
|
||||
|
||||
using Windows.ApplicationModel.Activation;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Services
|
||||
{
|
||||
// For more information on understanding and extending activation flow see
|
||||
// https://github.com/Microsoft/WindowsTemplateStudio/blob/master/docs/activation.md
|
||||
internal class ActivationService
|
||||
{
|
||||
private readonly App app;
|
||||
private readonly Type defaultNavItem;
|
||||
private Lazy<UIElement> shell;
|
||||
|
||||
private object lastActivationArgs;
|
||||
|
||||
public ActivationService(App app, Type defaultNavItem, Lazy<UIElement> shell = null)
|
||||
{
|
||||
this.app = app;
|
||||
this.shell = shell;
|
||||
this.defaultNavItem = defaultNavItem;
|
||||
}
|
||||
|
||||
public async Task ActivateAsync(object activationArgs)
|
||||
{
|
||||
if (IsInteractive(activationArgs))
|
||||
{
|
||||
// Initialize services that you need before app activation
|
||||
// take into account that the splash screen is shown while this code runs.
|
||||
await InitializeAsync().ConfigureAwait(false);
|
||||
|
||||
// Do not repeat app initialization when the Window already has content,
|
||||
// just ensure that the window is active
|
||||
if (Window.Current.Content == null)
|
||||
{
|
||||
// Create a Shell or Frame to act as the navigation context
|
||||
Window.Current.Content = shell?.Value ?? new Frame();
|
||||
}
|
||||
}
|
||||
|
||||
// Depending on activationArgs one of ActivationHandlers or DefaultActivationHandler
|
||||
// will navigate to the first page
|
||||
await HandleActivationAsync(activationArgs).ConfigureAwait(false);
|
||||
lastActivationArgs = activationArgs;
|
||||
|
||||
if (IsInteractive(activationArgs))
|
||||
{
|
||||
// Ensure the current window is active
|
||||
Window.Current.Activate();
|
||||
|
||||
// Tasks after activation
|
||||
await StartupAsync().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task InitializeAsync()
|
||||
{
|
||||
await Task.CompletedTask.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task HandleActivationAsync(object activationArgs)
|
||||
{
|
||||
var activationHandler = GetActivationHandlers()
|
||||
.FirstOrDefault(h => h.CanHandle(activationArgs));
|
||||
|
||||
if (activationHandler != null)
|
||||
{
|
||||
await activationHandler.HandleAsync(activationArgs).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (IsInteractive(activationArgs))
|
||||
{
|
||||
var defaultHandler = new DefaultActivationHandler(defaultNavItem);
|
||||
if (defaultHandler.CanHandle(activationArgs))
|
||||
{
|
||||
await defaultHandler.HandleAsync(activationArgs).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task StartupAsync()
|
||||
{
|
||||
await Task.CompletedTask.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static IEnumerable<ActivationHandler> GetActivationHandlers()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
private static bool IsInteractive(object args)
|
||||
{
|
||||
return args is IActivatedEventArgs;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
// 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 Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Media.Animation;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Services
|
||||
{
|
||||
public static class NavigationService
|
||||
{
|
||||
public static event NavigatedEventHandler Navigated;
|
||||
|
||||
public static event NavigationFailedEventHandler NavigationFailed;
|
||||
|
||||
private static Frame frame;
|
||||
private static object lastParamUsed;
|
||||
|
||||
public static Frame Frame
|
||||
{
|
||||
get
|
||||
{
|
||||
if (frame == null)
|
||||
{
|
||||
frame = Window.Current.Content as Frame;
|
||||
RegisterFrameEvents();
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
UnregisterFrameEvents();
|
||||
frame = value;
|
||||
RegisterFrameEvents();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CanGoBack => Frame.CanGoBack;
|
||||
|
||||
public static bool CanGoForward => Frame.CanGoForward;
|
||||
|
||||
public static bool GoBack()
|
||||
{
|
||||
if (CanGoBack)
|
||||
{
|
||||
Frame.GoBack();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void GoForward() => Frame.GoForward();
|
||||
|
||||
public static bool Navigate(Type pageType, object parameter = null, NavigationTransitionInfo infoOverride = null)
|
||||
{
|
||||
// Don't open the same page multiple times
|
||||
if (Frame.Content?.GetType() != pageType || (parameter != null && !parameter.Equals(lastParamUsed)))
|
||||
{
|
||||
var navigationResult = Frame.Navigate(pageType, parameter, infoOverride);
|
||||
if (navigationResult)
|
||||
{
|
||||
lastParamUsed = parameter;
|
||||
}
|
||||
|
||||
return navigationResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Navigate<T>(object parameter = null, NavigationTransitionInfo infoOverride = null)
|
||||
where T : Page
|
||||
=> Navigate(typeof(T), parameter, infoOverride);
|
||||
|
||||
private static void RegisterFrameEvents()
|
||||
{
|
||||
if (frame != null)
|
||||
{
|
||||
frame.Navigated += Frame_Navigated;
|
||||
frame.NavigationFailed += Frame_NavigationFailed;
|
||||
}
|
||||
}
|
||||
|
||||
private static void UnregisterFrameEvents()
|
||||
{
|
||||
if (frame != null)
|
||||
{
|
||||
frame.Navigated -= Frame_Navigated;
|
||||
frame.NavigationFailed -= Frame_NavigationFailed;
|
||||
}
|
||||
}
|
||||
|
||||
private static void Frame_NavigationFailed(object sender, NavigationFailedEventArgs e) => NavigationFailed?.Invoke(sender, e);
|
||||
|
||||
private static void Frame_Navigated(object sender, NavigationEventArgs e) => Navigated?.Invoke(sender, e);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,876 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Shell_General.Content" xml:space="preserve">
|
||||
<value>General</value>
|
||||
<comment>Navigation view item name for General</comment>
|
||||
</data>
|
||||
<data name="Shell_PowerLauncher.Content" xml:space="preserve">
|
||||
<value>PowerToys Run</value>
|
||||
<comment>Product name: Navigation view item name for PowerToys Run</comment>
|
||||
</data>
|
||||
<data name="Shell_PowerRename.Content" xml:space="preserve">
|
||||
<value>PowerRename</value>
|
||||
<comment>Product name: Navigation view item name for PowerRename</comment>
|
||||
</data>
|
||||
<data name="Shell_ShortcutGuide.Content" xml:space="preserve">
|
||||
<value>Shortcut Guide</value>
|
||||
<comment>Product name: Navigation view item name for Shortcut Guide</comment>
|
||||
</data>
|
||||
<data name="Shell_PowerPreview.Content" xml:space="preserve">
|
||||
<value>File Explorer</value>
|
||||
<comment>Product name: Navigation view item name for File Explorer Preview</comment>
|
||||
</data>
|
||||
<data name="Shell_FancyZones.Content" xml:space="preserve">
|
||||
<value>FancyZones</value>
|
||||
<comment>Product name: Navigation view item name for FancyZones</comment>
|
||||
</data>
|
||||
<data name="Shell_ImageResizer.Content" xml:space="preserve">
|
||||
<value>Image Resizer</value>
|
||||
<comment>Product name: Navigation view item name for Image Resizer</comment>
|
||||
</data>
|
||||
<data name="Shell_ColorPicker.Content" xml:space="preserve">
|
||||
<value>Color Picker</value>
|
||||
<comment>Product name: Navigation view item name for Color Picker</comment>
|
||||
</data>
|
||||
<data name="Shell_KeyboardManager.Content" xml:space="preserve">
|
||||
<value>Keyboard Manager</value>
|
||||
<comment>Product name: Navigation view item name for Keyboard Manager</comment>
|
||||
</data>
|
||||
<data name="KeyboardManager_ConfigHeader.Text" xml:space="preserve">
|
||||
<value>Current configuration</value>
|
||||
<comment>Keyboard Manager current configuration header</comment>
|
||||
</data>
|
||||
<data name="KeyboardManager_Description.Text" xml:space="preserve">
|
||||
<value>Reconfigure your keyboard by remapping keys and shortcuts.</value>
|
||||
<comment>Keyboard Manager page description</comment>
|
||||
</data>
|
||||
<data name="KeyboardManager_EnableToggle.Header" xml:space="preserve">
|
||||
<value>Enable Keyboard Manager</value>
|
||||
<comment>
|
||||
Keyboard Manager enable toggle header
|
||||
do not loc the Product name. Do you want this feature on / off
|
||||
</comment>
|
||||
</data>
|
||||
<data name="KeyboardManager_ProfileDescription.Text" xml:space="preserve">
|
||||
<value>Select the profile to display the active key remap and shortcuts</value>
|
||||
<comment>Keyboard Manager configuration dropdown description</comment>
|
||||
</data>
|
||||
<data name="KeyboardManager_RemapKeyboardButton.Content" xml:space="preserve">
|
||||
<value>Remap a key</value>
|
||||
<comment>Keyboard Manager remap keyboard button content</comment>
|
||||
</data>
|
||||
<data name="KeyboardManager_RemapKeyboardHeader.Text" xml:space="preserve">
|
||||
<value>Remap keys</value>
|
||||
<comment>Keyboard Manager remap keyboard header</comment>
|
||||
</data>
|
||||
<data name="KeyboardManager_RemapShortcutsButton.Content" xml:space="preserve">
|
||||
<value>Remap a shortcut</value>
|
||||
<comment>Keyboard Manager remap shortcuts button</comment>
|
||||
</data>
|
||||
<data name="KeyboardManager_RemapShortcutsHeader.Text" xml:space="preserve">
|
||||
<value>Remap shortcuts</value>
|
||||
<comment>Keyboard Manager remap shortcuts header</comment>
|
||||
</data>
|
||||
<data name="RemapKeysList.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Current Key Remappings</value>
|
||||
</data>
|
||||
<data name="RemapShortcutsList.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Current Shortcut Remappings</value>
|
||||
</data>
|
||||
<data name="KeyboardManager_RemappedKeysListItem.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Key Remapping</value>
|
||||
<comment>key as in keyboard key</comment>
|
||||
</data>
|
||||
<data name="KeyboardManager_RemappedShortcutsListItem.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Shortcut Remapping</value>
|
||||
</data>
|
||||
<data name="KeyboardManager_RemappedTo.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Remapped to</value>
|
||||
</data>
|
||||
<data name="KeyboardManager_ShortcutRemappedTo.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Remapped to</value>
|
||||
</data>
|
||||
<data name="KeyboardManager_TargetApp.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>For Target Application</value>
|
||||
<comment>What computer application would this be for</comment>
|
||||
</data>
|
||||
<data name="KeyboardManager_Image.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Keyboard Manager</value>
|
||||
<comment>do not loc, product name</comment>
|
||||
</data>
|
||||
<data name="ColorPicker_Description.Text" xml:space="preserve">
|
||||
<value>Quick and simple system-wide color picker.</value>
|
||||
</data>
|
||||
<data name="ColorPicker_EnableColorPicker.Header" xml:space="preserve">
|
||||
<value>Enable Color Picker</value>
|
||||
<comment>do not loc the Product name. Do you want this feature on / off</comment>
|
||||
</data>
|
||||
<data name="ColorPicker_ChangeCursor.Content" xml:space="preserve">
|
||||
<value>Change cursor when picking a color</value>
|
||||
</data>
|
||||
<data name="ColorPicker_ActivationShortcut.Header" xml:space="preserve">
|
||||
<value>Activate Color Picker</value>
|
||||
<comment>do not loc product name</comment>
|
||||
</data>
|
||||
<data name="PowerLauncher_Description.Text" xml:space="preserve">
|
||||
<value>A quick launcher that has additional capabilities without sacrificing performance.</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_EnablePowerLauncher.Header" xml:space="preserve">
|
||||
<value>Enable PowerToys Run</value>
|
||||
<comment>do not loc the Product name. Do you want this feature on / off</comment>
|
||||
</data>
|
||||
<data name="PowerLauncher_SearchResults.Text" xml:space="preserve">
|
||||
<value>Search & results</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_SearchResultPreference.Header" xml:space="preserve">
|
||||
<value>Search result preference</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_SearchResultPreference_MostRecentlyUsed" xml:space="preserve">
|
||||
<value>Most recently used</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_SearchResultPreference_AlphabeticalOrder" xml:space="preserve">
|
||||
<value>Alphabetical order</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_SearchResultPreference_RunningProcessesOpenApplications" xml:space="preserve">
|
||||
<value>Running processes/open applications</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_SearchTypePreference.Header" xml:space="preserve">
|
||||
<value>Search type preference</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_SearchTypePreference_ApplicationName" xml:space="preserve">
|
||||
<value>Application name</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_SearchTypePreference_StringInApplication" xml:space="preserve">
|
||||
<value>A string that is contained in the application</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_SearchTypePreference_ExecutableName" xml:space="preserve">
|
||||
<value>Executable name</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_MaximumNumberOfResults.Header" xml:space="preserve">
|
||||
<value>Maximum number of results</value>
|
||||
</data>
|
||||
<data name="Shortcuts.Text" xml:space="preserve">
|
||||
<value>Shortcuts</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_OpenPowerLauncher.Header" xml:space="preserve">
|
||||
<value>Open PowerToys Run</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_OpenFileLocation.Header" xml:space="preserve">
|
||||
<value>Open file location</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_CopyPathLocation.Header" xml:space="preserve">
|
||||
<value>Copy path location</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_OpenConsole.Header" xml:space="preserve">
|
||||
<value>Open console</value>
|
||||
<comment>console refers to Windows command prompt</comment>
|
||||
</data>
|
||||
<data name="PowerLauncher_OverrideWinRKey.Content" xml:space="preserve">
|
||||
<value>Override Win+R shortcut</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_OverrideWinSKey.Content" xml:space="preserve">
|
||||
<value>Override Win+S shortcut</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_IgnoreHotkeysInFullScreen.Content" xml:space="preserve">
|
||||
<value>Ignore shortcuts in fullscreen mode</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_DisableDriveDetectionWarning.Content" xml:space="preserve">
|
||||
<value>Disable drive detection warning for the file search plugin</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_ClearInputOnLaunch.Content" xml:space="preserve">
|
||||
<value>Clear the previous query on launch</value>
|
||||
</data>
|
||||
<data name="KeyboardManager_KeysMappingLayoutRightHeader.Text" xml:space="preserve">
|
||||
<value>To:</value>
|
||||
<comment>Keyboard Manager mapping keys view right header</comment>
|
||||
</data>
|
||||
<data name="About_This_Feature.Text" xml:space="preserve">
|
||||
<value>About this feature</value>
|
||||
</data>
|
||||
<data name="Appearance_GroupSettings.Text" xml:space="preserve">
|
||||
<value>Appearance</value>
|
||||
</data>
|
||||
<data name="Fancyzones_Image.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>FancyZones windows</value>
|
||||
<comment>do not loc the Product name</comment>
|
||||
</data>
|
||||
<data name="FancyZones_Description.Text" xml:space="preserve">
|
||||
<value>Create window layouts to help make multi-tasking easy.</value>
|
||||
<comment>windows refers to application windows</comment>
|
||||
</data>
|
||||
<data name="FancyZones_DisplayChangeMoveWindowsCheckBoxControl.Content" xml:space="preserve">
|
||||
<value>Keep windows in their zones when the screen resolution changes</value>
|
||||
<comment>windows refers to application windows</comment>
|
||||
</data>
|
||||
<data name="FancyZones_EnableToggleControl_HeaderText.Header" xml:space="preserve">
|
||||
<value>Enable FancyZones</value>
|
||||
<comment>do not loc the Product name. Do you want this feature on / off</comment>
|
||||
</data>
|
||||
<data name="FancyZones_ExcludeApps.Text" xml:space="preserve">
|
||||
<value>Excluded apps</value>
|
||||
</data>
|
||||
<data name="FancyZones_ExcludeApps_TextBoxControl.Header" xml:space="preserve">
|
||||
<value>To exclude an application from snapping to zones add its name here (one per line). These apps will react only to Windows Snap.</value>
|
||||
</data>
|
||||
<data name="FancyZones_HighlightOpacity.Header" xml:space="preserve">
|
||||
<value>Zone highlight opacity</value>
|
||||
</data>
|
||||
<data name="FancyZones_HotkeyEditorControl.Header" xml:space="preserve">
|
||||
<value>Open layout editor</value>
|
||||
<comment>Shortcut to launch the FancyZones layout editor application</comment>
|
||||
</data>
|
||||
<data name="SettingsPage_SetShortcut.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Shortcut setting</value>
|
||||
</data>
|
||||
<data name="SettingsPage_SetShortcut_Glyph.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Information Symbol</value>
|
||||
</data>
|
||||
<data name="FancyZones_LaunchEditorButtonControl.Text" xml:space="preserve">
|
||||
<value>Launch layout editor</value>
|
||||
<comment>launches the FancyZones layout editor application</comment>
|
||||
</data>
|
||||
<data name="FancyZones_MakeDraggedWindowTransparentCheckBoxControl.Content" xml:space="preserve">
|
||||
<value>Make dragged window transparent</value>
|
||||
</data>
|
||||
<data name="FancyZones_MouseDragCheckBoxControl_Header.Content" xml:space="preserve">
|
||||
<value>Use a non-primary mouse button to toggle zone activation</value>
|
||||
</data>
|
||||
<data name="FancyZones_MoveWindowsAcrossAllMonitorsCheckBoxControl.Content" xml:space="preserve">
|
||||
<value>Move windows between zones across all monitors</value>
|
||||
</data>
|
||||
<data name="FancyZones_OverrideSnapHotkeysCheckBoxControl.Content" xml:space="preserve">
|
||||
<value>Override Windows Snap shortcut (Win + Arrow) to move windows between zones</value>
|
||||
</data>
|
||||
<data name="FancyZones_ShiftDragCheckBoxControl_Header.Content" xml:space="preserve">
|
||||
<value>Hold Shift key to activate zones while dragging</value>
|
||||
</data>
|
||||
<data name="FancyZones_ShowZonesOnAllMonitorsCheckBoxControl.Content" xml:space="preserve">
|
||||
<value>Show zones on all monitors while dragging a window</value>
|
||||
</data>
|
||||
<data name="FancyZones_AppLastZoneMoveWindows.Content" xml:space="preserve">
|
||||
<value>Move newly created windows to their last known zone</value>
|
||||
<comment>windows refers to application windows</comment>
|
||||
</data>
|
||||
<data name="FancyZones_OpenWindowOnActiveMonitor.Content" xml:space="preserve">
|
||||
<value>Move newly created windows to the current active monitor (EXPERIMENTAL)</value>
|
||||
</data>
|
||||
<data name="FancyZones_UseCursorPosEditorStartupScreen.Content" xml:space="preserve">
|
||||
<value>Follow mouse cursor instead of focus when launching editor in a multi screen environment</value>
|
||||
</data>
|
||||
<data name="FancyZones_ZoneBehavior_GroupSettings.Text" xml:space="preserve">
|
||||
<value>Zone behavior</value>
|
||||
</data>
|
||||
<data name="FancyZones_ZoneHighlightColor.Text" xml:space="preserve">
|
||||
<value>Zone highlight color</value>
|
||||
</data>
|
||||
<data name="FancyZones_ZoneSetChangeMoveWindows.Content" xml:space="preserve">
|
||||
<value>During zone layout changes, windows assigned to a zone will match new size/positions</value>
|
||||
</data>
|
||||
<data name="Give_Feedback.Text" xml:space="preserve">
|
||||
<value>Give feedback</value>
|
||||
</data>
|
||||
<data name="Module_overview.Text" xml:space="preserve">
|
||||
<value>Learn more</value>
|
||||
<comment>This label is there to point people to additional overview for how to use the product</comment>
|
||||
</data>
|
||||
<data name="AttributionTitle.Text" xml:space="preserve">
|
||||
<value>Attribution</value>
|
||||
<comment>giving credit to the projects this utility was based on</comment>
|
||||
</data>
|
||||
<data name="GeneralPage_AboutPowerToysHeader.Text" xml:space="preserve">
|
||||
<value>About PowerToys</value>
|
||||
</data>
|
||||
<data name="PowerToys_Icon.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>PowerToys Icon</value>
|
||||
</data>
|
||||
<data name="GeneralPage_CheckForUpdates.Content" xml:space="preserve">
|
||||
<value>Check for updates</value>
|
||||
</data>
|
||||
<data name="GeneralPage_PrivacyStatement_URL.Text" xml:space="preserve">
|
||||
<value>Privacy statement</value>
|
||||
</data>
|
||||
<data name="GeneralPage_ReportAbug.Text" xml:space="preserve">
|
||||
<value>Report a bug</value>
|
||||
<comment>Report an issue inside powertoys</comment>
|
||||
</data>
|
||||
<data name="GeneralPage_RequestAFeature_URL.Text" xml:space="preserve">
|
||||
<value>Request a feature</value>
|
||||
<comment>Tell our team what we should build</comment>
|
||||
</data>
|
||||
<data name="GeneralPage_RestartAsAdmin_Button.Content" xml:space="preserve">
|
||||
<value>Restart as administrator</value>
|
||||
<comment>running PowerToys as a higher level user, account is typically referred to as an admin / administrator</comment>
|
||||
</data>
|
||||
<data name="GeneralPage_ToggleSwitch_RunAtStartUp.Header" xml:space="preserve">
|
||||
<value>Run at startup</value>
|
||||
</data>
|
||||
<data name="PowerRename_Description.Text" xml:space="preserve">
|
||||
<value>A Windows Shell extension for more advanced bulk renaming using search and replace or regular expressions.</value>
|
||||
</data>
|
||||
<data name="PowerRename_ShellIntegration.Text" xml:space="preserve">
|
||||
<value>Shell integration</value>
|
||||
<comment>This refers to directly integrating in with Windows</comment>
|
||||
</data>
|
||||
<data name="PowerRename_Toggle_Enable.Header" xml:space="preserve">
|
||||
<value>Enable PowerRename</value>
|
||||
<comment>do not loc the Product name. Do you want this feature on / off</comment>
|
||||
</data>
|
||||
<data name="RadioButtons_Name_Theme.Text" xml:space="preserve">
|
||||
<value>Settings theme</value>
|
||||
</data>
|
||||
<data name="PowerRename_Toggle_EnableOnContextMenu.Header" xml:space="preserve">
|
||||
<value>Show icon on context menu</value>
|
||||
</data>
|
||||
<data name="PowerRename_Toggle_EnableOnExtendedContextMenu.Header" xml:space="preserve">
|
||||
<value>Appear only in extended context menu (Shift + Right-click)</value>
|
||||
</data>
|
||||
<data name="PowerRename_Toggle_MaxDispListNum.Header" xml:space="preserve">
|
||||
<value>Maximum number of items</value>
|
||||
</data>
|
||||
<data name="PowerRename_Toggle_RestoreFlagsOnLaunch.Content" xml:space="preserve">
|
||||
<value>Show values from last use</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_ToggleSwitch_Preview_MD.Header" xml:space="preserve">
|
||||
<value>Enable Markdown (.md) preview</value>
|
||||
<comment>Do not loc "Markdown". Do you want this feature on / off</comment>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_ToggleSwitch_Preview_SVG.Header" xml:space="preserve">
|
||||
<value>Enable SVG (.svg) preview</value>
|
||||
<comment>Do you want this feature on / off</comment>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_ToggleSwitch_SVG_Thumbnail.Header" xml:space="preserve">
|
||||
<value>Enable SVG (.svg) thumbnails</value>
|
||||
<comment>Do you want this feature on / off</comment>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_Description.Text" xml:space="preserve">
|
||||
<value>These settings allow you to manage your Windows File Explorer custom preview handlers.</value>
|
||||
</data>
|
||||
<data name="PowerRename_AutoCompleteHeader.Text" xml:space="preserve">
|
||||
<value>Autocomplete</value>
|
||||
</data>
|
||||
<data name="OpenSource_Notice.Text" xml:space="preserve">
|
||||
<value>Open-source notice</value>
|
||||
</data>
|
||||
<data name="PowerRename_Toggle_AutoComplete.Content" xml:space="preserve">
|
||||
<value>Enable autocomplete for the search and replace fields</value>
|
||||
</data>
|
||||
<data name="FancyZones_BorderColor.Text" xml:space="preserve">
|
||||
<value>Zone border color</value>
|
||||
</data>
|
||||
<data name="FancyZones_InActiveColor.Text" xml:space="preserve">
|
||||
<value>Zone inactive color</value>
|
||||
</data>
|
||||
<data name="ShortcutGuide_Description.Text" xml:space="preserve">
|
||||
<value>Shows a help overlay with Windows shortcuts when the Windows key is pressed.</value>
|
||||
</data>
|
||||
<data name="ShortcutGuide_PressTime.Header" xml:space="preserve">
|
||||
<value>Press duration before showing (ms)</value>
|
||||
<comment>pressing a key in milliseconds</comment>
|
||||
</data>
|
||||
<data name="ShortcutGuide_Appearance_Behavior.Text" xml:space="preserve">
|
||||
<value>Appearance & behavior</value>
|
||||
</data>
|
||||
<data name="ShortcutGuide_Enable.Header" xml:space="preserve">
|
||||
<value>Enable Shortcut Guide</value>
|
||||
<comment>do not loc the Product name. Do you want this feature on / off</comment>
|
||||
</data>
|
||||
<data name="ShortcutGuide_OverlayOpacity.Header" xml:space="preserve">
|
||||
<value>Opacity of background</value>
|
||||
</data>
|
||||
<data name="ImageResizer_CustomSizes.Text" xml:space="preserve">
|
||||
<value>Image sizes</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Description.Text" xml:space="preserve">
|
||||
<value>Lets you resize images by right-clicking.</value>
|
||||
</data>
|
||||
<data name="ImageResizer_EnableToggle.Header" xml:space="preserve">
|
||||
<value>Enable Image Resizer</value>
|
||||
<comment>do not loc the Product name. Do you want this feature on / off</comment>
|
||||
</data>
|
||||
<data name="ImagesSizesListView.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Image Size</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Configurations.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Configurations</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Name.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Configuration Name</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Fit_Property.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Fit Property</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Width_Property.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Width Property</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Height_Property.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Height Property</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Size_Property.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Size Property</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Times_Symbol.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Times Symbol</value>
|
||||
</data>
|
||||
<data name="RemoveButton.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Remove</value>
|
||||
<comment>Removes a user defined setting group for Image Resizer</comment>
|
||||
</data>
|
||||
<data name="RemoveTooltip.Text" xml:space="preserve">
|
||||
<value>Remove</value>
|
||||
<comment>Removes a user defined setting group for Image Resizer</comment>
|
||||
</data>
|
||||
<data name="ImageResizer_Image.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Image Resizer</value>
|
||||
</data>
|
||||
<data name="ImageResizer_AddSizeButton.Label" xml:space="preserve">
|
||||
<value>Add size</value>
|
||||
</data>
|
||||
<data name="ImageResizer_SaveSizeButton.Label" xml:space="preserve">
|
||||
<value>Save sizes</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Encoding.Header" xml:space="preserve">
|
||||
<value>JPEG quality level</value>
|
||||
</data>
|
||||
<data name="ImageResizer_PNGInterlacing.Header" xml:space="preserve">
|
||||
<value>PNG interlacing</value>
|
||||
</data>
|
||||
<data name="ImageResizer_TIFFCompression.Header" xml:space="preserve">
|
||||
<value>TIFF compression</value>
|
||||
</data>
|
||||
<data name="File.Text" xml:space="preserve">
|
||||
<value>File</value>
|
||||
<comment>as in a computer file</comment>
|
||||
</data>
|
||||
<data name="Default.Content" xml:space="preserve">
|
||||
<value>Default</value>
|
||||
</data>
|
||||
<data name="ImageResizer_ENCODER_TIFF_CCITT3.Content" xml:space="preserve">
|
||||
<value>CCITT3</value>
|
||||
<comment>do not loc</comment>
|
||||
</data>
|
||||
<data name="ImageResizer_ENCODER_TIFF_CCITT4.Content" xml:space="preserve">
|
||||
<value>CCITT4</value>
|
||||
<comment>do not loc</comment>
|
||||
</data>
|
||||
<data name="ImageResizer_ENCODER_TIFF_Default.Content" xml:space="preserve">
|
||||
<value>Default</value>
|
||||
</data>
|
||||
<data name="ImageResizer_ENCODER_TIFF_LZW.Content" xml:space="preserve">
|
||||
<value>LZW</value>
|
||||
<comment>do not loc</comment>
|
||||
</data>
|
||||
<data name="ImageResizer_ENCODER_TIFF_None.Content" xml:space="preserve">
|
||||
<value>None</value>
|
||||
</data>
|
||||
<data name="ImageResizer_ENCODER_TIFF_RLE.Content" xml:space="preserve">
|
||||
<value>RLE</value>
|
||||
<comment>do not loc</comment>
|
||||
</data>
|
||||
<data name="ImageResizer_ENCODER_TIFF_Zip.Content" xml:space="preserve">
|
||||
<value>Zip</value>
|
||||
<comment>do not loc</comment>
|
||||
</data>
|
||||
<data name="ImageResizer_FallbackEncoder_BMP.Content" xml:space="preserve">
|
||||
<value>BMP encoder</value>
|
||||
</data>
|
||||
<data name="ImageResizer_FallbackEncoder_GIF.Content" xml:space="preserve">
|
||||
<value>GIF encoder</value>
|
||||
</data>
|
||||
<data name="ImageResizer_FallbackEncoder_JPEG.Content" xml:space="preserve">
|
||||
<value>JPEG encoder</value>
|
||||
</data>
|
||||
<data name="ImageResizer_FallbackEncoder_PNG.Content" xml:space="preserve">
|
||||
<value>PNG encoder</value>
|
||||
</data>
|
||||
<data name="ImageResizer_FallbackEncoder_TIFF.Content" xml:space="preserve">
|
||||
<value>TIFF encoder</value>
|
||||
</data>
|
||||
<data name="ImageResizer_FallbackEncoder_WMPhoto.Content" xml:space="preserve">
|
||||
<value>WMPhoto encoder</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Sizes_Fit_Fill.Content" xml:space="preserve">
|
||||
<value>Fill</value>
|
||||
<comment>Refers to filling an image into a certain size. It could overflow</comment>
|
||||
</data>
|
||||
<data name="ImageResizer_Sizes_Fit_Fit.Content" xml:space="preserve">
|
||||
<value>Fit</value>
|
||||
<comment>Refers to fitting an image into a certain size. It won't overflow</comment>
|
||||
</data>
|
||||
<data name="ImageResizer_Sizes_Fit_Stretch.Content" xml:space="preserve">
|
||||
<value>Stretch</value>
|
||||
<comment>Refers to stretching an image into a certain size. Won't overflow but could distort.</comment>
|
||||
</data>
|
||||
<data name="ImageResizer_Sizes_Units_CM.Content" xml:space="preserve">
|
||||
<value>Centimeters</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Sizes_Units_Inches.Content" xml:space="preserve">
|
||||
<value>Inches</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Sizes_Units_Percent.Content" xml:space="preserve">
|
||||
<value>Percent</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Sizes_Units_Pixels.Content" xml:space="preserve">
|
||||
<value>Pixels</value>
|
||||
</data>
|
||||
<data name="Off.Content" xml:space="preserve">
|
||||
<value>Off</value>
|
||||
</data>
|
||||
<data name="On.Content" xml:space="preserve">
|
||||
<value>On</value>
|
||||
</data>
|
||||
<data name="GeneralPage_ToggleSwitch_AlwaysRunElevated_Link.Text" xml:space="preserve">
|
||||
<value>Learn more about administrator mode</value>
|
||||
</data>
|
||||
<data name="GeneralPage_ToggleSwitch_AutoDownloadUpdates.Header" xml:space="preserve">
|
||||
<value>Download updates automatically (Except on metered connections)</value>
|
||||
</data>
|
||||
<data name="GeneralPage_ToggleSwitch_RunningAsAdminNote.Text" xml:space="preserve">
|
||||
<value>Currently running as administrator</value>
|
||||
</data>
|
||||
<data name="GeneralSettings_AlwaysRunAsAdminText.Header" xml:space="preserve">
|
||||
<value>Always run as administrator</value>
|
||||
</data>
|
||||
<data name="GeneralSettings_RunningAsUserText" xml:space="preserve">
|
||||
<value>Running as user</value>
|
||||
</data>
|
||||
<data name="GeneralSettings_RunningAsAdminText" xml:space="preserve">
|
||||
<value>Running as administrator</value>
|
||||
</data>
|
||||
<data name="About_FancyZones.Text" xml:space="preserve">
|
||||
<value>About FancyZones</value>
|
||||
</data>
|
||||
<data name="About_FileExplorerPreview.Text" xml:space="preserve">
|
||||
<value>About File Explorer</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_Image.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>File Explorer</value>
|
||||
</data>
|
||||
<data name="About_ImageResizer.Text" xml:space="preserve">
|
||||
<value>About Image Resizer</value>
|
||||
</data>
|
||||
<data name="About_KeyboardManager.Text" xml:space="preserve">
|
||||
<value>About Keyboard Manager</value>
|
||||
</data>
|
||||
<data name="About_ColorPicker.Text" xml:space="preserve">
|
||||
<value>About Color Picker</value>
|
||||
</data>
|
||||
<data name="ColorPicker_Image.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Color Picker</value>
|
||||
<comment>do not loc the Product name.</comment>
|
||||
</data>
|
||||
<data name="About_PowerLauncher.Text" xml:space="preserve">
|
||||
<value>About PowerToys Run</value>
|
||||
</data>
|
||||
<data name="PowerToys_Run_Image.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>PowerToys Run</value>
|
||||
</data>
|
||||
<data name="About_PowerRename.Text" xml:space="preserve">
|
||||
<value>About PowerRename</value>
|
||||
<comment>do not loc the product name</comment>
|
||||
</data>
|
||||
<data name="PowerRename_Image.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>PowerRename</value>
|
||||
<comment>do not loc</comment>
|
||||
</data>
|
||||
<data name="About_ShortcutGuide.Text" xml:space="preserve">
|
||||
<value>About Shortcut Guide</value>
|
||||
</data>
|
||||
<data name="Shortcut_Guide_Image.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Shortcut Guide</value>
|
||||
</data>
|
||||
<data name="General_Repository.Text" xml:space="preserve">
|
||||
<value>GitHub repository</value>
|
||||
</data>
|
||||
<data name="General_Updates.Text" xml:space="preserve">
|
||||
<value>Updates</value>
|
||||
</data>
|
||||
<data name="General_Version.Text" xml:space="preserve">
|
||||
<value>Version:</value>
|
||||
</data>
|
||||
<data name="General_Version.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Version</value>
|
||||
</data>
|
||||
<data name="Admin_mode.Text" xml:space="preserve">
|
||||
<value>Administrator mode</value>
|
||||
</data>
|
||||
<data name="General_RunAsAdminRequired.Text" xml:space="preserve">
|
||||
<value>You need to run as administrator to use this setting</value>
|
||||
</data>
|
||||
<data name="ShortcutWarningLabel.Text" xml:space="preserve">
|
||||
<value>Only shortcuts with the following hotkeys are valid:</value>
|
||||
<comment>keyboard shortcuts and</comment>
|
||||
</data>
|
||||
<data name="FancyZones_RestoreSize.Content" xml:space="preserve">
|
||||
<value>Restore the original size of windows when unsnapping</value>
|
||||
</data>
|
||||
<data name="ImageResizer_FallBackEncoderText.Header" xml:space="preserve">
|
||||
<value>Fallback encoder</value>
|
||||
</data>
|
||||
<data name="ImageResizer_FileFormatDescription.Text" xml:space="preserve">
|
||||
<value>The following parameters can be used:</value>
|
||||
</data>
|
||||
<data name="ImageResizer_FilenameFormatHeader.Text" xml:space="preserve">
|
||||
<value>Filename format</value>
|
||||
</data>
|
||||
<data name="ImageResizer_UseOriginalDate.Content" xml:space="preserve">
|
||||
<value>Use original date modified</value>
|
||||
</data>
|
||||
<data name="Encoding.Text" xml:space="preserve">
|
||||
<value>Encoding</value>
|
||||
</data>
|
||||
<data name="KeyboardManager_RemapKeyboardSubtitle.Text" xml:space="preserve">
|
||||
<value>Remap keys to other keys or shortcuts.</value>
|
||||
</data>
|
||||
<data name="KeyboardManager_RemapShortcutsSubtitle.Text" xml:space="preserve">
|
||||
<value>Remap shortcuts to other shortcuts or keys. Additionally, mappings can be targeted to specific applications as well.</value>
|
||||
</data>
|
||||
<data name="About_PowerToys.Text" xml:space="preserve">
|
||||
<value>Microsoft PowerToys is a set of utilities for power users to tune and streamline their Windows experience for greater productivity.</value>
|
||||
<comment>Windows refers to the OS</comment>
|
||||
</data>
|
||||
<data name="FancyZones_SpanZonesAcrossMonitorsCheckBoxControl.Content" xml:space="preserve">
|
||||
<value>Allow zones to span across monitors (all monitors must have the same DPI scaling)</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Formatting_ActualHeight.Text" xml:space="preserve">
|
||||
<value>Actual height</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Formatting_ActualWidth.Text" xml:space="preserve">
|
||||
<value>Actual width</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Formatting_Filename.Text" xml:space="preserve">
|
||||
<value>Original filename</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Formatting_SelectedHeight.Text" xml:space="preserve">
|
||||
<value>Selected height</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Formatting_SelectedWidth.Text" xml:space="preserve">
|
||||
<value>Selected width</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Formatting_Sizename.Text" xml:space="preserve">
|
||||
<value>Size name</value>
|
||||
</data>
|
||||
<data name="FancyZones_MoveWindowsBasedOnPositionCheckBoxControl.Content" xml:space="preserve">
|
||||
<value>Move windows based on their position</value>
|
||||
<comment>Windows refers to application windows</comment>
|
||||
</data>
|
||||
<data name="GeneralSettings_NewVersionIsAvailable" xml:space="preserve">
|
||||
<value>New update available</value>
|
||||
</data>
|
||||
<data name="GeneralSettings_VersionIsLatest" xml:space="preserve">
|
||||
<value>PowerToys is up-to-date.</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_IconThumbnail_GroupSettings.Text" xml:space="preserve">
|
||||
<value>Icon Preview</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_PreviewPane_GroupSettings.Text" xml:space="preserve">
|
||||
<value>Preview Pane</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_RunAsAdminRequired.Text" xml:space="preserve">
|
||||
<value>You need to run as administrator to modify these settings</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_AffectsAllUsers.Text" xml:space="preserve">
|
||||
<value>The settings on this page affect all users on the system</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_RebootRequired.Text" xml:space="preserve">
|
||||
<value>A reboot may be required for changes to these settings to take effect</value>
|
||||
</data>
|
||||
<data name="FancyZones_ExcludeApps_TextBoxControl.PlaceholderText" xml:space="preserve">
|
||||
<value>Example: outlook.exe</value>
|
||||
</data>
|
||||
<data name="ImageResizer_FilenameFormatPlaceholder.PlaceholderText" xml:space="preserve">
|
||||
<value>Example: %1 (%2)</value>
|
||||
</data>
|
||||
<data name="ColorModeHeader.Text" xml:space="preserve">
|
||||
<value>Choose a mode</value>
|
||||
</data>
|
||||
<data name="Radio_Theme_Dark.Content" xml:space="preserve">
|
||||
<value>Dark</value>
|
||||
<comment>Dark refers to color, not weight</comment>
|
||||
</data>
|
||||
<data name="Radio_Theme_Light.Content" xml:space="preserve">
|
||||
<value>Light</value>
|
||||
<comment>Light refers to color, not weight</comment>
|
||||
</data>
|
||||
<data name="Radio_Theme_Default.Content" xml:space="preserve">
|
||||
<value>Windows default</value>
|
||||
<comment>Windows refers to the Operating system</comment>
|
||||
</data>
|
||||
<data name="Windows_Color_Settings.Text" xml:space="preserve">
|
||||
<value>Windows color settings</value>
|
||||
<comment>Windows refers to the Operating system</comment>
|
||||
</data>
|
||||
<data name="ColorPicker_CopiedColorRepresentation.Header" xml:space="preserve">
|
||||
<value>Color format for clipboard</value>
|
||||
</data>
|
||||
<data name="ColorPickerFirst.Text" xml:space="preserve">
|
||||
<value>Color Picker with editor mode enabled</value>
|
||||
<comment>do not loc the product name</comment>
|
||||
</data>
|
||||
<data name="ColorPickerFirst_Description.Text" xml:space="preserve">
|
||||
<value>Pick a color from the screen, copy formatted value to clipboard, then to the editor</value>
|
||||
<comment>do not loc the product name</comment>
|
||||
</data>
|
||||
<data name="EditorFirst.Text" xml:space="preserve">
|
||||
<value>Editor</value>
|
||||
</data>
|
||||
<data name="ColorPicker_ActivationAction.Text" xml:space="preserve">
|
||||
<value>Activation behavior</value>
|
||||
</data>
|
||||
<data name="ColorFormats.Text" xml:space="preserve">
|
||||
<value>Color formats</value>
|
||||
</data>
|
||||
<data name="KBM_KeysCannotBeRemapped.Text" xml:space="preserve">
|
||||
<value>Learn more about remapping limitations</value>
|
||||
<comment>This is a link that will discuss what is and is not possible for Keyboard manager to remap</comment>
|
||||
</data>
|
||||
<data name="FancyZones_Editor_GroupSettings.Text" xml:space="preserve">
|
||||
<value>Editor</value>
|
||||
<comment>refers to the FancyZone editor</comment>
|
||||
</data>
|
||||
<data name="FancyZones_WindowBehavior_GroupSettings.Text" xml:space="preserve">
|
||||
<value>Window behavior</value>
|
||||
</data>
|
||||
<data name="PowerRename_BehaviorHeader.Text" xml:space="preserve">
|
||||
<value>Behavior</value>
|
||||
</data>
|
||||
<data name="PowerRename_Toggle_UseBoostLib.Content" xml:space="preserve">
|
||||
<value>Use Boost library (provides extended features but may use different regex syntax)</value>
|
||||
<comment>Boost is a product name, should not be translated</comment>
|
||||
</data>
|
||||
<data name="MadeWithOssLove.Text" xml:space="preserve">
|
||||
<value>Made with 💗 by Microsoft and the PowerToys community.</value>
|
||||
</data>
|
||||
<data name="ColorPickerOnly.Text" xml:space="preserve">
|
||||
<value>Color Picker only</value>
|
||||
<comment>do not loc the product name</comment>
|
||||
</data>
|
||||
<data name="ColorPickerOnly_Description.Text" xml:space="preserve">
|
||||
<value>Pick a color from the screen and copy formatted value to clipboard</value>
|
||||
</data>
|
||||
<data name="EditorFirst_Description.Text" xml:space="preserve">
|
||||
<value>Open directly into the editor mode</value>
|
||||
</data>
|
||||
<data name="ColorPicker_ColorFormatsDescription.Text" xml:space="preserve">
|
||||
<value>Editor color formats (Change the order by dragging)</value>
|
||||
</data>
|
||||
<data name="ColorPicker_ShowColorName.Content" xml:space="preserve">
|
||||
<value>Show color name</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,74 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style x:Key="AddItemAppBarButtonStyle" TargetType="AppBarButton">
|
||||
<Setter Property="Background" Value="{ThemeResource AppBarButtonBackground}"/>
|
||||
<Setter Property="Foreground" Value="{ThemeResource AppBarButtonForeground}"/>
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource AppBarButtonBorderBrush}"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<Setter Property="MaxWidth" Value="500"/>
|
||||
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
|
||||
<Setter Property="FontWeight" Value="Normal"/>
|
||||
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}"/>
|
||||
<Setter Property="AllowFocusOnInteraction" Value="False"/>
|
||||
<Setter Property="KeyboardAcceleratorPlacementMode" Value="Hidden"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="AppBarButton">
|
||||
<Grid x:Name="Root" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{TemplateBinding CornerRadius}" MinWidth="{TemplateBinding MinWidth}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal"/>
|
||||
<VisualState x:Name="PointerOver">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemListLowColor}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerUpThemeAnimation Storyboard.TargetName="ContentRoot"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Pressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemListMediumColor}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerDownThemeAnimation Storyboard.TargetName="ContentRoot"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="Root.Background" Value="{ThemeResource AppBarButtonBackgroundDisabled}"/>
|
||||
<Setter Target="AppBarButtonInnerBorder.BorderBrush" Value="{ThemeResource AppBarButtonBorderBrushDisabled}"/>
|
||||
<Setter Target="Content.Foreground" Value="{ThemeResource AppBarButtonForegroundDisabled}"/>
|
||||
<Setter Target="TextLabel.Foreground" Value="{ThemeResource AppBarButtonForegroundDisabled}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
|
||||
|
||||
|
||||
<Grid x:Name="ContentRoot">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="320"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border x:Name="AppBarButtonInnerBorder" Margin="10" CornerRadius="4" Height="40" Width="40" Background="{ThemeResource ButtonBackground}">
|
||||
<ContentPresenter x:Name="Content" Content="{TemplateBinding Icon}" Foreground="{TemplateBinding Foreground}" RenderTransformOrigin="0.5,0.5">
|
||||
<ContentPresenter.RenderTransform>
|
||||
<CompositeTransform ScaleX="0.8" ScaleY="0.8"/>
|
||||
</ContentPresenter.RenderTransform>
|
||||
</ContentPresenter>
|
||||
</Border>
|
||||
|
||||
<TextBlock x:Name="TextLabel" Grid.Column="1" AutomationProperties.AccessibilityView="Raw" Foreground="{TemplateBinding Foreground}" Margin="0,-2,0,0" VerticalAlignment="Center" FontSize="14" Text="{TemplateBinding Label}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,9 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style TargetType="Page" x:Key="PageStyle">
|
||||
<Setter Property="Background" Value="{ThemeResource ApplicationPageBackgroundThemeBrush}" />
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,31 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<!--Common texts-->
|
||||
<Style x:Key="PageTitleStyle" TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="FontWeight" Value="SemiLight" />
|
||||
<Setter Property="FontSize" Value="{StaticResource LargeFontSize}" />
|
||||
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
|
||||
<Setter Property="TextWrapping" Value="NoWrap" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="BodyTextStyle" TargetType="TextBlock">
|
||||
<Setter Property="FontWeight" Value="Normal" />
|
||||
<Setter Property="FontSize" Value="{StaticResource MediumFontSize}" />
|
||||
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
</Style>
|
||||
|
||||
|
||||
<Style x:Key="SettingsGroupTitleStyle" TargetType="TextBlock" BasedOn="{StaticResource SubtitleTextBlockStyle}">
|
||||
<Setter Property="Margin" Value="0,34,0,4" />
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="AutomationProperties.HeadingLevel" Value="Level2" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="SettingsGroupTitleStyleAsHeader" TargetType="TextBlock" BasedOn="{StaticResource SettingsGroupTitleStyle}">
|
||||
<Setter Property="Margin" Value="0,0,0,4" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,5 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<SolidColorBrush x:Key="ThemeControlForegroundBaseHighBrush" Color="{ThemeResource SystemBaseHighColor}"/>
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,8 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<x:Double x:Key="LargeFontSize">24</x:Double>
|
||||
<x:Double x:Key="MediumFontSize">16</x:Double>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,19 @@
|
||||
<ResourceDictionary
|
||||
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.Styles">
|
||||
|
||||
<x:Double x:Key="SidePanelWidth">240</x:Double>
|
||||
|
||||
<!-- Breakpoint for wide layout (side panel next to content) -->
|
||||
<x:Double x:Key="WideLayoutMinWidth">720</x:Double>
|
||||
|
||||
<!-- Breakpoint for small layout (side panel above content) -->
|
||||
<x:Double x:Key="SmallLayoutMinWidth">600</x:Double>
|
||||
|
||||
<!-- Column spacing between content and sidepanel -->
|
||||
<x:Double x:Key="DefaultColumnSpacing">24</x:Double>
|
||||
|
||||
<!-- Row spacing between content and sidepanel (in small mode) -->
|
||||
<x:Double x:Key="DefaultRowSpacing">24</x:Double>
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,36 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<!--Medium size margins-->
|
||||
<Thickness x:Key="MediumLeftMargin">24,0,0,0</Thickness>
|
||||
<Thickness x:Key="MediumTopMargin">0,24,0,0</Thickness>
|
||||
<Thickness x:Key="MediumLeftRightMargin">24,0,24,0</Thickness>
|
||||
<Thickness x:Key="MediumRightMargin">0,0,24,0</Thickness>
|
||||
<Thickness x:Key="MediumTopBottomMargin">0,24,0,24</Thickness>
|
||||
<Thickness x:Key="MediumLeftTopRightBottomMargin">24,24,24,24</Thickness>
|
||||
<Thickness x:Key="MediumLeftRightBottomMargin">24,0,24,24</Thickness>
|
||||
<Thickness x:Key="MediumBottomMargin">0,0,0,24</Thickness>
|
||||
|
||||
<!--Small size margins-->
|
||||
<Thickness x:Key="SmallLeftMargin">12, 0, 0, 0</Thickness>
|
||||
<Thickness x:Key="SmallTopMargin">0, 12, 0, 0</Thickness>
|
||||
<Thickness x:Key="SmallTopBottomMargin">0, 12, 0, 12</Thickness>
|
||||
<Thickness x:Key="SmallBottomMargin">0, 0, 0, 12</Thickness>
|
||||
<Thickness x:Key="SmallLeftRightMargin">12, 0, 12, 0</Thickness>
|
||||
<Thickness x:Key="SmallRightMargin">0, 0, 12, 0</Thickness>
|
||||
<Thickness x:Key="SmallLeftRightBottomMargin">12, 0, 12, 12</Thickness>
|
||||
<Thickness x:Key="SmallLeftTopRightBottomMargin">12, 12, 12, 12</Thickness>
|
||||
|
||||
<Thickness x:Key="AddItemButtonMargin">-10, 12, 0, 0</Thickness>
|
||||
|
||||
<!--Extra Small size margins-->
|
||||
<Thickness x:Key="XSmallLeftMargin">8, 0, 0, 0</Thickness>
|
||||
<Thickness x:Key="XSmallTopMargin">0, 8, 0, 0</Thickness>
|
||||
<Thickness x:Key="XSmallBottomMargin">0, 0, 0, 8</Thickness>
|
||||
<Thickness x:Key="XSmallLeftTopRightBottomMargin">8, 8, 8, 8</Thickness>
|
||||
|
||||
<!--Extra Extra Small size margins-->
|
||||
<Thickness x:Key="XXSmallTopMargin">0, 4, 0, 0</Thickness>
|
||||
<Thickness x:Key="XXSmallTopRightBottomMargin">0, 4, 4, 4</Thickness>
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,36 @@
|
||||
// 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.Windows.Input;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels.Commands
|
||||
{
|
||||
public class ButtonClickCommand : ICommand
|
||||
{
|
||||
private readonly Action _execute;
|
||||
|
||||
public ButtonClickCommand(Action execute)
|
||||
{
|
||||
_execute = execute;
|
||||
}
|
||||
|
||||
// Occurs when changes occur that affect whether or not the command should execute.
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
// Defines the method that determines whether the command can execute in its current state.
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Defines the method to be called when the command is invoked.
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_execute();
|
||||
}
|
||||
|
||||
public void OnCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
// 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.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Services;
|
||||
using Windows.System;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using WinUI = Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class ShellViewModel : Observable
|
||||
{
|
||||
private readonly KeyboardAccelerator altLeftKeyboardAccelerator = BuildKeyboardAccelerator(VirtualKey.Left, VirtualKeyModifiers.Menu);
|
||||
|
||||
private readonly KeyboardAccelerator backKeyboardAccelerator = BuildKeyboardAccelerator(VirtualKey.GoBack);
|
||||
|
||||
private bool isBackEnabled;
|
||||
private IList<KeyboardAccelerator> keyboardAccelerators;
|
||||
private WinUI.NavigationView navigationView;
|
||||
private WinUI.NavigationViewItem selected;
|
||||
private ICommand loadedCommand;
|
||||
private ICommand itemInvokedCommand;
|
||||
|
||||
public bool IsBackEnabled
|
||||
{
|
||||
get { return isBackEnabled; }
|
||||
set { Set(ref isBackEnabled, value); }
|
||||
}
|
||||
|
||||
public WinUI.NavigationViewItem Selected
|
||||
{
|
||||
get { return selected; }
|
||||
set { Set(ref selected, value); }
|
||||
}
|
||||
|
||||
public ICommand LoadedCommand => loadedCommand ?? (loadedCommand = new RelayCommand(OnLoaded));
|
||||
|
||||
public ICommand ItemInvokedCommand => itemInvokedCommand ?? (itemInvokedCommand = new RelayCommand<WinUI.NavigationViewItemInvokedEventArgs>(OnItemInvoked));
|
||||
|
||||
public ShellViewModel()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(Frame frame, WinUI.NavigationView navigationView, IList<KeyboardAccelerator> keyboardAccelerators)
|
||||
{
|
||||
this.navigationView = navigationView;
|
||||
this.keyboardAccelerators = keyboardAccelerators;
|
||||
NavigationService.Frame = frame;
|
||||
NavigationService.NavigationFailed += Frame_NavigationFailed;
|
||||
NavigationService.Navigated += Frame_Navigated;
|
||||
this.navigationView.BackRequested += OnBackRequested;
|
||||
}
|
||||
|
||||
private static KeyboardAccelerator BuildKeyboardAccelerator(VirtualKey key, VirtualKeyModifiers? modifiers = null)
|
||||
{
|
||||
var keyboardAccelerator = new KeyboardAccelerator() { Key = key };
|
||||
if (modifiers.HasValue)
|
||||
{
|
||||
keyboardAccelerator.Modifiers = modifiers.Value;
|
||||
}
|
||||
|
||||
keyboardAccelerator.Invoked += OnKeyboardAcceleratorInvoked;
|
||||
return keyboardAccelerator;
|
||||
}
|
||||
|
||||
private static void OnKeyboardAcceleratorInvoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
|
||||
{
|
||||
var result = NavigationService.GoBack();
|
||||
args.Handled = result;
|
||||
}
|
||||
|
||||
private async void OnLoaded()
|
||||
{
|
||||
// Keyboard accelerators are added here to avoid showing 'Alt + left' tooltip on the page.
|
||||
// More info on tracking issue https://github.com/Microsoft/microsoft-ui-xaml/issues/8
|
||||
keyboardAccelerators.Add(altLeftKeyboardAccelerator);
|
||||
keyboardAccelerators.Add(backKeyboardAccelerator);
|
||||
await Task.CompletedTask.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private void OnItemInvoked(WinUI.NavigationViewItemInvokedEventArgs args)
|
||||
{
|
||||
var item = navigationView.MenuItems
|
||||
.OfType<WinUI.NavigationViewItem>()
|
||||
.First(menuItem => (string)menuItem.Content == (string)args.InvokedItem);
|
||||
var pageType = item.GetValue(NavHelper.NavigateToProperty) as Type;
|
||||
NavigationService.Navigate(pageType);
|
||||
}
|
||||
|
||||
private void OnBackRequested(WinUI.NavigationView sender, WinUI.NavigationViewBackRequestedEventArgs args)
|
||||
{
|
||||
NavigationService.GoBack();
|
||||
}
|
||||
|
||||
private void Frame_NavigationFailed(object sender, NavigationFailedEventArgs e)
|
||||
{
|
||||
throw e.Exception;
|
||||
}
|
||||
|
||||
private void Frame_Navigated(object sender, NavigationEventArgs e)
|
||||
{
|
||||
IsBackEnabled = NavigationService.CanGoBack;
|
||||
Selected = navigationView.MenuItems
|
||||
.OfType<WinUI.NavigationViewItem>()
|
||||
.FirstOrDefault(menuItem => IsMenuItemForPageType(menuItem, e.SourcePageType));
|
||||
}
|
||||
|
||||
private static bool IsMenuItemForPageType(WinUI.NavigationViewItem menuItem, Type sourcePageType)
|
||||
{
|
||||
var pageType = menuItem.GetValue(NavHelper.NavigateToProperty) as Type;
|
||||
return pageType == sourcePageType;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.ColorPickerPage"
|
||||
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:Custom="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:Color="using:Microsoft.PowerToys.Settings.UI.Library.ViewModels" xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="400"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
|
||||
<Grid RowSpacing="{StaticResource DefaultRowSpacing}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="LayoutVisualStates">
|
||||
<VisualState x:Name="WideLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource WideLayoutMinWidth}" />
|
||||
</VisualState.StateTriggers>
|
||||
</VisualState>
|
||||
<VisualState x:Name="SmallLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource SmallLayoutMinWidth}" />
|
||||
<AdaptiveTrigger MinWindowWidth="0" />
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="SidePanel.(Grid.Column)" Value="0" />
|
||||
<Setter Target="SidePanel.Width" Value="Auto" />
|
||||
<Setter Target="ColorPickerView.(Grid.Row)" Value="1" />
|
||||
<Setter Target="LinksPanel.(RelativePanel.RightOf)" Value="AboutImage" />
|
||||
<Setter Target="LinksPanel.(RelativePanel.AlignTopWith)" Value="AboutImage" />
|
||||
<Setter Target="AboutImage.Margin" Value="0,12,12,0" />
|
||||
<Setter Target="AboutTitle.Visibility" Value="Collapsed" />
|
||||
</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="ColorPickerView">
|
||||
<ToggleSwitch x:Uid="ColorPicker_EnableColorPicker"
|
||||
IsOn="{Binding IsEnabled, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock x:Uid="Shortcuts"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<Custom:HotkeySettingsControl x:Uid="ColorPicker_ActivationShortcut"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HotkeySettings="{x:Bind Path=ViewModel.ActivationShortcut, Mode=TwoWay}"
|
||||
Keys="Win, Ctrl, Alt, Shift"
|
||||
Enabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
HorizontalAlignment="Left"
|
||||
MinWidth="240"
|
||||
/>
|
||||
|
||||
<TextBlock x:Uid="ColorPicker_ActivationAction"
|
||||
Margin="{StaticResource MediumTopMargin}"
|
||||
x:Name="ColorPicker_ActivationAction"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
<StackPanel AutomationProperties.LabeledBy="{Binding ElementName=ColorPicker_ActivationAction}" Margin="0,-4,0,0">
|
||||
<RadioButton
|
||||
IsChecked="{Binding ActivationOpensColorPickerAndEditor, Mode=TwoWay}"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsEnabled="{Binding IsEnabled}"
|
||||
GroupName="ColorPickerActivationAction">
|
||||
<RadioButton.Content>
|
||||
<TextBlock TextWrapping="WrapWholeWords" LineHeight="20">
|
||||
<Run x:Uid="ColorPickerFirst"/>
|
||||
<LineBreak/>
|
||||
<Run Foreground="{ThemeResource SystemBaseMediumColor}"
|
||||
x:Uid="ColorPickerFirst_Description"/>
|
||||
</TextBlock>
|
||||
</RadioButton.Content>
|
||||
</RadioButton>
|
||||
|
||||
<RadioButton IsChecked="{Binding ActivationOpensEditor, Mode=TwoWay}"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsEnabled="{Binding IsEnabled}"
|
||||
GroupName="ColorPickerActivationAction">
|
||||
<RadioButton.Content>
|
||||
<TextBlock TextWrapping="WrapWholeWords" LineHeight="20">
|
||||
<Run x:Uid="EditorFirst"/>
|
||||
<LineBreak/>
|
||||
<Run Foreground="{ThemeResource SystemBaseMediumColor}" x:Uid="EditorFirst_Description"/>
|
||||
</TextBlock>
|
||||
</RadioButton.Content>
|
||||
</RadioButton>
|
||||
|
||||
<RadioButton IsChecked="{Binding ActivationOpensColorPickerOnly, Mode=TwoWay}"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsEnabled="{Binding IsEnabled}"
|
||||
GroupName="ColorPickerActivationAction">
|
||||
<RadioButton.Content>
|
||||
<TextBlock TextWrapping="WrapWholeWords" LineHeight="20">
|
||||
<Run x:Uid="ColorPickerOnly"/>
|
||||
<LineBreak/>
|
||||
<Run x:Uid="ColorPickerOnly_Description" Foreground="{ThemeResource SystemBaseMediumColor}"/>
|
||||
</TextBlock>
|
||||
</RadioButton.Content>
|
||||
</RadioButton>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock x:Uid="ColorFormats"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<ComboBox x:Name="ColorPicker_ComboBox"
|
||||
x:Uid="ColorPicker_CopiedColorRepresentation"
|
||||
MinWidth="240"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HorizontalAlignment="Left"
|
||||
DisplayMemberPath="Value"
|
||||
IsEnabled="{Binding IsEnabled}"
|
||||
ItemsSource="{Binding SelectableColorRepresentations}"
|
||||
Loaded="ColorPicker_ComboBox_Loaded"
|
||||
SelectedValue="{Binding SelectedColorRepresentationValue, Mode=TwoWay}"
|
||||
SelectedValuePath="Key" />
|
||||
|
||||
<CheckBox x:Uid="ColorPicker_ShowColorName"
|
||||
IsChecked="{Binding ShowColorName, Mode=TwoWay}"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsEnabled="{Binding IsEnabled}"/>
|
||||
|
||||
<TextBlock Margin="{StaticResource MediumTopMargin}"
|
||||
x:Name="ColorFormatsListViewLabel"
|
||||
TextWrapping="WrapWholeWords"
|
||||
x:Uid="ColorPicker_ColorFormatsDescription"/>
|
||||
<ListView ItemsSource="{Binding ColorFormats, Mode=TwoWay}"
|
||||
AllowDrop="True"
|
||||
MaxWidth="466"
|
||||
AutomationProperties.LabeledBy="{Binding ElementName=ColorFormatsListViewLabel}"
|
||||
CanReorderItems="True"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="-12,6,0,0">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Width="466" Background="Transparent">
|
||||
<Interactivity:Interaction.Behaviors>
|
||||
<Core:EventTriggerBehavior EventName="PointerEntered">
|
||||
<Core:ChangePropertyAction TargetObject="{Binding ElementName=GripperIcon}" PropertyName="Visibility" Value="Visible" />
|
||||
</Core:EventTriggerBehavior>
|
||||
<Core:EventTriggerBehavior EventName="PointerExited">
|
||||
<Core:ChangePropertyAction TargetObject="{Binding ElementName=GripperIcon}" PropertyName="Visibility" Value="Collapsed" />
|
||||
</Core:EventTriggerBehavior>
|
||||
</Interactivity:Interaction.Behaviors>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock FontWeight="SemiBold"
|
||||
FontSize="16"
|
||||
Margin="0,8,0,0"
|
||||
Text="{Binding Name}"/>
|
||||
<TextBlock Foreground="{ThemeResource SystemAccentColor}"
|
||||
Text="{Binding Example}"
|
||||
Grid.Row="1"
|
||||
Margin="0,0,0,8"/>
|
||||
<ToggleSwitch IsOn="{Binding IsShown, Mode=TwoWay}"
|
||||
Grid.RowSpan="2"
|
||||
HorizontalAlignment="Right" />
|
||||
<TextBlock Text=""
|
||||
Visibility="Collapsed"
|
||||
x:Name="GripperIcon"
|
||||
VerticalAlignment="Center"
|
||||
Grid.RowSpan="2"
|
||||
FontSize="16"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,36,0"
|
||||
FontFamily="Segoe MDL2 Assets" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
|
||||
<!--
|
||||
Disabling this until we have a safer way to reset cursor as
|
||||
we can hit a state where the cursor doesn't reset
|
||||
|
||||
<CheckBox x:Uid="ColorPicker_ChangeCursor"
|
||||
IsChecked="{Binding ChangeCursor, Mode=TwoWay}"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsEnabled="{Binding IsEnabled}"/>
|
||||
-->
|
||||
</StackPanel>
|
||||
|
||||
<RelativePanel x:Name="SidePanel"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
<StackPanel x:Name="DescriptionPanel">
|
||||
<TextBlock x:Uid="About_ColorPicker"
|
||||
x:Name="AboutTitle"
|
||||
Grid.ColumnSpan="2"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
<TextBlock x:Uid="ColorPicker_Description"
|
||||
TextWrapping="Wrap"
|
||||
Grid.Row="1" />
|
||||
</StackPanel>
|
||||
|
||||
<Border x:Name="AboutImage"
|
||||
CornerRadius="4"
|
||||
Grid.Row="2"
|
||||
MaxWidth="240"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopBottomMargin}"
|
||||
RelativePanel.Below="DescriptionPanel">
|
||||
<Image x:Uid="ColorPicker_Image" Source="ms-appx:///Assets/Modules/ColorPicker.png" />
|
||||
</Border>
|
||||
<StackPanel x:Name="LinksPanel"
|
||||
Margin="0,1,0,0"
|
||||
RelativePanel.Below="AboutImage"
|
||||
Orientation="Vertical" >
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_ColorPicker">
|
||||
<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}" />
|
||||
|
||||
<HyperlinkButton Margin="0,-3,0,0"
|
||||
NavigateUri="https://github.com/martinchrzan/ColorPicker/">
|
||||
<TextBlock Text="Martin Chrzan's Color Picker" TextWrapping="Wrap" />
|
||||
</HyperlinkButton>
|
||||
|
||||
<HyperlinkButton Margin="0,-3,0,0"
|
||||
NavigateUri="https://medium.com/@Niels9001/a-fluent-color-meter-for-powertoys-20407ededf0c">
|
||||
<TextBlock Text="Niels Laute's UX concept" TextWrapping="Wrap" />
|
||||
</HyperlinkButton>
|
||||
|
||||
</StackPanel>
|
||||
</RelativePanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,52 @@
|
||||
// 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.IO.Abstractions;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
public sealed partial class ColorPickerPage : Page
|
||||
{
|
||||
public ColorPickerViewModel ViewModel { get; set; }
|
||||
|
||||
public ColorPickerPage()
|
||||
{
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ViewModel = new ColorPickerViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event is called when the <see cref="ComboBox"/> is completely loaded, inclusive the ItemSource
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender of this event</param>
|
||||
/// <param name="e">The arguments of this event</param>
|
||||
private void ColorPicker_ComboBox_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
/**
|
||||
* UWP hack
|
||||
* because UWP load the bound ItemSource of the ComboBox asynchronous,
|
||||
* so after InitializeComponent() the ItemSource is still empty and can't automatically select a entry.
|
||||
* Selection via SelectedItem and SelectedValue is still not working too
|
||||
*/
|
||||
var index = 0;
|
||||
|
||||
foreach (var item in ViewModel.SelectableColorRepresentations)
|
||||
{
|
||||
if (item.Key == ViewModel.SelectedColorRepresentationValue)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
ColorPicker_ComboBox.SelectedIndex = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,347 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.FancyZonesPage"
|
||||
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:viewModel="using:Microsoft.PowerToys.Settings.UI.ViewModels"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
xmlns:CustomControls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters"
|
||||
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
|
||||
xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
|
||||
<Page.Resources>
|
||||
<converters:StringFormatConverter x:Key="StringFormatConverter"/>
|
||||
</Page.Resources>
|
||||
|
||||
<Grid x:Name="MainView" RowSpacing="{StaticResource DefaultRowSpacing}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="LayoutVisualStates">
|
||||
<VisualState x:Name="WideLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource WideLayoutMinWidth}" />
|
||||
</VisualState.StateTriggers>
|
||||
</VisualState>
|
||||
<VisualState x:Name="SmallLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource SmallLayoutMinWidth}" />
|
||||
<AdaptiveTrigger MinWindowWidth="0" />
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="SidePanel.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="SidePanel.Width" Value="Auto"/>
|
||||
<Setter Target="FZView.(Grid.Row)" Value="1" />
|
||||
<Setter Target="LinksPanel.(RelativePanel.RightOf)" Value="AboutImage"/>
|
||||
<Setter Target="LinksPanel.(RelativePanel.AlignTopWith)" Value="AboutImage"/>
|
||||
<Setter Target="AboutImage.Margin" Value="0,12,12,0"/>
|
||||
<Setter Target="AboutTitle.Visibility" Value="Collapsed" />
|
||||
</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 x:Name="FZView" Orientation="Vertical">
|
||||
<ToggleSwitch x:Name="FancyZones_EnableToggleControl_HeaderText"
|
||||
x:Uid="FancyZones_EnableToggleControl_HeaderText"
|
||||
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}"/>
|
||||
|
||||
<TextBlock x:Uid="FancyZones_Editor_GroupSettings"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<Button Margin="{StaticResource SmallTopMargin}"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
Command = "{x:Bind ViewModel.LaunchEditorEventHandler}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
AutomationProperties.LabeledBy="{Binding ElementName=FancyZones_LaunchEditorButtonControl}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Viewbox Height="14" Width="14" Margin="-1,1,0,0">
|
||||
<PathIcon Data="M45,48H25.5V45H45V25.5H25.5v-3H45V3H25.5V0H48V48ZM22.5,48H3V45H22.5V3H3V0H25.5V48ZM0,48V0H3V48Z"/>
|
||||
</Viewbox>
|
||||
<TextBlock Margin="8,0,0,0"
|
||||
Name="FancyZones_LaunchEditorButtonControl"
|
||||
x:Uid="FancyZones_LaunchEditorButtonControl"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<CustomControls:HotkeySettingsControl
|
||||
x:Uid="FancyZones_HotkeyEditorControl"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HotkeySettings="{x:Bind Path=ViewModel.EditorHotkey, Mode=TwoWay}"
|
||||
Keys="Win, Ctrl, Alt, Shift"
|
||||
Enabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
HorizontalAlignment="Left"
|
||||
MinWidth="240"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<CheckBox x:Uid="FancyZones_UseCursorPosEditorStartupScreen"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.UseCursorPosEditorStartupScreen}"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
|
||||
|
||||
<TextBlock x:Uid="FancyZones_ZoneBehavior_GroupSettings"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<CheckBox x:Uid="FancyZones_ShiftDragCheckBoxControl_Header"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.ShiftDrag}"
|
||||
Margin="{StaticResource XSmallTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
/>
|
||||
|
||||
<CheckBox x:Uid="FancyZones_MouseDragCheckBoxControl_Header"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.MouseSwitch}"
|
||||
Margin="{StaticResource XSmallTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
/>
|
||||
|
||||
<CheckBox x:Uid="FancyZones_ShowZonesOnAllMonitorsCheckBoxControl"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.ShowOnAllMonitors}"
|
||||
Margin="{StaticResource XSmallTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
|
||||
|
||||
<CheckBox x:Uid="FancyZones_SpanZonesAcrossMonitorsCheckBoxControl"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.SpanZonesAcrossMonitors}"
|
||||
Margin="{StaticResource XSmallTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
|
||||
|
||||
|
||||
<TextBlock x:Uid="FancyZones_WindowBehavior_GroupSettings"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<CheckBox x:Uid="FancyZones_OverrideSnapHotkeysCheckBoxControl"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.OverrideSnapHotkeys}"
|
||||
Margin="{StaticResource XSmallTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
|
||||
|
||||
<CheckBox x:Uid="FancyZones_MoveWindowsBasedOnPositionCheckBoxControl"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.MoveWindowsBasedOnPosition}"
|
||||
Margin="24,8,0,0"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SnapHotkeysCategoryEnabled}"/>
|
||||
|
||||
<CheckBox x:Uid="FancyZones_MoveWindowsAcrossAllMonitorsCheckBoxControl"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.MoveWindowsAcrossMonitors}"
|
||||
Margin="24,8,0,0"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SnapHotkeysCategoryEnabled}"/>
|
||||
|
||||
<CheckBox x:Uid="FancyZones_DisplayChangeMoveWindowsCheckBoxControl"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.DisplayChangeMoveWindows}"
|
||||
Margin="{StaticResource XSmallTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
/>
|
||||
|
||||
<CheckBox x:Uid="FancyZones_ZoneSetChangeMoveWindows"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.ZoneSetChangeMoveWindows}"
|
||||
Margin="{StaticResource XSmallTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
|
||||
|
||||
<CheckBox x:Uid="FancyZones_AppLastZoneMoveWindows"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.AppLastZoneMoveWindows}"
|
||||
Margin="{StaticResource XSmallTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
|
||||
|
||||
<CheckBox x:Uid="FancyZones_OpenWindowOnActiveMonitor"
|
||||
IsChecked="{ Binding Mode=TwoWay, Path=OpenWindowOnActiveMonitor}"
|
||||
Margin="{StaticResource XSmallTopMargin}"
|
||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"/>
|
||||
|
||||
<CheckBox x:Uid="FancyZones_RestoreSize"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.RestoreSize}"
|
||||
Margin="{StaticResource XSmallTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
|
||||
|
||||
|
||||
<TextBlock x:Uid="Appearance_GroupSettings"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<CheckBox x:Uid="FancyZones_MakeDraggedWindowTransparentCheckBoxControl"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.MakeDraggedWindowsTransparent}"
|
||||
Margin="{StaticResource XSmallTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="{StaticResource SmallTopMargin}" Spacing="12">
|
||||
<Slider x:Uid="FancyZones_HighlightOpacity"
|
||||
Minimum="0"
|
||||
Maximum="100"
|
||||
MinWidth="240"
|
||||
IsThumbToolTipEnabled="False"
|
||||
Value="{x:Bind Mode=TwoWay, Path=ViewModel.HighlightOpacity}"
|
||||
HorizontalAlignment="Left"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
|
||||
|
||||
<TextBlock
|
||||
Text="{x:Bind Mode=OneWay, Path=ViewModel.HighlightOpacity, Converter={StaticResource StringFormatConverter}, ConverterParameter=' {0}%' }"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
FontSize="16"
|
||||
Margin="0,16,0,0"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Name="FancyZones_ZoneHighlightColor"
|
||||
x:Uid="FancyZones_ZoneHighlightColor"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<muxc:DropDownButton Margin="0,4,0,0"
|
||||
IsEnabled="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}"
|
||||
Padding="4,4,8,4"
|
||||
AutomationProperties.LabeledBy="{Binding ElementName=FancyZones_ZoneHighlightColor}">
|
||||
<Border Width="48"
|
||||
CornerRadius="2"
|
||||
Height="24">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="{x:Bind Path=ViewModel.ZoneHighlightColor, Mode=TwoWay}"/>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<muxc:DropDownButton.Flyout>
|
||||
<Flyout>
|
||||
<muxc:ColorPicker x:Name="FancyZones_ZoneHighlightColorPicker"
|
||||
Margin="0,6,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
IsColorSliderVisible="True"
|
||||
IsColorChannelTextInputVisible="True"
|
||||
IsHexInputVisible="True"
|
||||
IsAlphaEnabled="False"
|
||||
IsAlphaSliderVisible="False"
|
||||
IsAlphaTextInputVisible="False"
|
||||
Color="{x:Bind Path=ViewModel.ZoneHighlightColor, Mode=TwoWay}"
|
||||
/>
|
||||
</Flyout>
|
||||
</muxc:DropDownButton.Flyout>
|
||||
|
||||
</muxc:DropDownButton>
|
||||
|
||||
<TextBlock Name="FancyZones_InActiveColor"
|
||||
x:Uid="FancyZones_InActiveColor"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<muxc:DropDownButton Margin="0,4,0,0"
|
||||
IsEnabled="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}"
|
||||
Padding="4,4,8,4"
|
||||
AutomationProperties.LabeledBy="{Binding ElementName=FancyZones_InActiveColor}">
|
||||
<Border Width="48" CornerRadius="2" Height="24">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="{x:Bind Path=ViewModel.ZoneInActiveColor, Mode=TwoWay}"/>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<muxc:DropDownButton.Flyout>
|
||||
<Flyout>
|
||||
<muxc:ColorPicker x:Name="FancyZones_InActiveColorPicker"
|
||||
Margin="0,6,0,0"
|
||||
IsColorSliderVisible="True"
|
||||
IsColorChannelTextInputVisible="True"
|
||||
IsHexInputVisible="True"
|
||||
IsAlphaEnabled="False"
|
||||
IsAlphaSliderVisible="False"
|
||||
IsAlphaTextInputVisible="False"
|
||||
Color="{x:Bind Path=ViewModel.ZoneInActiveColor, Mode=TwoWay}"/>
|
||||
</Flyout>
|
||||
</muxc:DropDownButton.Flyout>
|
||||
</muxc:DropDownButton>
|
||||
|
||||
<TextBlock Name="FancyZones_BorderColor"
|
||||
x:Uid="FancyZones_BorderColor"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<muxc:DropDownButton Margin="0,4,0,0"
|
||||
IsEnabled="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}"
|
||||
Padding="4,4,8,4"
|
||||
AutomationProperties.LabeledBy="{Binding ElementName=FancyZones_BorderColor}">
|
||||
<Border Width="48" CornerRadius="2" Height="24">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="{x:Bind Path=ViewModel.ZoneBorderColor, Mode=TwoWay}"/>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<muxc:DropDownButton.Flyout>
|
||||
<Flyout>
|
||||
<muxc:ColorPicker x:Name="FancyZones_BorderColorPicker"
|
||||
Margin="0,6,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
IsColorSliderVisible="True"
|
||||
IsColorChannelTextInputVisible="True"
|
||||
IsHexInputVisible="True"
|
||||
IsAlphaEnabled="False"
|
||||
IsAlphaSliderVisible="False"
|
||||
IsAlphaTextInputVisible="False"
|
||||
Color="{x:Bind Path=ViewModel.ZoneBorderColor, Mode=TwoWay}"
|
||||
IsEnabled="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}"/>
|
||||
</Flyout>
|
||||
</muxc:DropDownButton.Flyout>
|
||||
</muxc:DropDownButton>
|
||||
|
||||
<TextBlock x:Uid="FancyZones_ExcludeApps"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<TextBox x:Uid="FancyZones_ExcludeApps_TextBoxControl"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Text="{x:Bind Mode=TwoWay, Path=ViewModel.ExcludedApps}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
ScrollViewer.VerticalScrollBarVisibility ="Visible"
|
||||
ScrollViewer.VerticalScrollMode="Enabled"
|
||||
ScrollViewer.IsVerticalRailEnabled="True"
|
||||
TextWrapping="Wrap"
|
||||
AcceptsReturn="True"
|
||||
HorizontalAlignment="Left"
|
||||
MinWidth="240"
|
||||
MinHeight="160" />
|
||||
</StackPanel>
|
||||
|
||||
<RelativePanel x:Name="SidePanel"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
<StackPanel x:Name="DescriptionPanel">
|
||||
<TextBlock x:Uid="About_FancyZones"
|
||||
x:Name="AboutTitle" Grid.ColumnSpan="2"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
<TextBlock x:Uid="FancyZones_Description"
|
||||
TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
|
||||
<Border x:Name="AboutImage"
|
||||
CornerRadius="4"
|
||||
Grid.Row="2"
|
||||
MaxWidth="240"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopBottomMargin}"
|
||||
RelativePanel.Below="DescriptionPanel">
|
||||
<Image x:Uid="Fancyzones_Image" Source="ms-appx:///Assets/Modules/FancyZones.png" />
|
||||
</Border>
|
||||
|
||||
<StackPanel x:Name="LinksPanel"
|
||||
Margin="0,1,0,0"
|
||||
RelativePanel.Below="AboutImage"
|
||||
Orientation="Vertical" >
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_FancyZones">
|
||||
<TextBlock x:Uid="Module_overview" />
|
||||
</HyperlinkButton>
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/powerToysGiveFeedback">
|
||||
<TextBlock x:Uid="Give_Feedback" />
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
</RelativePanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,24 @@
|
||||
// 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.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
public sealed partial class FancyZonesPage : Page
|
||||
{
|
||||
private FancyZonesViewModel ViewModel { get; set; }
|
||||
|
||||
public FancyZonesPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ViewModel = new FancyZonesViewModel(SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), SettingsRepository<FancyZonesSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.GeneralPage"
|
||||
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:converters="using:Microsoft.Toolkit.Uwp.UI.Converters"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
|
||||
<Page.Resources>
|
||||
<converters:BoolToObjectConverter x:Key="BoolToVisibilityConverter" TrueValue="Collapsed" FalseValue="Visible"/>
|
||||
<converters:BoolToVisibilityConverter x:Key="VisibleIfTrueConverter"/>
|
||||
</Page.Resources>
|
||||
|
||||
<Grid RowSpacing="{StaticResource DefaultRowSpacing}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="LayoutVisualStates">
|
||||
<VisualState x:Name="WideLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource WideLayoutMinWidth}" />
|
||||
</VisualState.StateTriggers>
|
||||
</VisualState>
|
||||
<VisualState x:Name="SmallLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource SmallLayoutMinWidth}" />
|
||||
<AdaptiveTrigger MinWindowWidth="0" />
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="SidePanel.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="SidePanel.Width" Value="Auto"/>
|
||||
<Setter Target="GeneralView.(Grid.Row)" Value="1" />
|
||||
<Setter Target="LinksPanel.(RelativePanel.RightOf)" Value="AboutImage"/>
|
||||
<Setter Target="LinksPanel.(RelativePanel.AlignTopWith)" Value="AboutImage"/>
|
||||
<Setter Target="AboutImage.Margin" Value="0,12,12,0"/>
|
||||
<Setter Target="AboutTitle.Visibility" Value="Collapsed" />
|
||||
</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="GeneralView">
|
||||
<TextBlock x:Uid="Admin_Mode"
|
||||
FontWeight="SemiBold"
|
||||
TextWrapping="Wrap"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
Style="{StaticResource SubtitleTextBlockStyle}"/>
|
||||
|
||||
<TextBlock Text="{x:Bind Mode=TwoWay, Path=ViewModel.RunningAsText}"
|
||||
TextWrapping="Wrap"
|
||||
Margin="{StaticResource SmallTopMargin}"/>
|
||||
|
||||
<Button x:Uid="GeneralPage_RestartAsAdmin_Button"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
Command = "{Binding RestartElevatedButtonEventHandler}"
|
||||
IsEnabled="{Binding Mode=TwoWay, Path=IsAdminButtonEnabled}"
|
||||
/>
|
||||
|
||||
<TextBlock x:Uid="General_RunAsAdminRequired"
|
||||
Foreground="{ThemeResource SystemControlErrorTextForegroundBrush}"
|
||||
TextWrapping="Wrap"
|
||||
Visibility="{Binding Mode=TwoWay, Path=IsElevated, Converter={StaticResource BoolToVisibilityConverter}}"
|
||||
Margin="0,24,0,-8" />
|
||||
|
||||
<ToggleSwitch Margin="{StaticResource SmallTopMargin}"
|
||||
x:Uid="GeneralSettings_AlwaysRunAsAdminText"
|
||||
IsEnabled="{Binding Mode=TwoWay, Path=IsElevated}"
|
||||
IsOn="{Binding Mode=TwoWay, Path=RunElevated}"/>
|
||||
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/powertoysDetectedElevatedHelp">
|
||||
<TextBlock x:Uid="GeneralPage_ToggleSwitch_AlwaysRunElevated_Link" TextWrapping="Wrap" />
|
||||
</HyperlinkButton>
|
||||
|
||||
|
||||
<TextBlock x:Uid="ShortcutGuide_Appearance_Behavior"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"/>
|
||||
|
||||
<!-- Replaced the Radiobuttons parent control with a StackPanel to mitigate the Tab and Arrow key related keyboard navigation issues due to XAML Islands
|
||||
Tracking issue in the winui repository - https://github.com/microsoft/microsoft-ui-xaml/issues/3156 -->
|
||||
<TextBlock x:Name="RadioButtons_Name_Theme"
|
||||
x:Uid="ColorModeHeader"
|
||||
Margin="{StaticResource SmallTopMargin}"/>
|
||||
<StackPanel AutomationProperties.LabeledBy="{Binding ElementName=RadioButtons_Name_Theme}">
|
||||
<RadioButton x:Uid="Radio_Theme_Dark"
|
||||
IsChecked="{ Binding Mode=TwoWay, Path=IsDarkThemeRadioButtonChecked}"/>
|
||||
|
||||
<RadioButton x:Uid="Radio_Theme_Light"
|
||||
IsChecked="{ Binding Mode=TwoWay, Path=IsLightThemeRadioButtonChecked}"/>
|
||||
|
||||
<RadioButton x:Uid="Radio_Theme_Default"
|
||||
IsChecked="{ Binding Mode=TwoWay, Path=IsSystemThemeRadioButtonChecked}"/>
|
||||
<HyperlinkButton NavigateUri="ms-settings:colors">
|
||||
<TextBlock x:Uid="Windows_Color_Settings" />
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
|
||||
<ToggleSwitch x:Uid="GeneralPage_ToggleSwitch_RunAtStartUp"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsOn="{Binding Mode=TwoWay, Path=Startup}"/>
|
||||
|
||||
|
||||
|
||||
<TextBlock x:Uid="General_Updates"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"/>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
AutomationProperties.LabeledBy="{Binding ElementName=General_Version}">
|
||||
<TextBlock x:Name="General_Version" x:Uid="General_Version" />
|
||||
<HyperlinkButton NavigateUri="https://github.com/microsoft/PowerToys/releases" Margin="4,-6,0,0">
|
||||
<TextBlock Text="{x:Bind ViewModel.PowerToysVersion }" />
|
||||
</HyperlinkButton>
|
||||
<TextBlock Text="{x:Bind ViewModel.LatestAvailableVersion, Mode=OneWay}"
|
||||
Foreground="{ThemeResource SystemControlErrorTextForegroundBrush}"
|
||||
Margin="16,0,0,0" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<Button x:Uid="GeneralPage_CheckForUpdates"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
Foreground="White"
|
||||
Command="{Binding CheckForUpdatesEventHandler}"
|
||||
/>
|
||||
|
||||
<ToggleSwitch x:Uid="GeneralPage_ToggleSwitch_AutoDownloadUpdates"
|
||||
Margin="{StaticResource MediumTopMargin}"
|
||||
Visibility="{Binding Mode=TwoWay, Path=IsAdmin, Converter={StaticResource VisibleIfTrueConverter}}"
|
||||
IsOn="{Binding Mode=TwoWay, Path=AutoDownloadUpdates}"/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<RelativePanel x:Name="SidePanel"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
<StackPanel x:Name="DescriptionPanel">
|
||||
<TextBlock x:Uid="GeneralPage_AboutPowerToysHeader"
|
||||
x:Name="AboutTitle"
|
||||
Grid.ColumnSpan="2"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
<TextBlock x:Uid="About_PowerToys" TextWrapping="Wrap" />
|
||||
<TextBlock x:Uid="MadeWithOssLove" TextWrapping="Wrap" Margin="0, 10, 0, 0" />
|
||||
</StackPanel>
|
||||
|
||||
<Border x:Name="AboutImage"
|
||||
CornerRadius="4"
|
||||
Grid.Row="2"
|
||||
MaxWidth="240"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopBottomMargin}"
|
||||
RelativePanel.Below="DescriptionPanel">
|
||||
<Image x:Uid="PowerToys_Icon" Source="ms-appx:///Assets/Modules/PT.png"/>
|
||||
</Border>
|
||||
<StackPanel x:Name="LinksPanel"
|
||||
Margin="0,1,0,0"
|
||||
RelativePanel.Below="AboutImage"
|
||||
Orientation="Vertical" >
|
||||
|
||||
<HyperlinkButton NavigateUri="https://github.com/microsoft/PowerToys/">
|
||||
<TextBlock x:Uid="General_Repository"/>
|
||||
</HyperlinkButton>
|
||||
|
||||
<HyperlinkButton NavigateUri="https://github.com/microsoft/PowerToys/issues">
|
||||
<TextBlock x:Uid="GeneralPage_ReportAbug"/>
|
||||
</HyperlinkButton>
|
||||
|
||||
<HyperlinkButton NavigateUri="https://github.com/microsoft/PowerToys/issues">
|
||||
<TextBlock x:Uid="GeneralPage_RequestAFeature_URL"/>
|
||||
</HyperlinkButton>
|
||||
|
||||
<HyperlinkButton NavigateUri=" http://go.microsoft.com/fwlink/?LinkId=521839">
|
||||
<TextBlock x:Uid="GeneralPage_PrivacyStatement_URL"/>
|
||||
</HyperlinkButton>
|
||||
|
||||
<HyperlinkButton NavigateUri="https://github.com/microsoft/PowerToys/blob/master/NOTICE.md">
|
||||
<TextBlock x:Uid="OpenSource_Notice"/>
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
</RelativePanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,106 @@
|
||||
// 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.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
|
||||
using Windows.ApplicationModel.Resources;
|
||||
using Windows.Data.Json;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// General Settings Page.
|
||||
/// </summary>
|
||||
public sealed partial class GeneralPage : Page
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets view model.
|
||||
/// </summary>
|
||||
public GeneralViewModel ViewModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GeneralPage"/> class.
|
||||
/// General Settings page constructor.
|
||||
/// </summary>
|
||||
[SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Exceptions from the IPC response handler should be caught and logged.")]
|
||||
public GeneralPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Load string resources
|
||||
ResourceLoader loader = ResourceLoader.GetForViewIndependentUse();
|
||||
var settingsUtils = new SettingsUtils();
|
||||
|
||||
ViewModel = new GeneralViewModel(
|
||||
SettingsRepository<GeneralSettings>.GetInstance(settingsUtils),
|
||||
loader.GetString("GeneralSettings_RunningAsAdminText"),
|
||||
loader.GetString("GeneralSettings_RunningAsUserText"),
|
||||
ShellPage.IsElevated,
|
||||
ShellPage.IsUserAnAdmin,
|
||||
UpdateUIThemeMethod,
|
||||
ShellPage.SendDefaultIPCMessage,
|
||||
ShellPage.SendRestartAdminIPCMessage,
|
||||
ShellPage.SendCheckForUpdatesIPCMessage);
|
||||
|
||||
ShellPage.ShellHandler.IPCResponseHandleList.Add((JsonObject json) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
string version = json.GetNamedString("version");
|
||||
bool isLatest = json.GetNamedBoolean("isVersionLatest");
|
||||
|
||||
var str = string.Empty;
|
||||
if (isLatest)
|
||||
{
|
||||
str = ResourceLoader.GetForCurrentView().GetString("GeneralSettings_VersionIsLatest");
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(version))
|
||||
{
|
||||
str = ResourceLoader.GetForCurrentView().GetString("GeneralSettings_NewVersionIsAvailable");
|
||||
if (!string.IsNullOrEmpty(str))
|
||||
{
|
||||
str += ": " + version;
|
||||
}
|
||||
}
|
||||
|
||||
// Using CurrentCulture since this is user-facing
|
||||
ViewModel.LatestAvailableVersion = string.Format(CultureInfo.CurrentCulture, str);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError("Exception encountered when reading the version.", e);
|
||||
}
|
||||
});
|
||||
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
public static int UpdateUIThemeMethod(string themeName)
|
||||
{
|
||||
switch (themeName?.ToUpperInvariant())
|
||||
{
|
||||
case "LIGHT":
|
||||
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Light;
|
||||
break;
|
||||
case "DARK":
|
||||
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Dark;
|
||||
break;
|
||||
case "SYSTEM":
|
||||
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Default;
|
||||
break;
|
||||
default:
|
||||
Logger.LogError($"Unexpected theme name: {themeName}");
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,383 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.ImageResizerPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:CustomControls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:models="using:Microsoft.PowerToys.Settings.UI.Library"
|
||||
xmlns:viewModels="using:Microsoft.PowerToys.Settings.UI.Library.ViewModels"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
|
||||
<Page.Resources>
|
||||
<!--<viewModel:ImageResizerViewModel x:Key="ViewModel"/>-->
|
||||
</Page.Resources>
|
||||
|
||||
<Grid RowSpacing="{StaticResource DefaultRowSpacing}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="LayoutVisualStates">
|
||||
<VisualState x:Name="WideLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource WideLayoutMinWidth}" />
|
||||
</VisualState.StateTriggers>
|
||||
</VisualState>
|
||||
<VisualState x:Name="SmallLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource SmallLayoutMinWidth}" />
|
||||
<AdaptiveTrigger MinWindowWidth="0" />
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="SidePanel.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="SidePanel.Width" Value="Auto"/>
|
||||
<Setter Target="ImageResizerView.(Grid.Row)" Value="1" />
|
||||
<Setter Target="LinksPanel.(RelativePanel.RightOf)" Value="AboutImage"/>
|
||||
<Setter Target="LinksPanel.(RelativePanel.AlignTopWith)" Value="AboutImage"/>
|
||||
<Setter Target="AboutImage.Margin" Value="0,12,12,0"/>
|
||||
<Setter Target="AboutTitle.Visibility" Value="Collapsed" />
|
||||
</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="ImageResizerView">
|
||||
|
||||
<ToggleSwitch x:Uid="ImageResizer_EnableToggle"
|
||||
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}"/>
|
||||
|
||||
<TextBlock x:Uid="ImageResizer_CustomSizes"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<ListView x:Name="ImagesSizesListView"
|
||||
x:Uid="ImagesSizesListView"
|
||||
ItemsSource="{x:Bind ViewModel.Sizes, Mode=TwoWay}"
|
||||
Padding="0"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
SelectionMode="None"
|
||||
ScrollViewer.HorizontalScrollMode="Enabled"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
ScrollViewer.IsHorizontalRailEnabled="True"
|
||||
ContainerContentChanging="ImagesSizesListView_ContainerContentChanging">
|
||||
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
|
||||
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
|
||||
<Setter Property="Background" Value="{ThemeResource ListViewItemBackground}"/>
|
||||
<Setter Property="Foreground" Value="{ThemeResource ListViewItemForeground}"/>
|
||||
<Setter Property="TabNavigation" Value="Local"/>
|
||||
<Setter Property="IsHoldingEnabled" Value="True"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="MinWidth" Value="{ThemeResource ListViewItemMinWidth}"/>
|
||||
<Setter Property="MinHeight" Value="0"/>
|
||||
<Setter Property="AllowDrop" Value="False"/>
|
||||
<Setter Property="UseSystemFocusVisuals" Value="True"/>
|
||||
<Setter Property="FocusVisualMargin" Value="0"/>
|
||||
<Setter Property="FocusVisualPrimaryBrush" Value="{ThemeResource ListViewItemFocusVisualPrimaryBrush}"/>
|
||||
<Setter Property="FocusVisualPrimaryThickness" Value="2"/>
|
||||
<Setter Property="FocusVisualSecondaryBrush" Value="{ThemeResource ListViewItemFocusVisualSecondaryBrush}"/>
|
||||
<Setter Property="FocusVisualSecondaryThickness" Value="1"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListViewItem">
|
||||
<ListViewItemPresenter
|
||||
CheckBrush="{ThemeResource ListViewItemCheckBrush}"
|
||||
ContentMargin="{TemplateBinding Padding}"
|
||||
CheckMode="{ThemeResource ListViewItemCheckMode}"
|
||||
ContentTransitions="{TemplateBinding ContentTransitions}"
|
||||
CheckBoxBrush="{ThemeResource ListViewItemCheckBoxBrush}"
|
||||
DragForeground="{ThemeResource ListViewItemDragForeground}"
|
||||
DragOpacity="{ThemeResource ListViewItemDragThemeOpacity}"
|
||||
DragBackground="{ThemeResource ListViewItemDragBackground}"
|
||||
DisabledOpacity="{ThemeResource ListViewItemDisabledThemeOpacity}"
|
||||
FocusVisualPrimaryBrush="{TemplateBinding FocusVisualPrimaryBrush}"
|
||||
FocusVisualSecondaryThickness="{TemplateBinding FocusVisualSecondaryThickness}"
|
||||
FocusBorderBrush="{ThemeResource ListViewItemFocusBorderBrush}"
|
||||
FocusVisualMargin="{TemplateBinding FocusVisualMargin}"
|
||||
FocusVisualPrimaryThickness="{TemplateBinding FocusVisualPrimaryThickness}"
|
||||
FocusSecondaryBorderBrush="{ThemeResource ListViewItemFocusSecondaryBorderBrush}"
|
||||
FocusVisualSecondaryBrush="{TemplateBinding FocusVisualSecondaryBrush}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Control.IsTemplateFocusTarget="True"
|
||||
PointerOverForeground="{ThemeResource ListViewItemForegroundPointerOver}"
|
||||
PressedBackground="{ThemeResource ListViewItemBackgroundPressed}"
|
||||
PlaceholderBackground="{ThemeResource ListViewItemPlaceholderBackground}"
|
||||
PointerOverBackground="{ThemeResource ListViewItemBackgroundPointerOver}" ReorderHintOffset="{ThemeResource ListViewItemReorderHintThemeOffset}"
|
||||
SelectedPressedBackground="{ThemeResource ListViewItemBackgroundSelectedPressed}"
|
||||
SelectionCheckMarkVisualEnabled="{ThemeResource ListViewItemSelectionCheckMarkVisualEnabled}"
|
||||
SelectedForeground="{ThemeResource ListViewItemForegroundSelected}"
|
||||
SelectedPointerOverBackground="{ThemeResource ListViewItemBackgroundSelectedPointerOver}"
|
||||
SelectedBackground="{ThemeResource ListViewItemBackgroundSelected}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ListView.ItemContainerStyle>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate x:Name="SingleLineDataTemplate" x:DataType="models:ImageSize" >
|
||||
<StackPanel Name="ImageResizer_Configurations" x:Uid="ImageResizer_Configurations" Orientation="Horizontal" Padding="0" Spacing="4">
|
||||
<TextBox Name="ImageResizer_Name"
|
||||
x:Uid="ImageResizer_Name"
|
||||
Text="{x:Bind Path=Name, Mode=TwoWay}"
|
||||
Width="90"
|
||||
VerticalAlignment="Center"
|
||||
Margin="{StaticResource SmallTopMargin}"/>
|
||||
|
||||
<ComboBox Name="ImageResizer_Fit_Property"
|
||||
x:Uid="ImageResizer_Fit_Property"
|
||||
SelectedIndex="{x:Bind Path=Fit, Mode=TwoWay}"
|
||||
Width="90"
|
||||
VerticalAlignment="Center"
|
||||
Margin="{StaticResource SmallTopMargin}">
|
||||
<ComboBoxItem x:Uid="ImageResizer_Sizes_Fit_Fill" />
|
||||
<ComboBoxItem x:Uid="ImageResizer_Sizes_Fit_Fit" />
|
||||
<ComboBoxItem x:Uid="ImageResizer_Sizes_Fit_Stretch" />
|
||||
</ComboBox>
|
||||
|
||||
<muxc:NumberBox Name="ImageResizer_Width_Property"
|
||||
x:Uid="ImageResizer_Width_Property"
|
||||
Value="{x:Bind Path=Width, Mode=TwoWay}"
|
||||
MinWidth="68"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
VerticalAlignment="Center"
|
||||
Margin="{StaticResource SmallTopMargin}"/>
|
||||
|
||||
<TextBlock Name="ImageResizer_Times_Symbol"
|
||||
x:Uid="ImageResizer_Times_Symbol"
|
||||
Text=""
|
||||
FontFamily="Segoe MDL2 Assets"
|
||||
TextAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Opacity="{x:Bind Path=ExtraBoxOpacity, Mode=OneWay}"
|
||||
Width="25"/>
|
||||
|
||||
<muxc:NumberBox Name="ImageResizer_Height_Property"
|
||||
x:Uid="ImageResizer_Height_Property"
|
||||
Value="{x:Bind Path=Height, Mode=TwoWay}"
|
||||
MinWidth="68"
|
||||
VerticalAlignment="Center"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
Opacity="{x:Bind Path=ExtraBoxOpacity, Mode=OneWay}"
|
||||
IsEnabled="{x:Bind Path=EnableEtraBoxes, Mode=OneWay}"
|
||||
Margin="{StaticResource SmallTopMargin}"/>
|
||||
|
||||
<ComboBox Name="ImageResizer_Size_Property"
|
||||
x:Uid="ImageResizer_Size_Property"
|
||||
SelectedIndex="{Binding Path=Unit, Mode=TwoWay}"
|
||||
MinWidth="120"
|
||||
VerticalAlignment="Center"
|
||||
Margin="{StaticResource SmallTopMargin}">
|
||||
<ComboBoxItem x:Uid="ImageResizer_Sizes_Units_CM" />
|
||||
<ComboBoxItem x:Uid="ImageResizer_Sizes_Units_Inches" />
|
||||
<ComboBoxItem x:Uid="ImageResizer_Sizes_Units_Percent" />
|
||||
<ComboBoxItem x:Uid="ImageResizer_Sizes_Units_Pixels" />
|
||||
</ComboBox>
|
||||
<Button x:Name="RemoveButton"
|
||||
x:Uid="RemoveButton"
|
||||
Background="Transparent"
|
||||
FontFamily="Segoe MDL2 Assets"
|
||||
Width="34"
|
||||
Content=""
|
||||
VerticalAlignment="Center"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
UseLayoutRounding="False"
|
||||
Click="DeleteCustomSize"
|
||||
CommandParameter="{Binding Id}">
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Uid="RemoveTooltip"/>
|
||||
</ToolTipService.ToolTip>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<AppBarButton Icon="Add"
|
||||
x:Name="AddSizeButton"
|
||||
Style="{StaticResource AddItemAppBarButtonStyle}"
|
||||
IsEnabled="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}"
|
||||
x:Uid="ImageResizer_AddSizeButton"
|
||||
Click="AddSizeButton_Click"
|
||||
Margin="{StaticResource AddItemButtonMargin}"
|
||||
|
||||
/>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock x:Uid="Encoding"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<ComboBox x:Uid="ImageResizer_FallBackEncoderText"
|
||||
SelectedIndex="{x:Bind Path=ViewModel.Encoder, Mode=TwoWay}"
|
||||
MinWidth="240"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
|
||||
<ComboBoxItem x:Uid="ImageResizer_FallbackEncoder_PNG" />
|
||||
<ComboBoxItem x:Uid="ImageResizer_FallbackEncoder_BMP" />
|
||||
<ComboBoxItem x:Uid="ImageResizer_FallbackEncoder_JPEG" />
|
||||
<ComboBoxItem x:Uid="ImageResizer_FallbackEncoder_TIFF" />
|
||||
<ComboBoxItem x:Uid="ImageResizer_FallbackEncoder_WMPhoto" />
|
||||
<ComboBoxItem x:Uid="ImageResizer_FallbackEncoder_GIF" />
|
||||
</ComboBox>
|
||||
|
||||
<muxc:NumberBox x:Uid="ImageResizer_Encoding"
|
||||
Minimum="0"
|
||||
Maximum="100"
|
||||
Value="{x:Bind Mode=TwoWay, Path=ViewModel.JPEGQualityLevel}"
|
||||
MinWidth="240"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
HorizontalAlignment="Left"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
AutomationProperties.LabeledBy="{Binding ElementName=ImageResizer_Encoding}"
|
||||
/>
|
||||
|
||||
<ComboBox x:Uid="ImageResizer_PNGInterlacing"
|
||||
SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.PngInterlaceOption}"
|
||||
MinWidth="240"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
|
||||
<ComboBoxItem x:Uid="Default"/>
|
||||
<ComboBoxItem x:Uid="On"/>
|
||||
<ComboBoxItem x:Uid="Off"/>
|
||||
</ComboBox>
|
||||
|
||||
<ComboBox x:Uid="ImageResizer_TIFFCompression"
|
||||
SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.TiffCompressOption}"
|
||||
MinWidth="240"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
|
||||
<ComboBoxItem x:Uid="ImageResizer_ENCODER_TIFF_Default"/>
|
||||
<ComboBoxItem x:Uid="ImageResizer_ENCODER_TIFF_None"/>
|
||||
<ComboBoxItem x:Uid="ImageResizer_ENCODER_TIFF_CCITT3"/>
|
||||
<ComboBoxItem x:Uid="ImageResizer_ENCODER_TIFF_CCITT4"/>
|
||||
<ComboBoxItem x:Uid="ImageResizer_ENCODER_TIFF_LZW"/>
|
||||
<ComboBoxItem x:Uid="ImageResizer_ENCODER_TIFF_RLE"/>
|
||||
<ComboBoxItem x:Uid="ImageResizer_ENCODER_TIFF_Zip"/>
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock x:Uid="File"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<TextBox Text="{x:Bind Mode=TwoWay, Path=ViewModel.FileName}"
|
||||
HorizontalAlignment="Left"
|
||||
MinWidth="240"
|
||||
x:Uid="ImageResizer_FilenameFormatPlaceholder"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
AutomationProperties.LabeledBy="{Binding ElementName=ImageResizer_FilenameFormatHeader}"
|
||||
AutomationProperties.HelpText="{Binding ElementName=FileFormatTextBlock, Path=Text}"
|
||||
>
|
||||
<TextBox.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Name="ImageResizer_FilenameFormatHeader"
|
||||
x:Uid="ImageResizer_FilenameFormatHeader"
|
||||
Margin="0,0,0,0"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
<TextBlock Text=""
|
||||
FontFamily="Segoe MDL2 Assets"
|
||||
Margin="4,4,0,0"/>
|
||||
</StackPanel>
|
||||
</TextBox.Header>
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Name="FileFormatTextBlock">
|
||||
<Run x:Uid="ImageResizer_FileFormatDescription"/>
|
||||
<LineBreak/>
|
||||
<LineBreak/>
|
||||
<Run Text="%1" FontWeight="Bold" />
|
||||
<Run Text=" - "/>
|
||||
<Run x:Uid="ImageResizer_Formatting_Filename" />
|
||||
<LineBreak/>
|
||||
<Run Text="%2" FontWeight="Bold" />
|
||||
<Run Text=" - "/>
|
||||
<Run x:Uid="ImageResizer_Formatting_Sizename"/>
|
||||
<LineBreak/>
|
||||
<Run Text="%3" FontWeight="Bold" />
|
||||
<Run Text=" - "/>
|
||||
<Run x:Uid="ImageResizer_Formatting_SelectedWidth"/>
|
||||
<LineBreak/>
|
||||
<Run Text="%4" FontWeight="Bold" />
|
||||
<Run Text=" - "/>
|
||||
<Run x:Uid="ImageResizer_Formatting_SelectedHeight"/>
|
||||
<LineBreak/>
|
||||
<Run Text="%5" FontWeight="Bold" />
|
||||
<Run Text=" - "/>
|
||||
<Run x:Uid="ImageResizer_Formatting_ActualWidth"/>
|
||||
<LineBreak/>
|
||||
<Run Text="%6" FontWeight="Bold" />
|
||||
<Run Text=" - "/>
|
||||
<Run x:Uid="ImageResizer_Formatting_ActualHeight"/>
|
||||
</TextBlock>
|
||||
</ToolTipService.ToolTip>
|
||||
</TextBox>
|
||||
|
||||
<CheckBox x:Uid="ImageResizer_UseOriginalDate"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.KeepDateModified}"/>
|
||||
</StackPanel>
|
||||
|
||||
<RelativePanel x:Name="SidePanel"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
<StackPanel x:Name="DescriptionPanel">
|
||||
<TextBlock x:Uid="About_ImageResizer" x:Name="AboutTitle" Grid.ColumnSpan="2"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
<TextBlock x:Uid="ImageResizer_Description"
|
||||
TextWrapping="Wrap"
|
||||
Grid.Row="1" />
|
||||
</StackPanel>
|
||||
|
||||
<Border x:Name="AboutImage"
|
||||
CornerRadius="4"
|
||||
Grid.Row="2"
|
||||
MaxWidth="240"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopBottomMargin}"
|
||||
RelativePanel.Below="DescriptionPanel">
|
||||
<Image x:Uid="ImageResizer_Image" Source="ms-appx:///Assets/Modules/ImageResizer.png" />
|
||||
</Border>
|
||||
|
||||
<StackPanel x:Name="LinksPanel"
|
||||
Margin="0,1,0,0"
|
||||
RelativePanel.Below="AboutImage"
|
||||
Orientation="Vertical" >
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_ImageResizer">
|
||||
<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}"/>
|
||||
|
||||
<HyperlinkButton Margin="0,-3,0,0"
|
||||
NavigateUri="https://github.com/bricelam/ImageResizer/">
|
||||
<TextBlock Text="Brice Lambson's ImageResizer" TextWrapping="Wrap" />
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
</RelativePanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,72 @@
|
||||
// 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.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
public sealed partial class ImageResizerPage : Page
|
||||
{
|
||||
public ImageResizerViewModel ViewModel { get; set; }
|
||||
|
||||
public ImageResizerPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ViewModel = new ImageResizerViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
public void DeleteCustomSize(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Button deleteRowButton = (Button)sender;
|
||||
|
||||
// Using InvariantCulture since this is internal and expected to be numerical
|
||||
bool success = int.TryParse(deleteRowButton?.CommandParameter?.ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture, out int rowNum);
|
||||
if (success)
|
||||
{
|
||||
ViewModel.DeleteImageSize(rowNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogError("Failed to delete custom image size.");
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "JSON exceptions from saving new settings should be caught and logged.")]
|
||||
private void AddSizeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ViewModel.AddRow();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Exception encountered when adding a new image size.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "Params are required for event handler signature requirements.")]
|
||||
private void ImagesSizesListView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
|
||||
{
|
||||
if (ViewModel.IsListViewFocusRequested)
|
||||
{
|
||||
// Set focus to the last item in the ListView
|
||||
int size = ImagesSizesListView.Items.Count;
|
||||
((ListViewItem)ImagesSizesListView.ContainerFromIndex(size - 1)).Focus(FocusState.Programmatic);
|
||||
|
||||
// Reset the focus requested flag
|
||||
ViewModel.IsListViewFocusRequested = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,376 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.KeyboardManagerPage"
|
||||
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:viewModel="using:Microsoft.PowerToys.Settings.UI.Library.ViewModels"
|
||||
xmlns:extensions="using:Microsoft.Toolkit.Uwp.UI.Extensions"
|
||||
xmlns:CustomControls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:Lib="using:Microsoft.PowerToys.Settings.UI.Library"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
|
||||
<Page.Resources>
|
||||
<local:VisibleIfNotEmpty x:Key="visibleIfNotEmptyConverter" />
|
||||
<Style TargetType="ListViewItem" x:Name="KeysListViewContainerStyle">
|
||||
<Setter Property="IsTabStop" Value="False"/>
|
||||
</Style>
|
||||
<DataTemplate x:Name="KeysListViewTemplate" x:DataType="Lib:KeysDataModel">
|
||||
<StackPanel
|
||||
Name="KeyboardManager_RemappedKeysListItem"
|
||||
x:Uid="KeyboardManager_RemappedKeysListItem"
|
||||
Orientation="Horizontal"
|
||||
Height="56">
|
||||
<ItemsControl
|
||||
ItemsSource="{x:Bind GetMappedOriginalKeys()}"
|
||||
IsTabStop="False">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border
|
||||
Background="{ThemeResource SystemBaseLowColor}"
|
||||
CornerRadius="4"
|
||||
Padding="14,0,14,0"
|
||||
Margin="5,0,5,0"
|
||||
Height="36"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left">
|
||||
<TextBlock
|
||||
FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"
|
||||
TextAlignment="Center"
|
||||
FontSize="12"
|
||||
Text="{Binding}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<FontIcon Glyph=""
|
||||
Grid.Column="1"
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Margin="5,0,5,0"/>
|
||||
<ItemsControl
|
||||
Name="KeyboardManager_RemappedTo"
|
||||
x:Uid="KeyboardManager_RemappedTo"
|
||||
ItemsSource="{x:Bind GetMappedNewRemapKeys()}"
|
||||
Grid.Column="2"
|
||||
IsTabStop="False">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border
|
||||
Background="{ThemeResource SystemAccentColor}"
|
||||
CornerRadius="4"
|
||||
Padding="14,0,14,0"
|
||||
Margin="5,0,5,0"
|
||||
Height="36"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left">
|
||||
<TextBlock
|
||||
FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"
|
||||
TextAlignment="Center"
|
||||
Foreground="White"
|
||||
FontSize="12"
|
||||
Text="{Binding}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Name="ShortcutKeysListViewTemplate" x:DataType="Lib:AppSpecificKeysDataModel">
|
||||
<StackPanel
|
||||
Name="KeyboardManager_RemappedShortcutsListItem"
|
||||
x:Uid="KeyboardManager_RemappedShortcutsListItem"
|
||||
Orientation="Horizontal"
|
||||
Height="56">
|
||||
<ItemsControl
|
||||
ItemsSource="{x:Bind GetMappedOriginalKeys()}"
|
||||
IsTabStop="False">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border
|
||||
Background="{ThemeResource SystemBaseLowColor}"
|
||||
CornerRadius="4"
|
||||
Padding="14,0,14,0"
|
||||
Margin="5,0,5,0"
|
||||
Height="36"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left">
|
||||
<TextBlock
|
||||
FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"
|
||||
TextAlignment="Center"
|
||||
FontSize="12"
|
||||
Text="{Binding}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<FontIcon Glyph=""
|
||||
Grid.Column="1"
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Margin="5,0,5,0"/>
|
||||
<ItemsControl Name="KeyboardManager_ShortcutRemappedTo"
|
||||
x:Uid="KeyboardManager_ShortcutRemappedTo"
|
||||
ItemsSource="{x:Bind GetMappedNewRemapKeys()}"
|
||||
Grid.Column="2"
|
||||
IsTabStop="False">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border
|
||||
Background="{ThemeResource SystemAccentColor}"
|
||||
CornerRadius="4"
|
||||
Padding="14,0,14,0"
|
||||
Margin="5,0,5,0"
|
||||
Height="36"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left">
|
||||
<TextBlock
|
||||
FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"
|
||||
TextAlignment="Center"
|
||||
Foreground="White"
|
||||
FontSize="12"
|
||||
Text="{Binding}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<FontIcon Glyph=""
|
||||
Grid.Column="3"
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Margin="5,0,5,0"/>
|
||||
<Border
|
||||
Name="KeyboardManager_TargetApp"
|
||||
x:Uid="KeyboardManager_TargetApp"
|
||||
Background="{ThemeResource SystemAccentColor}"
|
||||
Grid.Column="4"
|
||||
CornerRadius="4"
|
||||
Padding="14,0,14,0"
|
||||
Margin="5,0,5,0"
|
||||
Height="36"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left">
|
||||
<TextBlock
|
||||
FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"
|
||||
TextAlignment="Center"
|
||||
Foreground="White"
|
||||
FontSize="12"
|
||||
Text="{x:Bind TargetApp}" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</Page.Resources>
|
||||
|
||||
<Grid RowSpacing="{StaticResource DefaultRowSpacing}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="LayoutVisualStates">
|
||||
<VisualState x:Name="WideLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource WideLayoutMinWidth}" />
|
||||
</VisualState.StateTriggers>
|
||||
</VisualState>
|
||||
<VisualState x:Name="SmallLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource SmallLayoutMinWidth}" />
|
||||
<AdaptiveTrigger MinWindowWidth="0" />
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="SidePanel.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="SidePanel.Width" Value="Auto"/>
|
||||
<Setter Target="KeyboardManagerView.(Grid.Row)" Value="1" />
|
||||
<Setter Target="LinksPanel.(RelativePanel.RightOf)" Value="AboutImage"/>
|
||||
<Setter Target="LinksPanel.(RelativePanel.AlignTopWith)" Value="AboutImage"/>
|
||||
<Setter Target="AboutImage.Margin" Value="0,12,12,0"/>
|
||||
<Setter Target="AboutTitle.Visibility" Value="Collapsed" />
|
||||
</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="KeyboardManagerView">
|
||||
<ToggleSwitch x:Uid="KeyboardManager_EnableToggle"
|
||||
IsOn="{x:Bind Path=ViewModel.Enabled, Mode=TwoWay}"/>
|
||||
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/powerToysCannotRemapKeys" Margin="{StaticResource XSmallTopMargin}">
|
||||
<TextBlock x:Uid="KBM_KeysCannotBeRemapped" />
|
||||
</HyperlinkButton>
|
||||
|
||||
<!--<TextBlock x:Uid="KeyboardManager_ConfigHeader"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"/>
|
||||
|
||||
<TextBlock x:Uid="KeyboardManager_ProfileDescription"
|
||||
Margin="{StaticResource SmallTopMargin}"/>
|
||||
|
||||
<ComboBox SelectedIndex="1" MinWidth="160"
|
||||
Margin="{StaticResource SmallTopMargin}">
|
||||
<ComboBoxItem Content="Config-1"/>
|
||||
<ComboBoxItem Content="Config-2"/>
|
||||
<ComboBoxItem Content="Config-3"/>
|
||||
</ComboBox>-->
|
||||
|
||||
<TextBlock x:Uid="KeyboardManager_RemapKeyboardHeader"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.Enabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<TextBlock x:Uid="KeyboardManager_RemapKeyboardSubtitle"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.Enabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<Button x:Uid="KeyboardManager_RemapKeyboardButton"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
Command="{Binding Path=RemapKeyboardCommand}"
|
||||
IsEnabled="{x:Bind Path=ViewModel.Enabled, Mode=OneWay}"/>
|
||||
|
||||
<ListView x:Name="RemapKeysList"
|
||||
x:Uid="RemapKeysList"
|
||||
extensions:ListViewExtensions.AlternateColor="{ThemeResource SystemControlBackgroundListLowBrush}"
|
||||
ItemsSource="{x:Bind Path=ViewModel.RemapKeys, Mode=OneWay}"
|
||||
ItemTemplate="{StaticResource KeysListViewTemplate}"
|
||||
BorderBrush="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
MinWidth="350"
|
||||
MaxHeight="200"
|
||||
Margin="{StaticResource SmallTopBottomMargin}"
|
||||
HorizontalAlignment="Left"
|
||||
SelectionMode="None"
|
||||
IsSwipeEnabled="False"
|
||||
Visibility="{x:Bind Path=ViewModel.RemapKeys, Mode=OneWay, Converter={StaticResource visibleIfNotEmptyConverter}}"
|
||||
IsEnabled="{x:Bind Path=ViewModel.Enabled, Mode=OneWay}"
|
||||
ItemContainerStyle="{StaticResource KeysListViewContainerStyle}"
|
||||
/>
|
||||
|
||||
<!--<AppBarButton x:Uid="KeyboardManager_RemapKeyboardButton"
|
||||
Icon="Add"
|
||||
Width="370"
|
||||
Style="{StaticResource AddItemAppBarButtonStyle}"
|
||||
Command="{Binding Path=RemapKeyboardCommand}"
|
||||
Margin="{StaticResource AddItemButtonMargin}"
|
||||
HorizontalAlignment="Left"
|
||||
IsEnabled="{x:Bind Path=ViewModel.Enabled, Mode=OneWay}"/>-->
|
||||
|
||||
<TextBlock x:Uid="KeyboardManager_RemapShortcutsHeader"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.Enabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<TextBlock x:Uid="KeyboardManager_RemapShortcutsSubtitle"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
TextWrapping="WrapWholeWords"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.Enabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<Button x:Uid="KeyboardManager_RemapShortcutsButton"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
Command="{Binding Path=EditShortcutCommand}"
|
||||
IsEnabled="{x:Bind Path=ViewModel.Enabled, Mode=OneWay}"
|
||||
/>
|
||||
|
||||
<ListView x:Name="RemapShortcutsList"
|
||||
x:Uid="RemapShortcutsList"
|
||||
extensions:ListViewExtensions.AlternateColor="{ThemeResource SystemControlBackgroundListLowBrush}"
|
||||
ItemsSource="{x:Bind Path=ViewModel.RemapShortcuts, Mode=OneWay}"
|
||||
ItemTemplate="{StaticResource ShortcutKeysListViewTemplate}"
|
||||
BorderBrush="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
MinWidth="350"
|
||||
MaxHeight="200"
|
||||
Margin="{StaticResource SmallTopBottomMargin}"
|
||||
HorizontalAlignment="Left"
|
||||
SelectionMode="None"
|
||||
IsSwipeEnabled="False"
|
||||
Visibility="{x:Bind Path=ViewModel.RemapShortcuts, Mode=OneWay, Converter={StaticResource visibleIfNotEmptyConverter}}"
|
||||
IsEnabled="{x:Bind Path=ViewModel.Enabled, Mode=OneWay}"
|
||||
ScrollViewer.HorizontalScrollMode="Enabled"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Visible"
|
||||
ScrollViewer.IsHorizontalRailEnabled="True"
|
||||
ItemContainerStyle="{StaticResource KeysListViewContainerStyle}"
|
||||
/>
|
||||
|
||||
<!--<AppBarButton x:Uid="KeyboardManager_RemapShortcutsButton"
|
||||
Icon="Add"
|
||||
Width="370"
|
||||
Style="{StaticResource AddItemAppBarButtonStyle}"
|
||||
Command="{Binding Path=EditShortcutCommand}"
|
||||
IsEnabled="{x:Bind Path=ViewModel.Enabled, Mode=OneWay}"
|
||||
Margin="{StaticResource AddItemButtonMargin}"
|
||||
HorizontalAlignment="Left"
|
||||
/>-->
|
||||
</StackPanel>
|
||||
|
||||
<RelativePanel x:Name="SidePanel"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
<StackPanel x:Name="DescriptionPanel">
|
||||
<TextBlock x:Uid="About_KeyboardManager"
|
||||
x:Name="AboutTitle"
|
||||
Grid.ColumnSpan="2"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
<TextBlock x:Uid="KeyboardManager_Description"
|
||||
TextWrapping="Wrap"
|
||||
Grid.Row="1" />
|
||||
</StackPanel>
|
||||
|
||||
<Border x:Name="AboutImage"
|
||||
CornerRadius="4"
|
||||
Grid.Row="2"
|
||||
MaxWidth="240"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopBottomMargin}"
|
||||
RelativePanel.Below="DescriptionPanel">
|
||||
<Image x:Uid="KeyboardManager_Image" Source="ms-appx:///Assets/Modules/KBM.png" />
|
||||
</Border>
|
||||
|
||||
<StackPanel x:Name="LinksPanel"
|
||||
Margin="0,1,0,0"
|
||||
RelativePanel.Below="AboutImage"
|
||||
Orientation="Vertical" >
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_KeyboardManager">
|
||||
<TextBlock x:Uid="Module_overview" />
|
||||
</HyperlinkButton>
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/powerToysGiveFeedback">
|
||||
<TextBlock x:Uid="Give_Feedback" />
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
</RelativePanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,91 @@
|
||||
// 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.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO.Abstractions;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
|
||||
using Windows.System;
|
||||
using Windows.UI.Core;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class KeyboardManagerPage : Page
|
||||
{
|
||||
private const string PowerToyName = "Keyboard Manager";
|
||||
|
||||
private readonly CoreDispatcher dispatcher;
|
||||
private readonly IFileSystemWatcher watcher;
|
||||
|
||||
public KeyboardManagerViewModel ViewModel { get; }
|
||||
|
||||
public KeyboardManagerPage()
|
||||
{
|
||||
dispatcher = Window.Current.Dispatcher;
|
||||
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ViewModel = new KeyboardManagerViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, FilterRemapKeysList);
|
||||
|
||||
watcher = Helper.GetFileWatcher(
|
||||
PowerToyName,
|
||||
ViewModel.Settings.Properties.ActiveConfiguration.Value + ".json",
|
||||
OnConfigFileUpdate);
|
||||
|
||||
InitializeComponent();
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private async void OnConfigFileUpdate()
|
||||
{
|
||||
// Note: FileSystemWatcher raise notification multiple times for single update operation.
|
||||
// Todo: Handle duplicate events either by somehow suppress them or re-read the configuration everytime since we will be updating the UI only if something is changed.
|
||||
if (ViewModel.LoadProfile())
|
||||
{
|
||||
await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
|
||||
{
|
||||
ViewModel.NotifyFileChanged();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static void CombineRemappings(List<KeysDataModel> remapKeysList, uint leftKey, uint rightKey, uint combinedKey)
|
||||
{
|
||||
// Using InvariantCulture for keys as they are internally represented as numerical values
|
||||
KeysDataModel firstRemap = remapKeysList.Find(x => uint.Parse(x.OriginalKeys, CultureInfo.InvariantCulture) == leftKey);
|
||||
KeysDataModel secondRemap = remapKeysList.Find(x => uint.Parse(x.OriginalKeys, CultureInfo.InvariantCulture) == rightKey);
|
||||
if (firstRemap != null && secondRemap != null)
|
||||
{
|
||||
if (firstRemap.NewRemapKeys == secondRemap.NewRemapKeys)
|
||||
{
|
||||
KeysDataModel combinedRemap = new KeysDataModel
|
||||
{
|
||||
OriginalKeys = combinedKey.ToString(CultureInfo.InvariantCulture),
|
||||
NewRemapKeys = firstRemap.NewRemapKeys,
|
||||
};
|
||||
remapKeysList.Insert(remapKeysList.IndexOf(firstRemap), combinedRemap);
|
||||
remapKeysList.Remove(firstRemap);
|
||||
remapKeysList.Remove(secondRemap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int FilterRemapKeysList(List<KeysDataModel> remapKeysList)
|
||||
{
|
||||
CombineRemappings(remapKeysList, (uint)VirtualKey.LeftControl, (uint)VirtualKey.RightControl, (uint)VirtualKey.Control);
|
||||
CombineRemappings(remapKeysList, (uint)VirtualKey.LeftMenu, (uint)VirtualKey.RightMenu, (uint)VirtualKey.Menu);
|
||||
CombineRemappings(remapKeysList, (uint)VirtualKey.LeftShift, (uint)VirtualKey.RightShift, (uint)VirtualKey.Shift);
|
||||
CombineRemappings(remapKeysList, (uint)VirtualKey.LeftWindows, (uint)VirtualKey.RightWindows, Helper.VirtualKeyWindows);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
<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}"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
|
||||
<Grid RowSpacing="{StaticResource DefaultRowSpacing}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="LayoutVisualStates">
|
||||
<VisualState x:Name="WideLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource WideLayoutMinWidth}" />
|
||||
</VisualState.StateTriggers>
|
||||
</VisualState>
|
||||
<VisualState x:Name="SmallLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource SmallLayoutMinWidth}" />
|
||||
<AdaptiveTrigger MinWindowWidth="0" />
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="SidePanel.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="SidePanel.Width" Value="Auto"/>
|
||||
<Setter Target="LauncherView.(Grid.Row)" Value="1" />
|
||||
<Setter Target="LinksPanel.(RelativePanel.RightOf)" Value="AboutImage"/>
|
||||
<Setter Target="LinksPanel.(RelativePanel.AlignTopWith)" Value="AboutImage"/>
|
||||
<Setter Target="AboutImage.Margin" Value="0,12,12,0"/>
|
||||
<Setter Target="AboutTitle.Visibility" Value="Collapsed" />
|
||||
</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="Shortcuts"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<CustomControls:HotkeySettingsControl x:Uid="PowerLauncher_OpenPowerLauncher"
|
||||
HorizontalAlignment="Left"
|
||||
MinWidth="240"
|
||||
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"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
HotkeySettings="{Binding Path=ViewModel.OpenFileLocation, Mode=TwoWay}"
|
||||
IsEnabled="False"
|
||||
/>
|
||||
<Custom:HotkeySettingsControl x:Uid="PowerLauncher_CopyPathLocation"
|
||||
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"
|
||||
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"
|
||||
/>-->
|
||||
|
||||
<muxc:NumberBox x:Uid="PowerLauncher_MaximumNumberOfResults"
|
||||
Value="{Binding Mode=TwoWay, Path=MaximumNumberOfResults}"
|
||||
MinWidth="240"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
HorizontalAlignment="Left"
|
||||
Minimum="1"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
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}"
|
||||
/>
|
||||
<TextBlock x:Uid="Appearance_GroupSettings"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher, Converter={StaticResource ModuleEnabledToForegroundConverter}}" />
|
||||
|
||||
<!-- We cannot navigate to all the radio buttons using the arrow keys because of an XYNavigation issue in the RadioButtons control.
|
||||
The screen reader does not read the heading when we tab into a radio button, even though the LabeledBy automation property is set.
|
||||
Link to the issue in the winui repository - https://github.com/microsoft/microsoft-ui-xaml/issues/3156 -->
|
||||
<TextBlock x:Uid="ColorModeHeader"
|
||||
x:Name="RadioButtons_Name_Theme"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher, Converter={StaticResource ModuleEnabledToForegroundConverter}}" />
|
||||
<StackPanel AutomationProperties.LabeledBy="{Binding ElementName=RadioButtons_Name_Theme}">
|
||||
<RadioButton x:Uid="Radio_Theme_Dark"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
IsChecked="{Binding Mode=TwoWay, Path=IsDarkThemeRadioButtonChecked}" />
|
||||
|
||||
<RadioButton x:Uid="Radio_Theme_Light"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
IsChecked="{Binding Mode=TwoWay, Path=IsLightThemeRadioButtonChecked}" />
|
||||
|
||||
<RadioButton x:Uid="Radio_Theme_Default"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
|
||||
IsChecked="{Binding Mode=TwoWay, Path=IsSystemThemeRadioButtonChecked}" />
|
||||
<HyperlinkButton NavigateUri="ms-settings:colors">
|
||||
<TextBlock x:Uid="Windows_Color_Settings" />
|
||||
</HyperlinkButton>
|
||||
</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"
|
||||
MaxWidth="240"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopBottomMargin}"
|
||||
RelativePanel.Below="DescriptionPanel">
|
||||
<Image x:Uid="PowerToys_Run_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>
|
||||
</Page>
|
||||
@@ -0,0 +1,75 @@
|
||||
// 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.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
public sealed partial class PowerLauncherPage : Page
|
||||
{
|
||||
public PowerLauncherViewModel ViewModel { get; set; }
|
||||
|
||||
private readonly ObservableCollection<Tuple<string, string>> searchResultPreferencesOptions;
|
||||
private readonly ObservableCollection<Tuple<string, string>> searchTypePreferencesOptions;
|
||||
|
||||
public PowerLauncherPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ViewModel = new PowerLauncherViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, (int)Windows.System.VirtualKey.Space);
|
||||
DataContext = ViewModel;
|
||||
|
||||
var loader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();
|
||||
|
||||
searchResultPreferencesOptions = new ObservableCollection<Tuple<string, string>>();
|
||||
searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_AlphabeticalOrder"), "alphabetical_order"));
|
||||
searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_MostRecentlyUsed"), "most_recently_used"));
|
||||
searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_RunningProcessesOpenApplications"), "running_processes_open_applications"));
|
||||
|
||||
searchTypePreferencesOptions = new ObservableCollection<Tuple<string, string>>();
|
||||
searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ApplicationName"), "application_name"));
|
||||
searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_StringInApplication"), "string_in_application"));
|
||||
searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ExecutableName"), "executable_name"));
|
||||
}
|
||||
|
||||
/*
|
||||
public Tuple<string, string> SelectedSearchResultPreference
|
||||
{
|
||||
get
|
||||
{
|
||||
return searchResultPreferencesOptions.First(item => item.Item2 == ViewModel.SearchResultPreference);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (ViewModel.SearchResultPreference != value.Item2)
|
||||
{
|
||||
ViewModel.SearchResultPreference = value.Item2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Tuple<string, string> SelectedSearchTypePreference
|
||||
{
|
||||
get
|
||||
{
|
||||
return searchTypePreferencesOptions.First(item => item.Item2 == ViewModel.SearchTypePreference);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (ViewModel.SearchTypePreference != value.Item2)
|
||||
{
|
||||
ViewModel.SearchTypePreference = value.Item2;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerPreviewPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
|
||||
<Page.Resources>
|
||||
<converters:BoolToObjectConverter x:Key="BoolToVisibilityConverter" TrueValue="Collapsed" FalseValue="Visible"/>
|
||||
</Page.Resources>
|
||||
|
||||
<Grid RowSpacing="{StaticResource DefaultRowSpacing}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="LayoutVisualStates">
|
||||
<VisualState x:Name="WideLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource WideLayoutMinWidth}" />
|
||||
</VisualState.StateTriggers>
|
||||
</VisualState>
|
||||
<VisualState x:Name="SmallLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource SmallLayoutMinWidth}" />
|
||||
<AdaptiveTrigger MinWindowWidth="0" />
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="SidePanel.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="SidePanel.Width" Value="Auto"/>
|
||||
<Setter Target="PowerPreviewView.(Grid.Row)" Value="1" />
|
||||
<Setter Target="LinksPanel.(RelativePanel.RightOf)" Value="AboutImage"/>
|
||||
<Setter Target="LinksPanel.(RelativePanel.AlignTopWith)" Value="AboutImage"/>
|
||||
<Setter Target="AboutImage.Margin" Value="0,12,12,0"/>
|
||||
<Setter Target="AboutTitle.Visibility" Value="Collapsed" />
|
||||
</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="PowerPreviewView">
|
||||
<TextBlock x:Uid="FileExplorerPreview_RunAsAdminRequired"
|
||||
Foreground="{ThemeResource SystemControlErrorTextForegroundBrush}"
|
||||
Visibility="{Binding Mode=OneWay, Path=IsElevated, Converter={StaticResource BoolToVisibilityConverter}}"
|
||||
Margin="{StaticResource SmallBottomMargin}"
|
||||
TextWrapping="Wrap"/>
|
||||
|
||||
<TextBlock x:Uid="FileExplorerPreview_AffectsAllUsers"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsElevated, Converter={StaticResource ModuleEnabledToForegroundConverter}}"
|
||||
Margin="{StaticResource SmallBottomMargin}"
|
||||
FontWeight="SemiBold"
|
||||
TextWrapping="Wrap"/>
|
||||
|
||||
<TextBlock x:Uid="FileExplorerPreview_PreviewPane_GroupSettings"
|
||||
Style="{StaticResource SettingsGroupTitleStyleAsHeader}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsElevated, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<ToggleSwitch x:Uid="FileExplorerPreview_ToggleSwitch_Preview_SVG"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsOn="{Binding Mode=TwoWay, Path=SVGRenderIsEnabled}"
|
||||
IsEnabled="{Binding Mode=OneWay, Path=IsElevated}"/>
|
||||
|
||||
<ToggleSwitch x:Uid="FileExplorerPreview_ToggleSwitch_Preview_MD"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsOn="{Binding Mode=TwoWay, Path=MDRenderIsEnabled}"
|
||||
IsEnabled="{Binding Mode=OneWay, Path=IsElevated}"/>
|
||||
|
||||
<TextBlock x:Uid="FileExplorerPreview_IconThumbnail_GroupSettings"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsElevated, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<TextBlock x:Uid="FileExplorerPreview_RebootRequired"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsElevated, Converter={StaticResource ModuleEnabledToForegroundConverter}}"
|
||||
Margin="{StaticResource SmallTopBottomMargin}"
|
||||
FontWeight="SemiBold"
|
||||
TextWrapping="Wrap"/>
|
||||
|
||||
<ToggleSwitch x:Uid="FileExplorerPreview_ToggleSwitch_SVG_Thumbnail"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsOn="{Binding Mode=TwoWay, Path=SVGThumbnailIsEnabled}"
|
||||
IsEnabled="{Binding Mode=OneWay, Path=IsElevated}"/>
|
||||
</StackPanel>
|
||||
<RelativePanel x:Name="SidePanel"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
<StackPanel x:Name="DescriptionPanel">
|
||||
<TextBlock x:Uid="About_FileExplorerPreview" x:Name="AboutTitle" Grid.ColumnSpan="2"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
<TextBlock x:Uid="FileExplorerPreview_Description"
|
||||
TextWrapping="Wrap"
|
||||
Grid.Row="1" />
|
||||
</StackPanel>
|
||||
|
||||
<Border x:Name="AboutImage"
|
||||
CornerRadius="4"
|
||||
Grid.Row="2"
|
||||
MaxWidth="240"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopBottomMargin}"
|
||||
RelativePanel.Below="DescriptionPanel">
|
||||
<Image x:Uid="FileExplorerPreview_Image" Source="https://aka.ms/powerToysPowerPreviewSettingImage" />
|
||||
</Border>
|
||||
|
||||
<StackPanel x:Name="LinksPanel"
|
||||
Margin="0,1,0,0"
|
||||
RelativePanel.Below="AboutImage"
|
||||
Orientation="Vertical" >
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_FileExplorerAddOns">
|
||||
<TextBlock x:Uid="Module_overview" />
|
||||
</HyperlinkButton>
|
||||
<HyperlinkButton NavigateUri="https://github.com/microsoft/PowerToys/issues">
|
||||
<TextBlock x:Uid="Give_Feedback" />
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
</RelativePanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,27 @@
|
||||
// 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.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class PowerPreviewPage : Page
|
||||
{
|
||||
public PowerPreviewViewModel ViewModel { get; set; }
|
||||
|
||||
public PowerPreviewPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ViewModel = new PowerPreviewViewModel(SettingsRepository<PowerPreviewSettings>.GetInstance(settingsUtils), SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerRenamePage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:CustomControls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
|
||||
<Grid RowSpacing="{StaticResource DefaultRowSpacing}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="LayoutVisualStates">
|
||||
<VisualState x:Name="WideLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource WideLayoutMinWidth}" />
|
||||
</VisualState.StateTriggers>
|
||||
</VisualState>
|
||||
<VisualState x:Name="SmallLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource SmallLayoutMinWidth}" />
|
||||
<AdaptiveTrigger MinWindowWidth="0" />
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="SidePanel.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="SidePanel.Width" Value="Auto"/>
|
||||
<Setter Target="PowerRenameView.(Grid.Row)" Value="1" />
|
||||
<Setter Target="LinksPanel.(RelativePanel.RightOf)" Value="AboutImage"/>
|
||||
<Setter Target="LinksPanel.(RelativePanel.AlignTopWith)" Value="AboutImage"/>
|
||||
<Setter Target="AboutImage.Margin" Value="0,12,12,0"/>
|
||||
<Setter Target="AboutTitle.Visibility" Value="Collapsed" />
|
||||
</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="PowerRenameView">
|
||||
|
||||
<ToggleSwitch x:Uid="PowerRename_Toggle_Enable"
|
||||
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}"
|
||||
/>
|
||||
|
||||
<TextBlock x:Uid="PowerRename_ShellIntegration"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<ToggleSwitch x:Uid="PowerRename_Toggle_EnableOnContextMenu"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.EnabledOnContextMenu}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
/>
|
||||
|
||||
<ToggleSwitch x:Uid="PowerRename_Toggle_EnableOnExtendedContextMenu"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.EnabledOnContextExtendedMenu}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
/>
|
||||
|
||||
<TextBlock x:Uid="PowerRename_AutoCompleteHeader"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<CheckBox x:Uid="PowerRename_Toggle_AutoComplete"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.MRUEnabled}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
/>
|
||||
|
||||
<muxc:NumberBox x:Uid="PowerRename_Toggle_MaxDispListNum"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Value="{x:Bind Mode=TwoWay, Path=ViewModel.MaxDispListNum}"
|
||||
Minimum="0"
|
||||
Width="240"
|
||||
Maximum="20"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.GlobalAndMruEnabled}"/>
|
||||
|
||||
<CheckBox x:Uid="PowerRename_Toggle_RestoreFlagsOnLaunch"
|
||||
Margin="0, 17, 0, 0"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.RestoreFlagsOnLaunch}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
|
||||
|
||||
<TextBlock x:Uid="PowerRename_BehaviorHeader"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<CheckBox x:Uid="PowerRename_Toggle_UseBoostLib"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.UseBoostLib}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<RelativePanel x:Name="SidePanel"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
<StackPanel x:Name="DescriptionPanel">
|
||||
<TextBlock x:Uid="About_PowerRename" x:Name="AboutTitle" Grid.ColumnSpan="2"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
<TextBlock x:Uid="PowerRename_Description"
|
||||
TextWrapping="Wrap"
|
||||
Grid.Row="1" />
|
||||
</StackPanel>
|
||||
|
||||
<Border x:Name="AboutImage"
|
||||
CornerRadius="4"
|
||||
Grid.Row="2"
|
||||
MaxWidth="240"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopBottomMargin}"
|
||||
RelativePanel.Below="DescriptionPanel">
|
||||
<Image x:Uid="PowerRename_Image" Source="ms-appx:///Assets/Modules/PowerRename.png" />
|
||||
</Border>
|
||||
|
||||
<StackPanel x:Name="LinksPanel"
|
||||
Margin="0,1,0,0"
|
||||
RelativePanel.Below="AboutImage"
|
||||
Orientation="Vertical" >
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_PowerRename">
|
||||
<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 NavigateUri="https://github.com/chrdavis/SmartRename" Margin="0,-3,0,0">
|
||||
<TextBlock Text="Chris Davis's SmartRenamer" TextWrapping="Wrap" />
|
||||
</HyperlinkButton>
|
||||
|
||||
</StackPanel>
|
||||
</RelativePanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
public sealed partial class PowerRenamePage : Page
|
||||
{
|
||||
private PowerRenameViewModel ViewModel { get; set; }
|
||||
|
||||
public PowerRenamePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ViewModel = new PowerRenameViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
|
||||
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<UserControl
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.ShellPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:behaviors="using:Microsoft.PowerToys.Settings.UI.Behaviors"
|
||||
xmlns:winui="using:Microsoft.UI.Xaml.Controls"
|
||||
xmlns:helpers="using:Microsoft.PowerToys.Settings.UI.Helpers"
|
||||
xmlns:views="using:Microsoft.PowerToys.Settings.UI.Views"
|
||||
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
|
||||
xmlns:i="using:Microsoft.Xaml.Interactivity"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<i:Interaction.Behaviors>
|
||||
<ic:EventTriggerBehavior EventName="Loaded">
|
||||
<ic:InvokeCommandAction Command="{x:Bind ViewModel.LoadedCommand}" />
|
||||
</ic:EventTriggerBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
|
||||
<Grid>
|
||||
<winui:NavigationView
|
||||
x:Name="navigationView"
|
||||
IsBackButtonVisible="Collapsed"
|
||||
IsBackEnabled="{x:Bind ViewModel.IsBackEnabled, Mode=OneWay}"
|
||||
SelectedItem="{x:Bind ViewModel.Selected, Mode=OneWay}"
|
||||
IsSettingsVisible="False"
|
||||
OpenPaneLength="296"
|
||||
CompactModeThresholdWidth="0"
|
||||
Background="{ThemeResource SystemControlBackgroundAltHighBrush}">
|
||||
<winui:NavigationView.MenuItems>
|
||||
<winui:NavigationViewItem x:Uid="Shell_General" helpers:NavHelper.NavigateTo="views:GeneralPage" AutomationProperties.HeadingLevel="Level1">
|
||||
<winui:NavigationViewItem.Icon>
|
||||
<FontIcon Glyph=""/>
|
||||
</winui:NavigationViewItem.Icon>
|
||||
</winui:NavigationViewItem>
|
||||
|
||||
<winui:NavigationViewItem x:Uid="Shell_ColorPicker" helpers:NavHelper.NavigateTo="views:ColorPickerPage" AutomationProperties.HeadingLevel="Level1">
|
||||
<winui:NavigationViewItem.Icon>
|
||||
<FontIcon Glyph=""/>
|
||||
</winui:NavigationViewItem.Icon>
|
||||
</winui:NavigationViewItem>
|
||||
|
||||
<winui:NavigationViewItem x:Uid="Shell_FancyZones" helpers:NavHelper.NavigateTo="views:FancyZonesPage" AutomationProperties.HeadingLevel="Level1">
|
||||
<winui:NavigationViewItem.Icon>
|
||||
<PathIcon Data="M45,48H25.5V45H45V25.5H25.5v-3H45V3H25.5V0H48V48ZM22.5,48H3V45H22.5V3H3V0H25.5V48ZM0,48V0H3V48Z"/>
|
||||
</winui:NavigationViewItem.Icon>
|
||||
</winui:NavigationViewItem>
|
||||
|
||||
<winui:NavigationViewItem x:Uid="Shell_PowerPreview" helpers:NavHelper.NavigateTo="views:PowerPreviewPage" AutomationProperties.HeadingLevel="Level1">
|
||||
<winui:NavigationViewItem.Icon>
|
||||
<FontIcon Glyph=""/>
|
||||
</winui:NavigationViewItem.Icon>
|
||||
</winui:NavigationViewItem>
|
||||
|
||||
<winui:NavigationViewItem x:Uid="Shell_ImageResizer" helpers:NavHelper.NavigateTo="views:ImageResizerPage" AutomationProperties.HeadingLevel="Level1">
|
||||
<winui:NavigationViewItem.Icon>
|
||||
<PathIcon Data="M0 768h1408v1152H0V768zm128 1024h870l-582-581-288 288v293zm1152 0v-102l-224-223-101 101 223 224h102zM128 896v421l288-287 448 447 192-191 224 224V896H128zm832 256q-26 0-45-19t-19-45q0-26 19-45t45-19q26 0 45 19t19 45q0 26-19 45t-45 19zm960-512V347l-339 338-90-90 338-339h-293V128h512v512h-128zm-768-512h256v128h-256V128zm-128 128H768V128h256v128zm-384 0H384V128h256v128zm-384 0H0V128h256v128zM128 640H0V384h128v256zm1920 128v256h-128V768h128zm-128 384h128v256h-128v-256zm0 384h128v256h-128v-256zm-384 256h256v128h-256v-128z"></PathIcon>
|
||||
</winui:NavigationViewItem.Icon>
|
||||
</winui:NavigationViewItem>
|
||||
|
||||
<winui:NavigationViewItem x:Uid="Shell_KeyboardManager" helpers:NavHelper.NavigateTo="views:KeyboardManagerPage" AutomationProperties.HeadingLevel="Level1">
|
||||
<winui:NavigationViewItem.Icon>
|
||||
<FontIcon Glyph=""/>
|
||||
</winui:NavigationViewItem.Icon>
|
||||
</winui:NavigationViewItem>
|
||||
|
||||
<winui:NavigationViewItem x:Uid="Shell_PowerRename" helpers:NavHelper.NavigateTo="views:PowerRenamePage" AutomationProperties.HeadingLevel="Level1">
|
||||
<winui:NavigationViewItem.Icon>
|
||||
<FontIcon Glyph=""/>
|
||||
</winui:NavigationViewItem.Icon>
|
||||
</winui:NavigationViewItem>
|
||||
|
||||
<winui:NavigationViewItem x:Uid="Shell_PowerLauncher" helpers:NavHelper.NavigateTo="views:PowerLauncherPage" AutomationProperties.HeadingLevel="Level1">
|
||||
<winui:NavigationViewItem.Icon>
|
||||
<FontIcon Glyph=""/>
|
||||
</winui:NavigationViewItem.Icon>
|
||||
</winui:NavigationViewItem>
|
||||
|
||||
<winui:NavigationViewItem x:Uid="Shell_ShortcutGuide" helpers:NavHelper.NavigateTo="views:ShortcutGuidePage" AutomationProperties.HeadingLevel="Level1">
|
||||
<winui:NavigationViewItem.Icon>
|
||||
<FontIcon Glyph=""/>
|
||||
</winui:NavigationViewItem.Icon>
|
||||
</winui:NavigationViewItem>
|
||||
</winui:NavigationView.MenuItems>
|
||||
<i:Interaction.Behaviors>
|
||||
<behaviors:NavigationViewHeaderBehavior
|
||||
DefaultHeader="{x:Bind ViewModel.Selected.Content, Mode=OneWay}">
|
||||
<behaviors:NavigationViewHeaderBehavior.DefaultHeaderTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Margin="0, -2, 0, 6">
|
||||
<TextBlock
|
||||
Text="{Binding}"
|
||||
FontWeight="Bold"
|
||||
Style="{ThemeResource TitleTextBlockStyle}"
|
||||
Margin="{StaticResource SmallLeftRightMargin}"
|
||||
AutomationProperties.HeadingLevel="Level1" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</behaviors:NavigationViewHeaderBehavior.DefaultHeaderTemplate>
|
||||
</behaviors:NavigationViewHeaderBehavior>
|
||||
<ic:EventTriggerBehavior EventName="ItemInvoked">
|
||||
<ic:InvokeCommandAction Command="{x:Bind ViewModel.ItemInvokedCommand}" />
|
||||
</ic:EventTriggerBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
<ScrollViewer Grid.Column="0">
|
||||
<Grid Margin="{StaticResource MediumLeftRightBottomMargin}">
|
||||
<Frame x:Name="shellFrame" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</winui:NavigationView>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,133 @@
|
||||
// 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.Generic;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Windows.Data.Json;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Root page.
|
||||
/// </summary>
|
||||
public sealed partial class ShellPage : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Declaration for the ipc callback function.
|
||||
/// </summary>
|
||||
/// <param name="msg">message.</param>
|
||||
public delegate void IPCMessageCallback(string msg);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a shell handler to be used to update contents of the shell dynamically from page within the frame.
|
||||
/// </summary>
|
||||
public static ShellPage ShellHandler { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets iPC default callback function.
|
||||
/// </summary>
|
||||
public static IPCMessageCallback DefaultSndMSGCallback { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets iPC callback function for restart as admin.
|
||||
/// </summary>
|
||||
public static IPCMessageCallback SndRestartAsAdminMsgCallback { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets iPC callback function for checking updates.
|
||||
/// </summary>
|
||||
public static IPCMessageCallback CheckForUpdatesMsgCallback { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets view model.
|
||||
/// </summary>
|
||||
public ShellViewModel ViewModel { get; } = new ShellViewModel();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of functions that handle IPC responses.
|
||||
/// </summary>
|
||||
public List<System.Action<JsonObject>> IPCResponseHandleList { get; } = new List<System.Action<JsonObject>>();
|
||||
|
||||
public static bool IsElevated { get; set; }
|
||||
|
||||
public static bool IsUserAnAdmin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ShellPage"/> class.
|
||||
/// Shell page constructor.
|
||||
/// </summary>
|
||||
public ShellPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = ViewModel;
|
||||
ShellHandler = this;
|
||||
ViewModel.Initialize(shellFrame, navigationView, KeyboardAccelerators);
|
||||
shellFrame.Navigate(typeof(GeneralPage));
|
||||
}
|
||||
|
||||
public static int SendDefaultIPCMessage(string msg)
|
||||
{
|
||||
DefaultSndMSGCallback(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int SendCheckForUpdatesIPCMessage(string msg)
|
||||
{
|
||||
CheckForUpdatesMsgCallback(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int SendRestartAdminIPCMessage(string msg)
|
||||
{
|
||||
SndRestartAsAdminMsgCallback(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set Default IPC Message callback function.
|
||||
/// </summary>
|
||||
/// <param name="implementation">delegate function implementation.</param>
|
||||
public static void SetDefaultSndMessageCallback(IPCMessageCallback implementation)
|
||||
{
|
||||
DefaultSndMSGCallback = implementation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set restart as admin IPC callback function.
|
||||
/// </summary>
|
||||
/// <param name="implementation">delegate function implementation.</param>
|
||||
public static void SetRestartAdminSndMessageCallback(IPCMessageCallback implementation)
|
||||
{
|
||||
SndRestartAsAdminMsgCallback = implementation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set check for updates IPC callback function.
|
||||
/// </summary>
|
||||
/// <param name="implementation">delegate function implementation.</param>
|
||||
public static void SetCheckForUpdatesMessageCallback(IPCMessageCallback implementation)
|
||||
{
|
||||
CheckForUpdatesMsgCallback = implementation;
|
||||
}
|
||||
|
||||
public static void SetElevationStatus(bool isElevated)
|
||||
{
|
||||
IsElevated = isElevated;
|
||||
}
|
||||
|
||||
public static void SetIsUserAnAdmin(bool isAdmin)
|
||||
{
|
||||
IsUserAnAdmin = isAdmin;
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
shellFrame.Navigate(typeof(GeneralPage));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.ShortcutGuidePage"
|
||||
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:viewModel="using:Microsoft.PowerToys.Settings.UI.ViewModels"
|
||||
xmlns:CustomControls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
|
||||
<Page.Resources>
|
||||
<converters:StringFormatConverter x:Key="StringFormatConverter"/>
|
||||
</Page.Resources>
|
||||
|
||||
<Grid RowSpacing="{StaticResource DefaultRowSpacing}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="LayoutVisualStates">
|
||||
<VisualState x:Name="WideLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource WideLayoutMinWidth}" />
|
||||
</VisualState.StateTriggers>
|
||||
</VisualState>
|
||||
<VisualState x:Name="SmallLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource SmallLayoutMinWidth}" />
|
||||
<AdaptiveTrigger MinWindowWidth="0" />
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="SidePanel.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="SidePanel.Width" Value="Auto"/>
|
||||
<Setter Target="ShortcutGuideView.(Grid.Row)" Value="1" />
|
||||
<Setter Target="LinksPanel.(RelativePanel.RightOf)" Value="AboutImage"/>
|
||||
<Setter Target="LinksPanel.(RelativePanel.AlignTopWith)" Value="AboutImage"/>
|
||||
<Setter Target="AboutImage.Margin" Value="0,12,12,0"/>
|
||||
<Setter Target="AboutTitle.Visibility" Value="Collapsed" />
|
||||
</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="ShortcutGuideView">
|
||||
<ToggleSwitch x:Uid="ShortcutGuide_Enable"
|
||||
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}"/>
|
||||
|
||||
<TextBlock x:Uid="ShortcutGuide_Appearance_Behavior"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
|
||||
<muxc:NumberBox x:Uid="ShortcutGuide_PressTime"
|
||||
Minimum="100"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
MinWidth="240"
|
||||
Value="{x:Bind Mode=TwoWay, Path=ViewModel.PressTime}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
SmallChange="50"
|
||||
LargeChange="100"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="{StaticResource MediumTopMargin}" Spacing="12">
|
||||
<Slider x:Uid="ShortcutGuide_OverlayOpacity"
|
||||
Minimum="0"
|
||||
Maximum="100"
|
||||
Width="240"
|
||||
Value="{x:Bind Mode=TwoWay, Path=ViewModel.OverlayOpacity}"
|
||||
IsThumbToolTipEnabled="False"
|
||||
HorizontalAlignment="Left"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
|
||||
|
||||
<TextBlock
|
||||
Text="{x:Bind Mode=OneWay, Path=ViewModel.OverlayOpacity, Converter={StaticResource StringFormatConverter}, ConverterParameter=' {0}%' }"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
FontWeight="SemiBold"
|
||||
Margin="0,16,0,0"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- We cannot navigate to all the radio buttons using the arrow keys because of an XYNavigation issue in the RadioButtons control.
|
||||
The screen reader does not read the heading when we tab into a radio button, even though the LabeledBy automation property is set.
|
||||
Link to the issue in the winui repository - https://github.com/microsoft/microsoft-ui-xaml/issues/3156 -->
|
||||
<TextBlock Name="ShortcutGuide_Theme"
|
||||
x:Uid="ColorModeHeader"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
|
||||
<muxc:RadioButtons IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
|
||||
SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.ThemeIndex}"
|
||||
Margin="{StaticResource XXSmallTopMargin}"
|
||||
AutomationProperties.LabeledBy="{Binding ElementName=ShortcutGuide_Theme}">
|
||||
<RadioButton x:Uid="Radio_Theme_Dark" />
|
||||
<RadioButton x:Uid="Radio_Theme_Light" />
|
||||
<RadioButton x:Uid="Radio_Theme_Default"/>
|
||||
</muxc:RadioButtons>
|
||||
<HyperlinkButton NavigateUri="ms-settings:colors">
|
||||
<TextBlock x:Uid="Windows_Color_Settings" />
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
|
||||
<RelativePanel x:Name="SidePanel"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
<StackPanel x:Name="DescriptionPanel">
|
||||
<TextBlock x:Uid="About_ShortcutGuide"
|
||||
x:Name="AboutTitle"
|
||||
Grid.ColumnSpan="2"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
<TextBlock x:Uid="ShortcutGuide_Description"
|
||||
TextWrapping="Wrap"
|
||||
Grid.Row="1" />
|
||||
</StackPanel>
|
||||
|
||||
<Border x:Name="AboutImage"
|
||||
CornerRadius="4"
|
||||
Grid.Row="2"
|
||||
MaxWidth="240"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopBottomMargin}"
|
||||
RelativePanel.Below="DescriptionPanel">
|
||||
<Image x:Uid="Shortcut_Guide_Image" Source="ms-appx:///Assets/Modules/ShortcutGuide.png" />
|
||||
</Border>
|
||||
|
||||
<StackPanel x:Name="LinksPanel"
|
||||
Margin="0,1,0,0"
|
||||
RelativePanel.Below="AboutImage"
|
||||
Orientation="Vertical" >
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_ShortcutGuide">
|
||||
<TextBlock x:Uid="Module_overview" />
|
||||
</HyperlinkButton>
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/powerToysGiveFeedback">
|
||||
<TextBlock x:Uid="Give_Feedback" />
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
</RelativePanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
public sealed partial class ShortcutGuidePage : Page
|
||||
{
|
||||
private ShortcutGuideViewModel ViewModel { get; set; }
|
||||
|
||||
public ShortcutGuidePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ViewModel = new ShortcutGuideViewModel(SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), SettingsRepository<ShortcutGuideSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// 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;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
public class VisibleIfNotEmpty : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
return (value == null) || (value as IList).Count == 0 ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||