[Settings][Awake]Show display option on indefinite (#22596)

This commit is contained in:
Jaime Bernardo 2022-12-09 16:27:49 +00:00 committed by GitHub
parent febe1aa9a0
commit 7d53b9a5b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -76,6 +76,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
GeneralSettingsConfig.Enabled.Awake = value;
OnPropertyChanged(nameof(IsEnabled));
OnPropertyChanged(nameof(IsTimeConfigurationEnabled));
OnPropertyChanged(nameof(IsScreenConfigurationPossibleEnabled));
OutGoingGeneralSettings outgoing = new OutGoingGeneralSettings(GeneralSettingsConfig);
SendConfigMSG(outgoing.ToString());
@ -94,6 +95,11 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
get => _mode == AwakeMode.TIMED && _isEnabled;
}
public bool IsScreenConfigurationPossibleEnabled
{
get => _mode != AwakeMode.PASSIVE && _isEnabled;
}
public AwakeMode Mode
{
get => _mode;
@ -104,6 +110,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
_mode = value;
OnPropertyChanged(nameof(Mode));
OnPropertyChanged(nameof(IsTimeConfigurationEnabled));
OnPropertyChanged(nameof(IsScreenConfigurationPossibleEnabled));
Settings.Properties.Mode = value;
NotifyPropertyChanged();

View File

@ -83,7 +83,7 @@
<labs:SettingsCard
x:Uid="Awake_EnableDisplayKeepAwake"
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=&#xE7FB;}"
Visibility="{x:Bind ViewModel.IsTimeConfigurationEnabled, Mode=OneWay}">
Visibility="{x:Bind ViewModel.IsScreenConfigurationPossibleEnabled, Mode=OneWay}">
<ToggleSwitch
x:Uid="ToggleSwitch"
IsOn="{x:Bind ViewModel.KeepDisplayOn, Mode=TwoWay}" />