mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[Settings]Fix MWB infobars to hide when the module is disabled (#33562)
## Summary of the Pull Request This PR fixes two bugs for the info bars on the MWB settings page: - The bars are shown if module is disabled. - Some bars can be closed. - Some bars are reacting to tab stop on closed state.
This commit is contained in:
@@ -92,6 +92,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
Settings.Properties.UseService = value;
|
||||
OnPropertyChanged(nameof(UseService));
|
||||
OnPropertyChanged(nameof(CanUninstallService));
|
||||
OnPropertyChanged(nameof(ShowInfobarRunAsAdminText));
|
||||
|
||||
// Must block here until the process exits
|
||||
Task.Run(async () =>
|
||||
@@ -566,6 +567,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
_isEnabled = value;
|
||||
GeneralSettingsConfig.Enabled.MouseWithoutBorders = value;
|
||||
OnPropertyChanged(nameof(IsEnabled));
|
||||
OnPropertyChanged(nameof(ShowInfobarRunAsAdminText));
|
||||
OnPropertyChanged(nameof(ShowInfobarCannotDragDropAsAdmin));
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
@@ -1045,6 +1048,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
public void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
OnPropertyChanged(propertyName);
|
||||
|
||||
// Skip saving settings for UI properties
|
||||
if (propertyName == nameof(ShowInfobarCannotDragDropAsAdmin) ||
|
||||
propertyName == nameof(ShowInfobarRunAsAdminText))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SettingsUtils.SaveSettings(Settings.ToJsonString(), MouseWithoutBordersSettings.ModuleName);
|
||||
|
||||
if (propertyName == nameof(UseService))
|
||||
@@ -1071,5 +1082,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
SendCustomAction("uninstall_service");
|
||||
}
|
||||
|
||||
public bool ShowInfobarCannotDragDropAsAdmin
|
||||
{
|
||||
get { return IsElevated && IsEnabled; }
|
||||
}
|
||||
|
||||
public bool ShowInfobarRunAsAdminText
|
||||
{
|
||||
get { return !CanToggleUseService && IsEnabled; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user