mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +02:00
[Settings]Update GPO infobar icon, improve some pages and fix bugs (#33703)
* changes part 1 * fix xaml code * changes part 2 * fix cmdNotFound page * Update PowerOcrPage * More Pages changed * More Pages changed * revert temporary change * fix spelling * add resw comment * add resw comment * Update MouseWihtoutBorderPage.xaml * PowerPreview page * workspaces page * fix awake page gpo handling * NewPlus page * update new+ page! * AdvancedPaste.xaml: Move Info bar. * Update MouseJumpPanel.xaml * Update GeneralPage.xaml * fix position of info bar and some ui quirks * fix xaml style * fix string resources * string changes * prepare megre main * update new+ page * zoomit page * various fixes
This commit is contained in:
@@ -33,7 +33,18 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
public bool IsEnabled
|
||||
{
|
||||
get => _isEnabled;
|
||||
get
|
||||
{
|
||||
if (_enabledStateIsGPOConfigured)
|
||||
{
|
||||
return _enabledGPOConfiguration;
|
||||
}
|
||||
else
|
||||
{
|
||||
return _isEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_isEnabled != value)
|
||||
@@ -66,6 +77,19 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool EnabledGPOConfiguration
|
||||
{
|
||||
get => _enabledGPOConfiguration;
|
||||
set
|
||||
{
|
||||
if (_enabledGPOConfiguration != value)
|
||||
{
|
||||
_enabledGPOConfiguration = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsExpirationConfigurationEnabled => ModuleSettings.Properties.Mode == AwakeMode.EXPIRABLE && IsEnabled;
|
||||
|
||||
public bool IsTimeConfigurationEnabled => ModuleSettings.Properties.Mode == AwakeMode.TIMED && IsEnabled;
|
||||
@@ -198,6 +222,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
|
||||
private bool _enabledStateIsGPOConfigured;
|
||||
private bool _enabledGPOConfiguration;
|
||||
private AwakeSettings _moduleSettings;
|
||||
private bool _isEnabled;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
public ButtonClickCommand UninstallModuleEventHandler => new ButtonClickCommand(UninstallModule);
|
||||
|
||||
private GpoRuleConfigured _enabledGpoRuleConfiguration;
|
||||
private bool _enabledStateIsGPOConfigured;
|
||||
private bool _moduleIsGpoEnabled;
|
||||
private bool _moduleIsGpoDisabled;
|
||||
|
||||
public static string AssemblyDirectory
|
||||
{
|
||||
@@ -53,11 +54,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
private void InitializeEnabledValue()
|
||||
{
|
||||
_enabledGpoRuleConfiguration = GPOWrapper.GetConfiguredCmdNotFoundEnabledValue();
|
||||
if (_enabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _enabledGpoRuleConfiguration == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
// Get the enabled state from GPO.
|
||||
_enabledStateIsGPOConfigured = true;
|
||||
}
|
||||
_moduleIsGpoEnabled = _enabledGpoRuleConfiguration == GpoRuleConfigured.Enabled;
|
||||
_moduleIsGpoDisabled = _enabledGpoRuleConfiguration == GpoRuleConfigured.Disabled;
|
||||
|
||||
// Update PATH environment variable to get pwsh.exe on further calls.
|
||||
Environment.SetEnvironmentVariable("PATH", (Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine) ?? string.Empty) + ";" + (Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty), EnvironmentVariableTarget.Process);
|
||||
@@ -128,9 +126,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEnabledGpoConfigured
|
||||
public bool IsModuleGpoEnabled
|
||||
{
|
||||
get => _enabledStateIsGPOConfigured;
|
||||
get => _moduleIsGpoEnabled;
|
||||
}
|
||||
|
||||
public bool IsModuleGpoDisabled
|
||||
{
|
||||
get => _moduleIsGpoDisabled;
|
||||
}
|
||||
|
||||
public string RunPowerShellOrPreviewScript(string powershellExecutable, string powershellArguments, bool hidePowerShellWindow = false)
|
||||
|
||||
@@ -264,6 +264,12 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public string SnippingToolInfoBarMargin
|
||||
{
|
||||
// Workaround for wrong StackPanel behavior: On hidden controls the margin is still reserved.
|
||||
get => IsWin11OrGreater ? "0,0,0,25" : "0,0,0,0";
|
||||
}
|
||||
|
||||
private string EnsureStartUpper(string input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input))
|
||||
|
||||
Reference in New Issue
Block a user