Skip to content

Commit 126a03e

Browse files
authored
[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
1 parent bf42abc commit 126a03e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPaste.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@
9191
<InfoBar
9292
x:Uid="GPO_SettingIsManaged"
9393
IsClosable="False"
94-
IsOpen="{x:Bind ViewModel.ClipboardHistoryDisabledByGPO, Mode=OneWay}"
95-
IsTabStop="{x:Bind ViewModel.ClipboardHistoryDisabledByGPO, Mode=OneWay}"
94+
IsOpen="{x:Bind ViewModel.ShowClipboardHistoryIsGpoConfiguredInfoBar, Mode=OneWay}"
95+
IsTabStop="{x:Bind ViewModel.ShowClipboardHistoryIsGpoConfiguredInfoBar, Mode=OneWay}"
9696
Severity="Informational" />
9797
</controls:SettingsGroup>
9898

src/settings-ui/Settings.UI/ViewModels/AdvancedPasteViewModel.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ public bool IsEnabled
108108
{
109109
_isEnabled = value;
110110
OnPropertyChanged(nameof(IsEnabled));
111+
OnPropertyChanged(nameof(ShowOnlineAIModelsGpoConfiguredInfoBar));
112+
OnPropertyChanged(nameof(ShowClipboardHistoryIsGpoConfiguredInfoBar));
111113

112114
// Set the status of AdvancedPaste in the general settings
113115
GeneralSettingsConfig.Enabled.AdvancedPaste = value;
@@ -149,7 +151,7 @@ public bool IsOnlineAIModelsDisallowedByGPO
149151

150152
public bool ShowOnlineAIModelsGpoConfiguredInfoBar
151153
{
152-
get => _onlineAIModelsDisallowedByGPO && _enabledGpoRuleConfiguration != GpoRuleConfigured.Disabled;
154+
get => _onlineAIModelsDisallowedByGPO && _isEnabled;
153155
}
154156

155157
private bool IsClipboardHistoryEnabled()
@@ -216,6 +218,11 @@ public bool ClipboardHistoryDisabledByGPO
216218
get => IsClipboardHistoryDisabledByGPO();
217219
}
218220

221+
public bool ShowClipboardHistoryIsGpoConfiguredInfoBar
222+
{
223+
get => IsClipboardHistoryDisabledByGPO() && _isEnabled;
224+
}
225+
219226
public HotkeySettings AdvancedPasteUIShortcut
220227
{
221228
get => _advancedPasteSettings.Properties.AdvancedPasteUIShortcut;
@@ -332,6 +339,8 @@ public void RefreshEnabledState()
332339
{
333340
InitializeEnabledValue();
334341
OnPropertyChanged(nameof(IsEnabled));
342+
OnPropertyChanged(nameof(ShowOnlineAIModelsGpoConfiguredInfoBar));
343+
OnPropertyChanged(nameof(ShowClipboardHistoryIsGpoConfiguredInfoBar));
335344
}
336345

337346
protected virtual void Dispose(bool disposing)

0 commit comments

Comments
 (0)