[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 1a5c887eae.

* Revert "Move file"

This reverts commit 2b06c75c1f.

* Revert "Removing redunant files"

This reverts commit fe79ec1701.

* Revert "Clean up"

This reverts commit 028e15fab6.

* Removed redundant styles

* Revert "Removed redundant styles"

This reverts commit dfdfd65021.

* 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 <niels9001@hotmail.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
This commit is contained in:
Niels Laute
2021-08-23 19:48:52 +02:00
committed by GitHub
parent c125cc281d
commit eb2ef7070b
68 changed files with 3652 additions and 3362 deletions

View File

@@ -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);
}

View File

@@ -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 = "")

View File

@@ -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();
}
}

View File

@@ -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();
}
}
}