mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +02:00
[GPO]Add setting to disallow experimentation (#24131)
* [GPO]Add policy to disallow experimentation * Refresh experimentation setting UI * Reflect gpo value in Settings UI * Fix adml errors * Update src/settings-ui/Settings.UI/Strings/en-us/Resources.resw * Update src/settings-ui/Settings.UI/Strings/en-us/Resources.resw * Update src/gpo/assets/en-US/PowerToys.adml * Small grammar fixes * Update src/gpo/assets/en-US/PowerToys.adml --------- Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
This commit is contained in:
@@ -6,6 +6,7 @@ using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using AllExperiments;
|
||||
using global::PowerToys.GPOWrapper;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
@@ -195,7 +196,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
switch (selectedItem.Tag)
|
||||
{
|
||||
case "Overview":
|
||||
if (ExperimentationToggleSwitchEnabled)
|
||||
if (ExperimentationToggleSwitchEnabled && GPOWrapper.GetAllowExperimentationValue() != GpoRuleConfigured.Disabled)
|
||||
{
|
||||
switch (AllExperiments.Experiments.LandingPageExperiment)
|
||||
{
|
||||
|
||||
@@ -2922,11 +2922,17 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<data name="Alternate_OOBE_Run_Title.Text" xml:space="preserve">
|
||||
<value>PowerToys Run</value>
|
||||
</data>
|
||||
<data name="General_Experimentation.Header" xml:space="preserve">
|
||||
<value>Experimentation</value>
|
||||
</data>
|
||||
<data name="GeneralPage_EnableExperimentation.Description" xml:space="preserve">
|
||||
<value>Only affects Windows Insider builds</value>
|
||||
<value>Note: Only Windows Insider builds may be selected for experimentation</value>
|
||||
</data>
|
||||
<data name="GeneralPage_EnableExperimentation.Header" xml:space="preserve">
|
||||
<value>Enable experimentation</value>
|
||||
<value>Allow experimentation with new features</value>
|
||||
</data>
|
||||
<data name="GPO_ExperimentationIsDisallowed.Title" xml:space="preserve">
|
||||
<value>The system administrator has disabled experimentation.</value>
|
||||
</data>
|
||||
<data name="AllAppsTxt.Text" xml:space="preserve">
|
||||
<value>All apps</value>
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using global::PowerToys.GPOWrapper;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
@@ -140,6 +141,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
_newAvailableVersionLink = UpdatingSettingsConfig.ReleasePageLink;
|
||||
_updateCheckedDate = UpdatingSettingsConfig.LastCheckedDateLocalized;
|
||||
|
||||
_experimentationIsGpoDisallowed = GPOWrapper.GetAllowExperimentationValue() == GpoRuleConfigured.Disabled;
|
||||
|
||||
if (dispatcherAction != null)
|
||||
{
|
||||
_fileWatcher = Helper.GetFileWatcher(string.Empty, UpdatingSettings.SettingsFile, dispatcherAction);
|
||||
@@ -154,6 +157,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
private bool _autoDownloadUpdates;
|
||||
private bool _enableExperimentation;
|
||||
private bool _experimentationIsGpoDisallowed;
|
||||
|
||||
private UpdatingSettings.UpdatingState _updatingState = UpdatingSettings.UpdatingState.UpToDate;
|
||||
private string _newAvailableVersion = string.Empty;
|
||||
@@ -290,7 +294,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return _enableExperimentation;
|
||||
return _enableExperimentation && !_experimentationIsGpoDisallowed;
|
||||
}
|
||||
|
||||
set
|
||||
@@ -304,6 +308,11 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsExperimentationGpoDisallowed
|
||||
{
|
||||
get => _experimentationIsGpoDisallowed;
|
||||
}
|
||||
|
||||
public static bool AutoUpdatesEnabled
|
||||
{
|
||||
get
|
||||
|
||||
@@ -369,12 +369,6 @@
|
||||
</labs:SettingsCard>
|
||||
</labs:SettingsExpander.Items>
|
||||
</labs:SettingsExpander>
|
||||
<labs:SettingsCard x:Uid="GeneralPage_EnableExperimentation"
|
||||
HeaderIcon="{ui:BitmapIcon Source=/Assets/FluentIcons/FluentIconsExperimentation.png}">
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
IsOn="{Binding Mode=TwoWay, Path=EnableExperimentation}" />
|
||||
</labs:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
<InfoBar
|
||||
x:Uid="General_SettingsBackupMessageResults"
|
||||
@@ -383,6 +377,23 @@
|
||||
IsOpen="{Binding SettingsBackupRestoreMessageVisible, Mode=OneWay}"
|
||||
IsTabStop="{Binding SettingsBackupRestoreMessageVisible, Mode=OneWay}"
|
||||
Severity="{Binding BackupRestoreMessageSeverity, Converter={StaticResource StringToInfoBarSeverityConverter}}" />
|
||||
<controls:SettingsGroup
|
||||
x:Uid="General_Experimentation"
|
||||
Visibility="Visible">
|
||||
<labs:SettingsCard x:Uid="GeneralPage_EnableExperimentation"
|
||||
HeaderIcon="{ui:BitmapIcon Source=/Assets/FluentIcons/FluentIconsExperimentation.png}">
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsExperimentationGpoDisallowed, Converter={StaticResource BoolNegationConverter}}"
|
||||
IsOn="{Binding Mode=TwoWay, Path=EnableExperimentation}" />
|
||||
</labs:SettingsCard>
|
||||
<InfoBar
|
||||
x:Uid="GPO_ExperimentationIsDisallowed"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsExperimentationGpoDisallowed}"
|
||||
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsExperimentationGpoDisallowed}"
|
||||
Severity="Informational" />
|
||||
</controls:SettingsGroup>
|
||||
</StackPanel>
|
||||
|
||||
</controls:SettingsPageControl.ModuleContent>
|
||||
|
||||
Reference in New Issue
Block a user