[Settings][AdvPaste]Fix visible gpo infobars on disabled module (#33124)

* Update AdvancedPasteViewModel.cs

* Update AdvancedPasteViewModel.cs

* Update AdvancedPaste.xaml

* Update AdvancedPaste.xaml

* Update AdvancedPasteViewModel.cs

* Fix not updating infobar visibility
This commit is contained in:
Heiko
2024-06-08 22:56:01 +02:00
committed by GitHub
parent bf42abc328
commit 126a03e3b0
2 changed files with 12 additions and 3 deletions

View File

@@ -91,8 +91,8 @@
<InfoBar <InfoBar
x:Uid="GPO_SettingIsManaged" x:Uid="GPO_SettingIsManaged"
IsClosable="False" IsClosable="False"
IsOpen="{x:Bind ViewModel.ClipboardHistoryDisabledByGPO, Mode=OneWay}" IsOpen="{x:Bind ViewModel.ShowClipboardHistoryIsGpoConfiguredInfoBar, Mode=OneWay}"
IsTabStop="{x:Bind ViewModel.ClipboardHistoryDisabledByGPO, Mode=OneWay}" IsTabStop="{x:Bind ViewModel.ShowClipboardHistoryIsGpoConfiguredInfoBar, Mode=OneWay}"
Severity="Informational" /> Severity="Informational" />
</controls:SettingsGroup> </controls:SettingsGroup>

View File

@@ -108,6 +108,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{ {
_isEnabled = value; _isEnabled = value;
OnPropertyChanged(nameof(IsEnabled)); OnPropertyChanged(nameof(IsEnabled));
OnPropertyChanged(nameof(ShowOnlineAIModelsGpoConfiguredInfoBar));
OnPropertyChanged(nameof(ShowClipboardHistoryIsGpoConfiguredInfoBar));
// Set the status of AdvancedPaste in the general settings // Set the status of AdvancedPaste in the general settings
GeneralSettingsConfig.Enabled.AdvancedPaste = value; GeneralSettingsConfig.Enabled.AdvancedPaste = value;
@@ -149,7 +151,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
public bool ShowOnlineAIModelsGpoConfiguredInfoBar public bool ShowOnlineAIModelsGpoConfiguredInfoBar
{ {
get => _onlineAIModelsDisallowedByGPO && _enabledGpoRuleConfiguration != GpoRuleConfigured.Disabled; get => _onlineAIModelsDisallowedByGPO && _isEnabled;
} }
private bool IsClipboardHistoryEnabled() private bool IsClipboardHistoryEnabled()
@@ -216,6 +218,11 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
get => IsClipboardHistoryDisabledByGPO(); get => IsClipboardHistoryDisabledByGPO();
} }
public bool ShowClipboardHistoryIsGpoConfiguredInfoBar
{
get => IsClipboardHistoryDisabledByGPO() && _isEnabled;
}
public HotkeySettings AdvancedPasteUIShortcut public HotkeySettings AdvancedPasteUIShortcut
{ {
get => _advancedPasteSettings.Properties.AdvancedPasteUIShortcut; get => _advancedPasteSettings.Properties.AdvancedPasteUIShortcut;
@@ -332,6 +339,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{ {
InitializeEnabledValue(); InitializeEnabledValue();
OnPropertyChanged(nameof(IsEnabled)); OnPropertyChanged(nameof(IsEnabled));
OnPropertyChanged(nameof(ShowOnlineAIModelsGpoConfiguredInfoBar));
OnPropertyChanged(nameof(ShowClipboardHistoryIsGpoConfiguredInfoBar));
} }
protected virtual void Dispose(bool disposing) protected virtual void Dispose(bool disposing)