mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
Update settings config.
This commit is contained in:
@@ -63,6 +63,22 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EspressoMode Mode
|
||||||
|
{
|
||||||
|
get => _mode;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_mode != value)
|
||||||
|
{
|
||||||
|
_mode = value;
|
||||||
|
OnPropertyChanged(nameof(Mode));
|
||||||
|
|
||||||
|
Settings.Properties.Mode = value;
|
||||||
|
NotifyPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool KeepDisplayOn
|
public bool KeepDisplayOn
|
||||||
{
|
{
|
||||||
get => _keepDisplayOn;
|
get => _keepDisplayOn;
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation
|
||||||
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.Library;
|
||||||
|
using Windows.UI.Xaml.Data;
|
||||||
|
|
||||||
|
namespace Microsoft.PowerToys.Settings.UI.Converters
|
||||||
|
{
|
||||||
|
public sealed class EspressoModeToBoolConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, string language)
|
||||||
|
{
|
||||||
|
if (targetType != typeof(bool))
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("The target type needs to be a boolean.");
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ((EspressoMode)value)
|
||||||
|
{
|
||||||
|
case EspressoMode.INDEFINITE:
|
||||||
|
return true;
|
||||||
|
case EspressoMode.TIMED:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||||
|
{
|
||||||
|
switch ((bool)value)
|
||||||
|
{
|
||||||
|
case true:
|
||||||
|
return EspressoMode.INDEFINITE;
|
||||||
|
case false:
|
||||||
|
return EspressoMode.TIMED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EspressoMode.INDEFINITE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation
|
||||||
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.Library;
|
||||||
|
using Windows.UI.Xaml.Data;
|
||||||
|
|
||||||
|
namespace Microsoft.PowerToys.Settings.UI.Converters
|
||||||
|
{
|
||||||
|
public sealed class EspressoModeToReverseBoolConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, string language)
|
||||||
|
{
|
||||||
|
if (targetType != typeof(bool))
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("The target type needs to be a boolean.");
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ((EspressoMode)value)
|
||||||
|
{
|
||||||
|
case EspressoMode.INDEFINITE:
|
||||||
|
return false;
|
||||||
|
case EspressoMode.TIMED:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||||
|
{
|
||||||
|
switch ((bool)value)
|
||||||
|
{
|
||||||
|
case false:
|
||||||
|
return EspressoMode.INDEFINITE;
|
||||||
|
case true:
|
||||||
|
return EspressoMode.TIMED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EspressoMode.INDEFINITE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -105,6 +105,8 @@
|
|||||||
<Compile Include="Controls\ShortcutVisualControl.xaml.cs">
|
<Compile Include="Controls\ShortcutVisualControl.xaml.cs">
|
||||||
<DependentUpon>ShortcutVisualControl.xaml</DependentUpon>
|
<DependentUpon>ShortcutVisualControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Converters\EspressoModeToBoolConverter.cs" />
|
||||||
|
<Compile Include="Converters\EspressoModeToReverseBoolConverter.cs" />
|
||||||
<Compile Include="Converters\ModuleEnabledToForegroundConverter.cs" />
|
<Compile Include="Converters\ModuleEnabledToForegroundConverter.cs" />
|
||||||
<Compile Include="Generated Files\AssemblyInfo.cs">
|
<Compile Include="Generated Files\AssemblyInfo.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||||
|
xmlns:c="using:Microsoft.PowerToys.Settings.UI.Converters"
|
||||||
xmlns:Custom="using:Microsoft.PowerToys.Settings.UI.Controls"
|
xmlns:Custom="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||||
xmlns:Color="using:Microsoft.PowerToys.Settings.UI.Library.ViewModels" xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
|
xmlns:Color="using:Microsoft.PowerToys.Settings.UI.Library.ViewModels" xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
@@ -14,6 +15,11 @@
|
|||||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||||
AutomationProperties.LandmarkType="Main">
|
AutomationProperties.LandmarkType="Main">
|
||||||
|
|
||||||
|
<Page.Resources>
|
||||||
|
<c:EspressoModeToBoolConverter x:Key="EspressoModeToBoolConverter" />
|
||||||
|
<c:EspressoModeToReverseBoolConverter x:Key="EspressoModeToReverseBoolConverter" />
|
||||||
|
</Page.Resources>
|
||||||
|
|
||||||
<Grid RowSpacing="{StaticResource DefaultRowSpacing}">
|
<Grid RowSpacing="{StaticResource DefaultRowSpacing}">
|
||||||
<VisualStateManager.VisualStateGroups>
|
<VisualStateManager.VisualStateGroups>
|
||||||
<VisualStateGroup x:Name="LayoutVisualStates">
|
<VisualStateGroup x:Name="LayoutVisualStates">
|
||||||
@@ -70,7 +76,8 @@
|
|||||||
|
|
||||||
<StackPanel Margin="{StaticResource MediumTopMargin}">
|
<StackPanel Margin="{StaticResource MediumTopMargin}">
|
||||||
<RadioButton x:Uid="Espresso_IndefiniteKeepAwake"
|
<RadioButton x:Uid="Espresso_IndefiniteKeepAwake"
|
||||||
IsEnabled="{Binding IsEnabled}">
|
IsEnabled="{Binding IsEnabled}"
|
||||||
|
IsChecked="{Binding Mode, Mode=TwoWay, Converter={StaticResource EspressoModeToBoolConverter}}">
|
||||||
<RadioButton.Content>
|
<RadioButton.Content>
|
||||||
<TextBlock TextWrapping="WrapWholeWords" LineHeight="20">
|
<TextBlock TextWrapping="WrapWholeWords" LineHeight="20">
|
||||||
<Run x:Uid="Espresso_IndefiniteKeepAwakeContent"/>
|
<Run x:Uid="Espresso_IndefiniteKeepAwakeContent"/>
|
||||||
@@ -81,7 +88,8 @@
|
|||||||
</RadioButton.Content>
|
</RadioButton.Content>
|
||||||
</RadioButton>
|
</RadioButton>
|
||||||
<RadioButton x:Uid="Espresso_TemporaryKeepAwake"
|
<RadioButton x:Uid="Espresso_TemporaryKeepAwake"
|
||||||
IsEnabled="{Binding IsEnabled}">
|
IsEnabled="{Binding IsEnabled}"
|
||||||
|
IsChecked="{Binding Mode, Mode=TwoWay, Converter={StaticResource EspressoModeToReverseBoolConverter}}">
|
||||||
<RadioButton.Content>
|
<RadioButton.Content>
|
||||||
<TextBlock TextWrapping="WrapWholeWords" LineHeight="20">
|
<TextBlock TextWrapping="WrapWholeWords" LineHeight="20">
|
||||||
<Run x:Uid="Espresso_TemporaryKeepAwakeContent"/>
|
<Run x:Uid="Espresso_TemporaryKeepAwakeContent"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user