From eb2ef7070be898feab012adf9ba3eb7ccaae4001 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Mon, 23 Aug 2021 19:48:52 +0200 Subject: [PATCH] [Settings] New UX (#12470) * Removed hardcoded background * Background * Updated pages * Added OOBE to shellpage * Margin fixes * Fix * Resource update * Resource string update * Removed reference from installer file * Updated UI fixes and remove conflicts * Adding new settings control * PowerRename * Sidepanel updates * Shortcut Guide * Updates screeens * General page updates * Awake UX update * Changed order for power preview note * Fixes * UI fixes * KBM * IsEnabled state support * Added new controls * Update * Updated nugest packages * Replaced itemscontrol * Introducing setting button style * FancyZones page * Plugin page * Switch case * Fixed typo * Plugin manager update * Introducing SettingExpander * Setting automation properties * Accesibility improvements * VCM and cleanup * Refactoring OOBE pages part 1 * OOBE XAML refactoring * Added MinWidth to actioncontent controls * Updates to various settings * Spell update * Update to author label * Clean up * Removing redunant files * Move file * Updated files * Revert "Updated files" This reverts commit 1a5c887eae4b4d4989a5e69d531d58227d73adef. * Revert "Move file" This reverts commit 2b06c75c1f91f7a0bbda4c61a7a732dfcedf347e. * Revert "Removing redunant files" This reverts commit fe79ec1701b5670c3d6298a7411964908a839dfe. * Revert "Clean up" This reverts commit 028e15fab6d28fa2519f5a3afa2b7e3e9c2eb297. * Removed redundant styles * Revert "Removed redundant styles" This reverts commit dfdfd65021715b63bae3391518181e3ecbc81330. * Files cleanup * Removing converter, updating background and paddings * Styling updates * Unit test updates * Fixes * Installer fixes * Update Resources.resw * Shell page updates * Updated pagelinks * Styles re-ordering * Updated converter * Updated ToggleSwitch style * Bugfixes * Typo fix * [Settings] New UX - installer dll fixes (#12818) * [Settings] New UX - Fix some failing tests (#12822) * Bugfixes * Typo fix * Hiding VCM * Bugfixes * Download button fix * Remove Newtonsoft.Json from installer file * Updated visuals * Bugfixes * Syntax fix * Updated installer file * Bugfixes * New label * Theming support for OOBE * Put back in Documentation hyperlink * Right uid Co-authored-by: Niels Laute Co-authored-by: Jaime Bernardo --- .github/actions/spell-check/expect.txt | 2 + installer/PowerToysSetup/Product.wxs | 6 +- src/runner/Resources.resx | 4 +- .../ViewModels/GeneralViewModel.cs | 91 +-- .../PowerLauncherPluginViewModel.cs | 15 - .../ViewModels/PowerLauncherViewModel.cs | 129 +--- .../ViewModels/ShortcutGuideViewModel.cs | 44 +- .../ViewModelTests/General.cs | 8 +- .../Microsoft.PowerToys.Settings.UI/App.xaml | 23 +- .../FluentIcons/FluentIconsSettings.png | Bin 0 -> 3582 bytes .../Controls/HotkeySettingsControl.xaml | 19 +- .../OOBEPageControl/OOBEPageControl.xaml | 48 ++ .../OOBEPageControl/OOBEPageControl.xaml.cs | 46 ++ .../Controls/Setting/Setting.cs | 158 +++++ .../Controls/Setting/Setting.xaml | 109 ++++ .../SettingExpander/SettingExpander.cs | 43 ++ .../Controls/SettingsGroup/SettingsGroup.cs | 59 ++ .../Controls/SettingsGroup/SettingsGroup.xaml | 48 ++ .../PageLink.cs} | 4 +- .../SettingsPageControl.xaml | 121 ++++ .../SettingsPageControl.xaml.cs | 58 +- .../SidePanel/SettingsPageControl.xaml | 118 ---- ...erter.cs => UpdateStateToBoolConverter.cs} | 23 +- ...tateCannotDownloadToVisibilityConverter.cs | 24 - ...ateReadyToDownloadToVisibilityConverter.cs | 24 - ...tateReadyToInstallToVisibilityConverter.cs | 24 - ...atingStateUpToDateToVisibilityConverter.cs | 24 - .../Microsoft.PowerToys.Settings.UI.csproj | 61 +- .../OOBE/Views/OobeAwake.xaml | 72 +-- .../OOBE/Views/OobeColorPicker.xaml | 83 +-- .../OOBE/Views/OobeFancyZones.xaml | 70 +-- .../OOBE/Views/OobeFileExplorer.xaml | 67 +-- .../OOBE/Views/OobeImageResizer.xaml | 71 +-- .../OOBE/Views/OobeKBM.xaml | 72 +-- .../OOBE/Views/OobeOverview.xaml | 72 +-- .../OOBE/Views/OobePowerRename.xaml | 75 +-- .../OOBE/Views/OobeRun.xaml | 81 +-- .../OOBE/Views/OobeShellPage.xaml | 20 +- .../OOBE/Views/OobeShellPage.xaml.cs | 23 +- .../OOBE/Views/OobeShortcutGuide.xaml | 79 +-- .../OOBE/Views/OobeVideoConference.xaml | 68 +-- .../Strings/en-us/Resources.resw | 565 ++++++++++++------ .../Styles/Button.xaml | 512 ++++++++++++++-- .../Styles/Page.xaml | 9 - .../Styles/TextBlock.xaml | 42 +- .../Styles/_Colors.xaml | 5 - .../Styles/_FontSizes.xaml | 8 - .../Styles/_Sizes.xaml | 25 - .../Styles/_Thickness.xaml | 40 -- .../Themes/Colors.xaml | 27 + .../Themes/Generic.xaml | 9 + .../Themes/SettingsExpanderStyles.xaml | 50 ++ .../Views/AwakePage.xaml | 183 +++--- .../Views/ColorPickerPage.xaml | 365 +++++------ .../Views/ColorPickerPage.xaml.cs | 4 +- .../Views/FancyZonesPage.xaml | 531 ++++++++-------- .../Views/GeneralPage.xaml | 390 ++++++------ .../Views/GeneralPage.xaml.cs | 5 - .../Views/ImageResizerPage.xaml | 311 +++++----- .../Views/KeyboardManagerPage.xaml | 433 ++++++-------- .../Views/PowerLauncherPage.xaml | 432 ++++++------- .../Views/PowerLauncherPage.xaml.cs | 9 - .../Views/PowerPreviewPage.xaml | 82 +-- .../Views/PowerRenamePage.xaml | 129 ++-- .../Views/ShellPage.xaml | 237 +++++--- .../Views/ShellPage.xaml.cs | 19 +- .../Views/ShortcutGuidePage.xaml | 159 +++-- .../Views/VideoConference.xaml | 247 ++++---- 68 files changed, 3652 insertions(+), 3362 deletions(-) create mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Assets/FluentIcons/FluentIconsSettings.png create mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/OOBEPageControl/OOBEPageControl.xaml create mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/OOBEPageControl/OOBEPageControl.xaml.cs create mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/Setting/Setting.cs create mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/Setting/Setting.xaml create mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingExpander/SettingExpander.cs create mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.cs create mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.xaml rename src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/{SidePanel/SidePanelLink.cs => SettingsPageControl/PageLink.cs} (80%) create mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml rename src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/{SidePanel => SettingsPageControl}/SettingsPageControl.xaml.cs (59%) delete mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SidePanel/SettingsPageControl.xaml rename src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/{ModuleEnabledToOpacityConverter.cs => UpdateStateToBoolConverter.cs} (55%) delete mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateCannotDownloadToVisibilityConverter.cs delete mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateReadyToDownloadToVisibilityConverter.cs delete mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateReadyToInstallToVisibilityConverter.cs delete mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateUpToDateToVisibilityConverter.cs delete mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Styles/Page.xaml delete mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Styles/_Colors.xaml delete mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Styles/_FontSizes.xaml delete mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Styles/_Sizes.xaml delete mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Styles/_Thickness.xaml create mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Themes/Colors.xaml create mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Themes/Generic.xaml create mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Themes/SettingsExpanderStyles.xaml diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index e5b890aa3d..9e605257ca 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -15,6 +15,7 @@ accessibilityinsights Acl aclapi AColumn +Accessible acos acrt Actioncenter @@ -270,6 +271,7 @@ codereview Codespaces COINIT colorconv +colorformat colorhistory colorhistorylimit COLORKEY diff --git a/installer/PowerToysSetup/Product.wxs b/installer/PowerToysSetup/Product.wxs index ab21cd3ff1..1810508c85 100644 --- a/installer/PowerToysSetup/Product.wxs +++ b/installer/PowerToysSetup/Product.wxs @@ -794,7 +794,7 @@ - + @@ -848,7 +848,7 @@ - + @@ -869,7 +869,7 @@ - + diff --git a/src/runner/Resources.resx b/src/runner/Resources.resx index f961182c08..5303114f4c 100644 --- a/src/runner/Resources.resx +++ b/src/runner/Resources.resx @@ -110,14 +110,14 @@ Settings - Open documentation + Documentation Exit Exit as a verb, as in Exit the application - Report Bug + Report bug Bug report .zip file has been created on your Desktop. diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/GeneralViewModel.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/GeneralViewModel.cs index 63166703db..1d95c375d7 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/GeneralViewModel.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/GeneralViewModel.cs @@ -80,14 +80,14 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels // normalization for switch statements switch (GeneralSettingsConfig.Theme.ToUpperInvariant()) { - case "LIGHT": - _isLightThemeRadioButtonChecked = true; - break; case "DARK": - _isDarkThemeRadioButtonChecked = true; + _themeIndex = 0; + break; + case "LIGHT": + _themeIndex = 1; break; case "SYSTEM": - _isSystemThemeRadioButtonChecked = true; + _themeIndex = 2; break; } @@ -116,9 +116,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels private bool _isElevated; private bool _runElevated; private bool _isAdmin; - private bool _isDarkThemeRadioButtonChecked; - private bool _isLightThemeRadioButtonChecked; - private bool _isSystemThemeRadioButtonChecked; + private int _themeIndex; + private bool _autoDownloadUpdates; private UpdatingSettings.UpdatingState _updatingState = UpdatingSettings.UpdatingState.UpToDate; @@ -255,81 +254,33 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels } } - [SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "This may throw if the XAML page is not initialized in tests (https://github.com/microsoft/PowerToys/pull/2676)")] - public bool IsDarkThemeRadioButtonChecked + public int ThemeIndex { get { - return _isDarkThemeRadioButtonChecked; + return _themeIndex; } set { - if (value == true) + if (_themeIndex != value) { - GeneralSettingsConfig.Theme = "dark"; - _isDarkThemeRadioButtonChecked = value; - try - { - UpdateUIThemeCallBack(GeneralSettingsConfig.Theme); - } - catch (Exception e) - { - Logger.LogError("Exception encountered when changing Settings theme", e); - } - - NotifyPropertyChanged(); - } - } - } - - [SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "This may throw if the XAML page is not initialized in tests (https://github.com/microsoft/PowerToys/pull/2676)")] - public bool IsLightThemeRadioButtonChecked - { - get - { - return _isLightThemeRadioButtonChecked; - } - - set - { - if (value == true) - { - GeneralSettingsConfig.Theme = "light"; - _isLightThemeRadioButtonChecked = value; - try - { - UpdateUIThemeCallBack(GeneralSettingsConfig.Theme); - } - catch (Exception e) - { - Logger.LogError("Exception encountered when changing Settings theme", e); - } - - NotifyPropertyChanged(); - } - } - } - - [SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "This may throw if the XAML page is not initialized in tests (https://github.com/microsoft/PowerToys/pull/2676)")] - public bool IsSystemThemeRadioButtonChecked - { - get - { - return _isSystemThemeRadioButtonChecked; - } - - set - { - if (value == true) - { - GeneralSettingsConfig.Theme = "system"; - _isSystemThemeRadioButtonChecked = value; + switch (value) + { + case 0: GeneralSettingsConfig.Theme = "dark"; break; + case 1: GeneralSettingsConfig.Theme = "light"; break; + case 2: GeneralSettingsConfig.Theme = "system"; break; + } + + _themeIndex = value; + try { UpdateUIThemeCallBack(GeneralSettingsConfig.Theme); } +#pragma warning disable CA1031 // Do not catch general exception types catch (Exception e) +#pragma warning restore CA1031 // Do not catch general exception types { Logger.LogError("Exception encountered when changing Settings theme", e); } diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/PowerLauncherPluginViewModel.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/PowerLauncherPluginViewModel.cs index cde36c964d..07216c1510 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/PowerLauncherPluginViewModel.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/PowerLauncherPluginViewModel.cs @@ -139,21 +139,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels } } - private bool _showAdditionalInfoPanel; - - public bool ShowAdditionalInfoPanel - { - get => _showAdditionalInfoPanel; - set - { - if (value != _showAdditionalInfoPanel) - { - _showAdditionalInfoPanel = value; - NotifyPropertyChanged(); - } - } - } - public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged([CallerMemberName] string propertyName = "") diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/PowerLauncherViewModel.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/PowerLauncherViewModel.cs index 4497cf0316..f226efda48 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/PowerLauncherViewModel.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/PowerLauncherViewModel.cs @@ -19,13 +19,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels { public class PowerLauncherViewModel : Observable { - private bool _isDarkThemeRadioButtonChecked; - private bool _isLightThemeRadioButtonChecked; - private bool _isSystemThemeRadioButtonChecked; - - private bool _isCursorPositionRadioButtonChecked; - private bool _isPrimaryMonitorPositionRadioButtonChecked; - private bool _isFocusPositionRadioButtonChecked; + private int _themeIndex; + private int _monitorPositionIndex; private string _searchText; @@ -75,27 +70,27 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels switch (settings.Properties.Theme) { - case Theme.Light: - _isLightThemeRadioButtonChecked = true; - break; case Theme.Dark: - _isDarkThemeRadioButtonChecked = true; + _themeIndex = 0; + break; + case Theme.Light: + _themeIndex = 1; break; case Theme.System: - _isSystemThemeRadioButtonChecked = true; + _themeIndex = 2; break; } switch (settings.Properties.Position) { case StartupPosition.Cursor: - _isCursorPositionRadioButtonChecked = true; + _monitorPositionIndex = 0; break; case StartupPosition.PrimaryMonitor: - _isPrimaryMonitorPositionRadioButtonChecked = true; + _monitorPositionIndex = 1; break; case StartupPosition.Focus: - _isFocusPositionRadioButtonChecked = true; + _monitorPositionIndex = 2; break; } @@ -199,112 +194,46 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels } } - public bool IsDarkThemeRadioButtonChecked + public int ThemeIndex { get { - return _isDarkThemeRadioButtonChecked; + return _themeIndex; } set { - if (value == true) + switch (value) { - settings.Properties.Theme = Theme.Dark; - _isDarkThemeRadioButtonChecked = value; - - UpdateSettings(); + case 0: settings.Properties.Theme = Theme.Dark; break; + case 1: settings.Properties.Theme = Theme.Light; break; + case 2: settings.Properties.Theme = Theme.System; break; } + + _themeIndex = value; + UpdateSettings(); } } - public bool IsLightThemeRadioButtonChecked + public int MonitorPositionIndex { get { - return _isLightThemeRadioButtonChecked; + return _monitorPositionIndex; } set { - if (value == true) + if (_monitorPositionIndex != value) { - settings.Properties.Theme = Theme.Light; - _isDarkThemeRadioButtonChecked = value; + switch (value) + { + case 0: settings.Properties.Position = StartupPosition.Cursor; break; + case 1: settings.Properties.Position = StartupPosition.PrimaryMonitor; break; + case 2: settings.Properties.Position = StartupPosition.Focus; break; + } - UpdateSettings(); - } - } - } - - public bool IsSystemThemeRadioButtonChecked - { - get - { - return _isSystemThemeRadioButtonChecked; - } - - set - { - if (value == true) - { - settings.Properties.Theme = Theme.System; - _isDarkThemeRadioButtonChecked = value; - - UpdateSettings(); - } - } - } - - public bool IsCursorPositionRadioButtonChecked - { - get - { - return _isCursorPositionRadioButtonChecked; - } - - set - { - if (value == true) - { - settings.Properties.Position = StartupPosition.Cursor; - _isCursorPositionRadioButtonChecked = value; - UpdateSettings(); - } - } - } - - public bool IsPrimaryMonitorPositionRadioButtonChecked - { - get - { - return _isPrimaryMonitorPositionRadioButtonChecked; - } - - set - { - if (value == true) - { - settings.Properties.Position = StartupPosition.PrimaryMonitor; - _isPrimaryMonitorPositionRadioButtonChecked = value; - UpdateSettings(); - } - } - } - - public bool IsFocusPositionRadioButtonChecked - { - get - { - return _isFocusPositionRadioButtonChecked; - } - - set - { - if (value == true) - { - settings.Properties.Position = StartupPosition.Focus; - _isFocusPositionRadioButtonChecked = value; + _monitorPositionIndex = value; UpdateSettings(); } } diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/ShortcutGuideViewModel.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/ShortcutGuideViewModel.cs index be2faed406..50720a3e33 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/ShortcutGuideViewModel.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/ShortcutGuideViewModel.cs @@ -56,21 +56,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels _opacity = Settings.Properties.OverlayOpacity.Value; _disabledApps = Settings.Properties.DisabledApps.Value; - string theme = Settings.Properties.Theme.Value; - - if (theme == "dark") + switch (Settings.Properties.Theme.Value) { - _themeIndex = 0; - } - - if (theme == "light") - { - _themeIndex = 1; - } - - if (theme == "system") - { - _themeIndex = 2; + case "dark": _themeIndex = 0; break; + case "light": _themeIndex = 1; break; + case "system": _themeIndex = 2; break; } } @@ -130,29 +120,15 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels { if (_themeIndex != value) { - if (value == 0) + switch (value) { - // set theme to dark. - Settings.Properties.Theme.Value = "dark"; - _themeIndex = value; - NotifyPropertyChanged(); + case 0: Settings.Properties.Theme.Value = "dark"; break; + case 1: Settings.Properties.Theme.Value = "light"; break; + case 2: Settings.Properties.Theme.Value = "system"; break; } - if (value == 1) - { - // set theme to light. - Settings.Properties.Theme.Value = "light"; - _themeIndex = value; - NotifyPropertyChanged(); - } - - if (value == 2) - { - // set theme to system default. - Settings.Properties.Theme.Value = "system"; - _themeIndex = value; - NotifyPropertyChanged(); - } + _themeIndex = value; + NotifyPropertyChanged(); } } } diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/General.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/General.cs index 9293f222ff..ce0a01be21 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/General.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/General.cs @@ -191,10 +191,10 @@ namespace ViewModelTests sendRestartAdminIPCMessage, sendCheckForUpdatesIPCMessage, GeneralSettingsFileName); - Assert.IsFalse(viewModel.IsLightThemeRadioButtonChecked); + Assert.AreNotEqual(1, viewModel.ThemeIndex); // act - viewModel.IsLightThemeRadioButtonChecked = true; + viewModel.ThemeIndex = 1; } [TestMethod] @@ -222,10 +222,10 @@ namespace ViewModelTests sendRestartAdminIPCMessage, sendCheckForUpdatesIPCMessage, GeneralSettingsFileName); - Assert.IsFalse(viewModel.IsDarkThemeRadioButtonChecked); + Assert.AreNotEqual(0, viewModel.ThemeIndex); // act - viewModel.IsDarkThemeRadioButtonChecked = true; + viewModel.ThemeIndex = 0; } [TestMethod] diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/App.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/App.xaml index e18786bcbb..6900c4b1e9 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/App.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/App.xaml @@ -2,22 +2,27 @@ 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"> + xmlns:xaml="using:Microsoft.Toolkit.Win32.UI.XamlHost"> - + - - - - - + + - + + 6,16,16,16 + 16,0,0,0 + 240 + + \ No newline at end of file diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Assets/FluentIcons/FluentIconsSettings.png b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Assets/FluentIcons/FluentIconsSettings.png new file mode 100644 index 0000000000000000000000000000000000000000..bf6a6c2d807a30e9e0eca5ea71b3d099a5e05e22 GIT binary patch literal 3582 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 - - - - - - - - - - - - - - + IsReadOnly="True"/> \ No newline at end of file diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/OOBEPageControl/OOBEPageControl.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/OOBEPageControl/OOBEPageControl.xaml new file mode 100644 index 0000000000..0537a76809 --- /dev/null +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/OOBEPageControl/OOBEPageControl.xaml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/OOBEPageControl/OOBEPageControl.xaml.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/OOBEPageControl/OOBEPageControl.xaml.cs new file mode 100644 index 0000000000..8d2ab0693c --- /dev/null +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/OOBEPageControl/OOBEPageControl.xaml.cs @@ -0,0 +1,46 @@ +// 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.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace Microsoft.PowerToys.Settings.UI.Controls +{ + public sealed partial class OOBEPageControl : UserControl + { + public OOBEPageControl() + { + this.InitializeComponent(); + } + + public string ModuleTitle + { + get { return (string)GetValue(ModuleTitleProperty); } + set { SetValue(ModuleTitleProperty, value); } + } + + public string ModuleDescription + { + get => (string)GetValue(ModuleDescriptionProperty); + set => SetValue(ModuleDescriptionProperty, value); + } + + public string ModuleImageSource + { + get => (string)GetValue(ModuleImageSourceProperty); + set => SetValue(ModuleImageSourceProperty, value); + } + + public object ModuleContent + { + get { return (object)GetValue(ModuleContentProperty); } + set { SetValue(ModuleContentProperty, value); } + } + + public static readonly DependencyProperty ModuleTitleProperty = DependencyProperty.Register("ModuleTitle", typeof(string), typeof(SettingsPageControl), new PropertyMetadata(default(string))); + public static readonly DependencyProperty ModuleDescriptionProperty = DependencyProperty.Register("ModuleDescription", typeof(string), typeof(SettingsPageControl), new PropertyMetadata(default(string))); + public static readonly DependencyProperty ModuleImageSourceProperty = DependencyProperty.Register("ModuleImageSource", typeof(string), typeof(SettingsPageControl), new PropertyMetadata(default(string))); + public static readonly DependencyProperty ModuleContentProperty = DependencyProperty.Register("ModuleContent", typeof(object), typeof(SettingsPageControl), new PropertyMetadata(new Grid())); + } +} diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/Setting/Setting.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/Setting/Setting.cs new file mode 100644 index 0000000000..a396fb7f21 --- /dev/null +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/Setting/Setting.cs @@ -0,0 +1,158 @@ +// 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 Windows.UI.Accessibility; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Automation; +using Windows.UI.Xaml.Controls; + +namespace Microsoft.PowerToys.Settings.UI.Controls +{ + [TemplateVisualState(Name = "Normal", GroupName = "CommonStates")] + [TemplateVisualState(Name = "Disabled", GroupName = "CommonStates")] + [TemplatePart(Name = PartIconPresenter, Type = typeof(ContentPresenter))] + [TemplatePart(Name = PartDescriptionPresenter, Type = typeof(ContentPresenter))] + public class Setting : ContentControl + { + private const string PartIconPresenter = "IconPresenter"; + private const string PartDescriptionPresenter = "DescriptionPresenter"; + private ContentPresenter _iconPresenter; + private ContentPresenter _descriptionPresenter; + private Setting _setting; + + public Setting() + { + this.DefaultStyleKey = typeof(Setting); + } + + public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register( + "Header", + typeof(string), + typeof(Setting), + new PropertyMetadata(default(string), OnHeaderChanged)); + + public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register( + "Description", + typeof(object), + typeof(Setting), + new PropertyMetadata(null, OnDescriptionChanged)); + + public static readonly DependencyProperty IconProperty = DependencyProperty.Register( + "Icon", + typeof(object), + typeof(Setting), + new PropertyMetadata(default(string), OnIconChanged)); + + public static readonly DependencyProperty ActionContentProperty = DependencyProperty.Register( + "ActionContent", + typeof(object), + typeof(Setting), + null); + + [Localizable(true)] + public string Header + { + get => (string)GetValue(HeaderProperty); + set => SetValue(HeaderProperty, value); + } + + [Localizable(true)] + public object Description + { + get => (object)GetValue(DescriptionProperty); + set => SetValue(DescriptionProperty, value); + } + + public object Icon + { + get => (object)GetValue(IconProperty); + set => SetValue(IconProperty, value); + } + + public object ActionContent + { + get => (object)GetValue(ActionContentProperty); + set => SetValue(ActionContentProperty, value); + } + + protected override void OnApplyTemplate() + { + IsEnabledChanged -= Setting_IsEnabledChanged; + _setting = (Setting)this; + _iconPresenter = (ContentPresenter)_setting.GetTemplateChild(PartIconPresenter); + _descriptionPresenter = (ContentPresenter)_setting.GetTemplateChild(PartDescriptionPresenter); + Update(); + SetEnabledState(); + IsEnabledChanged += Setting_IsEnabledChanged; + base.OnApplyTemplate(); + } + + private static void OnHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((Setting)d).Update(); + } + + private static void OnIconChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((Setting)d).Update(); + } + + private static void OnDescriptionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((Setting)d).Update(); + } + + private void Setting_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) + { + SetEnabledState(); + } + + private void SetEnabledState() + { + VisualStateManager.GoToState(this, IsEnabled ? "Normal" : "Disabled", true); + } + + private void Update() + { + if (_setting == null) + { + return; + } + + if (_setting.ActionContent != null) + { + if (_setting.ActionContent.GetType() != typeof(Button)) + { + // We do not want to override the default AutomationProperties.Name of a button. Its Content property already describes what it does. + if (!string.IsNullOrEmpty(_setting.Header)) + { + AutomationProperties.SetName((UIElement)_setting.ActionContent, _setting.Header); + } + } + } + + if (_setting._iconPresenter != null) + { + if (_setting.Icon == null) + { + _setting._iconPresenter.Visibility = Visibility.Collapsed; + } + else + { + _setting._iconPresenter.Visibility = Visibility.Visible; + } + } + + if (_setting.Description == null) + { + _setting._descriptionPresenter.Visibility = Visibility.Collapsed; + } + else + { + _setting._descriptionPresenter.Visibility = Visibility.Visible; + } + } + } +} diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/Setting/Setting.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/Setting/Setting.xaml new file mode 100644 index 0000000000..382d4972bc --- /dev/null +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/Setting/Setting.xaml @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingExpander/SettingExpander.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingExpander/SettingExpander.cs new file mode 100644 index 0000000000..4d8aabcbd9 --- /dev/null +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingExpander/SettingExpander.cs @@ -0,0 +1,43 @@ +// 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.Text; +using System.Threading.Tasks; +using Microsoft.UI.Xaml.Controls; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Automation; + +namespace Microsoft.PowerToys.Settings.UI.Controls +{ + public partial class SettingExpander : Expander + { + public SettingExpander() + { + DefaultStyleKey = typeof(Expander); + this.Style = (Style)App.Current.Resources["SettingExpanderStyle"]; + this.RegisterPropertyChangedCallback(Expander.HeaderProperty, OnHeaderChanged); + } + + private static void OnHeaderChanged(DependencyObject d, DependencyProperty dp) + { + SettingExpander self = (SettingExpander)d; + if (self.Header != null) + { + if (self.Header.GetType() == typeof(Setting)) + { + Setting selfSetting = (Setting)self.Header; + selfSetting.Style = (Style)App.Current.Resources["ExpanderHeaderSettingStyle"]; + + if (!string.IsNullOrEmpty(selfSetting.Header)) + { + AutomationProperties.SetName(self, selfSetting.Header); + } + } + } + } + } +} diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.cs new file mode 100644 index 0000000000..8625b05b99 --- /dev/null +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.cs @@ -0,0 +1,59 @@ +// 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.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace Microsoft.PowerToys.Settings.UI.Controls +{ + /// + /// Represents a control that can contain multiple settings (or other) controls + /// + [TemplateVisualState(Name = "Normal", GroupName = "CommonStates")] + [TemplateVisualState(Name = "Disabled", GroupName = "CommonStates")] + public partial class SettingsGroup : ItemsControl + { + public SettingsGroup() + { + DefaultStyleKey = typeof(SettingsGroup); + } + + public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register( + "Header", + typeof(string), + typeof(SettingsGroup), + new PropertyMetadata(default(string))); + + [Localizable(true)] + public string Header + { + get => (string)GetValue(HeaderProperty); + set => SetValue(HeaderProperty, value); + } + + protected override void OnApplyTemplate() + { + IsEnabledChanged -= SettingsGroup_IsEnabledChanged; + SetEnabledState(); + IsEnabledChanged += SettingsGroup_IsEnabledChanged; + base.OnApplyTemplate(); + } + + private void SettingsGroup_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) + { + SetEnabledState(); + } + + private void SetEnabledState() + { + VisualStateManager.GoToState(this, IsEnabled ? "Normal" : "Disabled", true); + } + } +} diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.xaml new file mode 100644 index 0000000000..9167346f49 --- /dev/null +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.xaml @@ -0,0 +1,48 @@ + + + + \ No newline at end of file diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SidePanel/SidePanelLink.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsPageControl/PageLink.cs similarity index 80% rename from src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SidePanel/SidePanelLink.cs rename to src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsPageControl/PageLink.cs index 02fe99db55..a1cc6b078c 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SidePanel/SidePanelLink.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsPageControl/PageLink.cs @@ -6,9 +6,9 @@ using System; namespace Microsoft.PowerToys.Settings.UI.Controls { - public class SidePanelLink + public class PageLink { - public string Label { get; set; } + public string Text { get; set; } public Uri Link { get; set; } } diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml new file mode 100644 index 0000000000..a4c606f286 --- /dev/null +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SidePanel/SettingsPageControl.xaml.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml.cs similarity index 59% rename from src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SidePanel/SettingsPageControl.xaml.cs rename to src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml.cs index b8a74f24f3..d4fe3477e2 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SidePanel/SettingsPageControl.xaml.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml.cs @@ -3,21 +3,9 @@ // See the LICENSE file in the project root for more information. using System; -using System.Collections.Generic; using System.Collections.ObjectModel; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Documents; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; namespace Microsoft.PowerToys.Settings.UI.Controls { @@ -26,22 +14,14 @@ namespace Microsoft.PowerToys.Settings.UI.Controls public SettingsPageControl() { this.InitializeComponent(); - ModuleLinks = new ObservableCollection(); - AttributionLinks = new ObservableCollection(); + PrimaryLinks = new ObservableCollection(); + SecondaryLinks = new ObservableCollection(); } - public object ModuleContent - { - get { return (object)GetValue(ModuleContentProperty); } - set { SetValue(ModuleContentProperty, value); } - } - - public static readonly DependencyProperty ModuleContentProperty = DependencyProperty.Register("Content", typeof(object), typeof(SettingsPageControl), new PropertyMetadata(new Grid())); - public string ModuleTitle { - get => (string)GetValue(ModuleTitleProperty); - set => SetValue(ModuleTitleProperty, value); + get { return (string)GetValue(ModuleTitleProperty); } + set { SetValue(ModuleTitleProperty, value); } } public string ModuleDescription @@ -63,26 +43,40 @@ namespace Microsoft.PowerToys.Settings.UI.Controls } #pragma warning disable CA2227 // Collection properties should be read only - public ObservableCollection ModuleLinks + public ObservableCollection PrimaryLinks #pragma warning restore CA2227 // Collection properties should be read only { - get => (ObservableCollection)GetValue(ModuleLinksProperty); - set => SetValue(ModuleLinksProperty, value); + get => (ObservableCollection)GetValue(PrimaryLinksProperty); + set => SetValue(PrimaryLinksProperty, value); + } + + public string SecondaryLinksHeader + { + get { return (string)GetValue(SecondaryLinksHeaderProperty); } + set { SetValue(SecondaryLinksHeaderProperty, value); } } #pragma warning disable CA2227 // Collection properties should be read only - public ObservableCollection AttributionLinks + public ObservableCollection SecondaryLinks #pragma warning restore CA2227 // Collection properties should be read only { - get => (ObservableCollection)GetValue(AttributionLinksProperty); - set => SetValue(AttributionLinksProperty, value); + get => (ObservableCollection)GetValue(SecondaryLinksProperty); + set => SetValue(SecondaryLinksProperty, value); + } + + public object ModuleContent + { + get { return (object)GetValue(ModuleContentProperty); } + set { SetValue(ModuleContentProperty, value); } } public static readonly DependencyProperty ModuleTitleProperty = DependencyProperty.Register("ModuleTitle", typeof(string), typeof(SettingsPageControl), new PropertyMetadata(default(string))); public static readonly DependencyProperty ModuleDescriptionProperty = DependencyProperty.Register("ModuleDescription", typeof(string), typeof(SettingsPageControl), new PropertyMetadata(default(string))); public static readonly DependencyProperty ModuleImageSourceProperty = DependencyProperty.Register("ModuleImageSource", typeof(string), typeof(SettingsPageControl), new PropertyMetadata(default(string))); public static readonly DependencyProperty ModuleImageLinkProperty = DependencyProperty.Register("ModuleImageLink", typeof(string), typeof(SettingsPageControl), new PropertyMetadata(default(string))); - public static readonly DependencyProperty ModuleLinksProperty = DependencyProperty.Register("ModuleLinks", typeof(ObservableCollection), typeof(SettingsPageControl), new PropertyMetadata(new ObservableCollection())); - public static readonly DependencyProperty AttributionLinksProperty = DependencyProperty.Register("AttributionLinks", typeof(ObservableCollection), typeof(SettingsPageControl), new PropertyMetadata(new ObservableCollection())); + public static readonly DependencyProperty PrimaryLinksProperty = DependencyProperty.Register("PrimaryLinks", typeof(ObservableCollection), typeof(SettingsPageControl), new PropertyMetadata(new ObservableCollection())); + public static readonly DependencyProperty SecondaryLinksHeaderProperty = DependencyProperty.Register("SecondaryLinksHeader", typeof(string), typeof(SettingsPageControl), new PropertyMetadata(default(string))); + public static readonly DependencyProperty SecondaryLinksProperty = DependencyProperty.Register("SecondaryLinks", typeof(ObservableCollection), typeof(SettingsPageControl), new PropertyMetadata(new ObservableCollection())); + public static readonly DependencyProperty ModuleContentProperty = DependencyProperty.Register("ModuleContent", typeof(object), typeof(SettingsPageControl), new PropertyMetadata(new Grid())); } } diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SidePanel/SettingsPageControl.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SidePanel/SettingsPageControl.xaml deleted file mode 100644 index 5908d250f4..0000000000 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SidePanel/SettingsPageControl.xaml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToOpacityConverter.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdateStateToBoolConverter.cs similarity index 55% rename from src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToOpacityConverter.cs rename to src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdateStateToBoolConverter.cs index 0bfae0a848..1eec809aca 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToOpacityConverter.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdateStateToBoolConverter.cs @@ -3,24 +3,33 @@ // See the LICENSE file in the project root for more information. using System; -using Windows.UI.Xaml; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.PowerToys.Settings.UI.Library; using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Media; namespace Microsoft.PowerToys.Settings.UI.Converters { - public sealed class ModuleEnabledToOpacityConverter : IValueConverter + public sealed class UpdateStateToBoolConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { - bool isEnabled = (bool)value; - if (isEnabled) + if (value == null || parameter == null) { - return 1.0; + return false; } else { - return 0.4; + if (value.ToString() == (string)parameter) + { + return true; + } + else + { + return false; + } } } diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateCannotDownloadToVisibilityConverter.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateCannotDownloadToVisibilityConverter.cs deleted file mode 100644 index 26748b6a3f..0000000000 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateCannotDownloadToVisibilityConverter.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation -// The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.PowerToys.Settings.UI.Library; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Data; - -namespace Microsoft.PowerToys.Settings.UI.Converters -{ - public sealed class UpdatingStateCannotDownloadToVisibilityConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, string language) - { - return (UpdatingSettings.UpdatingState)value == UpdatingSettings.UpdatingState.ErrorDownloading ? Visibility.Visible : Visibility.Collapsed; - } - - public object ConvertBack(object value, Type targetType, object parameter, string language) - { - return value; - } - } -} diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateReadyToDownloadToVisibilityConverter.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateReadyToDownloadToVisibilityConverter.cs deleted file mode 100644 index d809338119..0000000000 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateReadyToDownloadToVisibilityConverter.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation -// The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.PowerToys.Settings.UI.Library; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Data; - -namespace Microsoft.PowerToys.Settings.UI.Converters -{ - public sealed class UpdatingStateReadyToDownloadToVisibilityConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, string language) - { - return (UpdatingSettings.UpdatingState)value == UpdatingSettings.UpdatingState.ReadyToDownload ? Visibility.Visible : Visibility.Collapsed; - } - - public object ConvertBack(object value, Type targetType, object parameter, string language) - { - return value; - } - } -} diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateReadyToInstallToVisibilityConverter.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateReadyToInstallToVisibilityConverter.cs deleted file mode 100644 index c9ab831811..0000000000 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateReadyToInstallToVisibilityConverter.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation -// The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.PowerToys.Settings.UI.Library; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Data; - -namespace Microsoft.PowerToys.Settings.UI.Converters -{ - public sealed class UpdatingStateReadyToInstallToVisibilityConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, string language) - { - return (UpdatingSettings.UpdatingState)value == UpdatingSettings.UpdatingState.ReadyToInstall ? Visibility.Visible : Visibility.Collapsed; - } - - public object ConvertBack(object value, Type targetType, object parameter, string language) - { - return value; - } - } -} diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateUpToDateToVisibilityConverter.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateUpToDateToVisibilityConverter.cs deleted file mode 100644 index c60e261d7a..0000000000 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/UpdatingStateUpToDateToVisibilityConverter.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation -// The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.PowerToys.Settings.UI.Library; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Data; - -namespace Microsoft.PowerToys.Settings.UI.Converters -{ - public sealed class UpdatingStateUpToDateToVisibilityConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, string language) - { - return (UpdatingSettings.UpdatingState)value == UpdatingSettings.UpdatingState.UpToDate ? Visibility.Visible : Visibility.Collapsed; - } - - public object ConvertBack(object value, Type targetType, object parameter, string language) - { - return value; - } - } -} diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj index 119079b125..c27ecd9e14 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj @@ -99,24 +99,26 @@ HotkeySettingsControl.xaml + + + ShortcutTextControl.xaml ShortcutVisualControl.xaml - + SettingsPageControl.xaml - + + OOBEPageControl.xaml + + - - - - - + Code @@ -225,6 +227,7 @@ + @@ -267,16 +270,16 @@ - 6.2.10 + 6.2.12 - 6.1.1 + 7.0.2 - 6.1.1 + 7.0.2 - 6.1.2 + 6.1.3 2.6.0-prerelease.210623001 @@ -307,6 +310,14 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -315,7 +326,11 @@ Designer MSBuild:Compile - + + Designer + MSBuild:Compile + + Designer MSBuild:Compile @@ -371,29 +386,21 @@ Designer MSBuild:Compile - - MSBuild:Compile - Designer - MSBuild:Compile Designer - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - + Designer MSBuild:Compile - - MSBuild:Compile + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile MSBuild:Compile diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/OOBE/Views/OobeAwake.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/OOBE/Views/OobeAwake.xaml index 0a47c5765b..70e837e1e9 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/OOBE/Views/OobeAwake.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/OOBE/Views/OobeAwake.xaml @@ -5,67 +5,33 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" - xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls" - Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> + xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"> - - - - - - - - - - - - - - - - - - - - - + + + + Style="{ThemeResource OobeSubtitleStyle}" /> - + + Style="{ThemeResource OobeSubtitleStyle}"/> - - + + - + + + + + + + + + + + + + + + - - + + - + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + \ No newline at end of file diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml.cs index 9ef3a0f604..4dcd8a173a 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml.cs @@ -50,7 +50,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views private void ReorderButtonUp_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { - ColorFormatModel color = ((Button)sender).DataContext as ColorFormatModel; + ColorFormatModel color = ((MenuFlyoutItem)sender).DataContext as ColorFormatModel; if (color == null) { return; @@ -65,7 +65,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views private void ReorderButtonDown_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { - ColorFormatModel color = ((Button)sender).DataContext as ColorFormatModel; + ColorFormatModel color = ((MenuFlyoutItem)sender).DataContext as ColorFormatModel; if (color == null) { return; diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml index 963a4d9ef8..88c600304d 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml @@ -8,310 +8,289 @@ xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls" xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters" mc:Ignorable="d" - Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" AutomationProperties.LandmarkType="Main"> - - - + + + + + + + + - - - + + + - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - + + + + + + + - + + + + + + + + + + + + + + + + + + - + + + + + - + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + \ No newline at end of file diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml index f1501fb0b5..3794fb94ab 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml @@ -7,227 +7,233 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters" xmlns:localConverters="using:Microsoft.PowerToys.Settings.UI.Converters" + xmlns:muxc="using:Microsoft.UI.Xaml.Controls" mc:Ignorable="d" - Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" AutomationProperties.LandmarkType="Main"> - - - - - + + - - - - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + \ No newline at end of file diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/KeyboardManagerPage.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/KeyboardManagerPage.xaml index a21fac9b67..793578b88b 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/KeyboardManagerPage.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/KeyboardManagerPage.xaml @@ -5,11 +5,9 @@ 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:extensions="using:Microsoft.Toolkit.Uwp.UI.Extensions" xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls" xmlns:Lib="using:Microsoft.PowerToys.Settings.UI.Library" mc:Ignorable="d" - Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" AutomationProperties.LandmarkType="Main"> @@ -17,296 +15,205 @@ - + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + - + - + + + + + + + + + + + + + - + + + + + + + + + + + + - + + + + + - + + + + + + + + - + + + + + + + - - -