🧼 PowerToys Awake (#11593)

* Scrubbing name conventions

* Fix naming for projects

* Fix folder naming

* More folder cleanup

* More left-over file changes

* Reverting LCL files, because these will be handled by the loc team

* Remove legacy file that is no longer used.

* Update latest
This commit is contained in:
Den Delimarsky
2021-06-09 09:13:58 -07:00
committed by GitHub
parent c9c54b7780
commit c5e464a704
49 changed files with 272 additions and 271 deletions

View File

@@ -6,30 +6,30 @@ using System.Text.Json.Serialization;
namespace Microsoft.PowerToys.Settings.UI.Library
{
public class EspressoProperties
public class AwakeProperties
{
public EspressoProperties()
public AwakeProperties()
{
KeepDisplayOn = false;
Mode = EspressoMode.PASSIVE;
Mode = AwakeMode.PASSIVE;
Hours = 0;
Minutes = 0;
}
[JsonPropertyName("espresso_keep_display_on")]
[JsonPropertyName("awake_keep_display_on")]
public bool KeepDisplayOn { get; set; }
[JsonPropertyName("espresso_mode")]
public EspressoMode Mode { get; set; }
[JsonPropertyName("awake_mode")]
public AwakeMode Mode { get; set; }
[JsonPropertyName("espresso_hours")]
[JsonPropertyName("awake_hours")]
public uint Hours { get; set; }
[JsonPropertyName("espresso_minutes")]
[JsonPropertyName("awake_minutes")]
public uint Minutes { get; set; }
}
public enum EspressoMode
public enum AwakeMode
{
PASSIVE = 0,
INDEFINITE = 1,

View File

@@ -7,20 +7,20 @@ using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
namespace Microsoft.PowerToys.Settings.UI.Library
{
public class EspressoSettings : BasePTModuleSettings, ISettingsConfig
public class AwakeSettings : BasePTModuleSettings, ISettingsConfig
{
public const string ModuleName = "Espresso";
public const string ModuleName = "Awake";
public const string ModuleVersion = "0.0.1";
public EspressoSettings()
public AwakeSettings()
{
Name = ModuleName;
Version = ModuleVersion;
Properties = new EspressoProperties();
Properties = new AwakeProperties();
}
[JsonPropertyName("properties")]
public EspressoProperties Properties { get; set; }
public AwakeProperties Properties { get; set; }
public string GetModuleName()
{

View File

@@ -143,18 +143,18 @@ namespace Microsoft.PowerToys.Settings.UI.Library
}
}
private bool espresso;
private bool awake;
[JsonPropertyName("Espresso")]
public bool Espresso
[JsonPropertyName("Awake")]
public bool Awake
{
get => espresso;
get => awake;
set
{
if (espresso != value)
if (awake != value)
{
LogTelemetryEvent(value);
espresso = value;
awake = value;
}
}
}

View File

@@ -2,24 +2,21 @@
// 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 System.Collections.Generic;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Microsoft.PowerToys.Settings.UI.Library
{
public class SndEspressoSettings
public class SndAwakeSettings
{
[JsonPropertyName("Espresso")]
public EspressoSettings Settings { get; set; }
[JsonPropertyName("Awake")]
public AwakeSettings Settings { get; set; }
public SndEspressoSettings()
public SndAwakeSettings()
{
}
public SndEspressoSettings(EspressoSettings settings)
public SndAwakeSettings(AwakeSettings settings)
{
Settings = settings;
}

View File

@@ -9,15 +9,15 @@ using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
{
public class EspressoViewModel : Observable
public class AwakeViewModel : Observable
{
private GeneralSettings GeneralSettingsConfig { get; set; }
private EspressoSettings Settings { get; set; }
private AwakeSettings Settings { get; set; }
private Func<string, int> SendConfigMSG { get; }
public EspressoViewModel(ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<EspressoSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
public AwakeViewModel(ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<AwakeSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
{
// To obtain the general settings configurations of PowerToys Settings.
if (settingsRepository == null)
@@ -35,7 +35,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
Settings = moduleSettingsRepository.SettingsConfig;
_isEnabled = GeneralSettingsConfig.Enabled.Espresso;
_isEnabled = GeneralSettingsConfig.Enabled.Awake;
_keepDisplayOn = Settings.Properties.KeepDisplayOn;
_mode = Settings.Properties.Mode;
_hours = Settings.Properties.Hours;
@@ -54,7 +54,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
{
_isEnabled = value;
GeneralSettingsConfig.Enabled.Espresso = value;
GeneralSettingsConfig.Enabled.Awake = value;
OnPropertyChanged(nameof(IsEnabled));
OnPropertyChanged(nameof(IsTimeConfigurationEnabled));
@@ -67,10 +67,10 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
public bool IsTimeConfigurationEnabled
{
get => _mode == EspressoMode.TIMED && _isEnabled;
get => _mode == AwakeMode.TIMED && _isEnabled;
}
public EspressoMode Mode
public AwakeMode Mode
{
get => _mode;
set
@@ -140,8 +140,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
OnPropertyChanged(propertyName);
if (SendConfigMSG != null)
{
SndEspressoSettings outsettings = new SndEspressoSettings(Settings);
SndModuleSettings<SndEspressoSettings> ipcMessage = new SndModuleSettings<SndEspressoSettings>(outsettings);
SndAwakeSettings outsettings = new SndAwakeSettings(Settings);
SndModuleSettings<SndAwakeSettings> ipcMessage = new SndModuleSettings<SndAwakeSettings>(outsettings);
var targetMessage = ipcMessage.ToJsonString();
SendConfigMSG(targetMessage);
@@ -152,6 +152,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private uint _hours;
private uint _minutes;
private bool _keepDisplayOn;
private EspressoMode _mode;
private AwakeMode _mode;
}
}

View File

@@ -8,7 +8,7 @@ using Windows.UI.Xaml.Data;
namespace Microsoft.PowerToys.Settings.UI.Converters
{
public sealed class EspressoModeToBoolConverter : IValueConverter
public sealed class AwakeModeToBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
@@ -19,11 +19,11 @@ namespace Microsoft.PowerToys.Settings.UI.Converters
if (parameter == null)
{
throw new NullReferenceException("Parameter cannot be null for the Espresso mode to bool converter.");
throw new NullReferenceException("Parameter cannot be null for the PowerToys Awake mode to bool converter.");
}
var expectedMode = (EspressoMode)Enum.Parse(typeof(EspressoMode), parameter.ToString());
var currentMode = (EspressoMode)value;
var expectedMode = (AwakeMode)Enum.Parse(typeof(AwakeMode), parameter.ToString());
var currentMode = (AwakeMode)value;
return currentMode.Equals(expectedMode);
}
@@ -32,10 +32,10 @@ namespace Microsoft.PowerToys.Settings.UI.Converters
{
if (parameter == null)
{
throw new NullReferenceException("Parameter cannot be null for the Espresso mode to bool converter.");
throw new NullReferenceException("Parameter cannot be null for the PowerToys Awake mode to bool converter.");
}
return (EspressoMode)Enum.Parse(typeof(EspressoMode), parameter.ToString());
return (AwakeMode)Enum.Parse(typeof(AwakeMode), parameter.ToString());
}
}
}

View File

@@ -105,7 +105,7 @@
<Compile Include="Controls\ShortcutVisualControl.xaml.cs">
<DependentUpon>ShortcutVisualControl.xaml</DependentUpon>
</Compile>
<Compile Include="Converters\EspressoModeToBoolConverter.cs" />
<Compile Include="Converters\AwakeModeToBoolConverter.cs" />
<Compile Include="Converters\ModuleEnabledToForegroundConverter.cs" />
<Compile Include="Converters\UpdatingStateCannotDownloadToVisibilityConverter.cs" />
<Compile Include="Converters\UpdatingStateReadyToDownloadToVisibilityConverter.cs" />
@@ -126,8 +126,8 @@
<Compile Include="OOBE\Enums\PowerToysModulesEnum.cs" />
<Compile Include="OOBE\ViewModel\OobeShellViewModel.cs" />
<Compile Include="OOBE\ViewModel\OobePowerToysModule.cs" />
<Compile Include="OOBE\Views\OobeEspresso.xaml.cs">
<DependentUpon>OobeEspresso.xaml</DependentUpon>
<Compile Include="OOBE\Views\OobeAwake.xaml.cs">
<DependentUpon>OobeAwake.xaml</DependentUpon>
</Compile>
<Compile Include="OOBE\Views\OobeColorPicker.xaml.cs">
<DependentUpon>OobeColorPicker.xaml</DependentUpon>
@@ -166,8 +166,8 @@
<Compile Include="Services\NavigationService.cs" />
<Compile Include="ViewModels\Commands\ButtonClickCommand.cs" />
<Compile Include="ViewModels\ShellViewModel.cs" />
<Compile Include="Views\EspressoPage.xaml.cs">
<DependentUpon>EspressoPage.xaml</DependentUpon>
<Compile Include="Views\AwakePage.xaml.cs">
<DependentUpon>AwakePage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ColorPickerPage.xaml.cs">
<DependentUpon>ColorPickerPage.xaml</DependentUpon>
@@ -208,7 +208,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="Assets\FluentIcons\FluentIconsColorPicker.png" />
<Content Include="Assets\FluentIcons\FluentIconsEspresso.png" />
<Content Include="Assets\FluentIcons\FluentIconsAwake.png" />
<Content Include="Assets\FluentIcons\FluentIconsFancyZones.png" />
<Content Include="Assets\FluentIcons\FluentIconsFileExplorerPreview.png" />
<Content Include="Assets\FluentIcons\FluentIconsImageResizer.png" />
@@ -220,12 +220,12 @@
<Content Include="Assets\FluentIcons\FluentIconsVideoConferenceMute.png" />
<Content Include="Assets\Logo.scale-200.png" />
<Content Include="Assets\Modules\ColorPicker.png" />
<Content Include="Assets\Modules\Espresso.png" />
<Content Include="Assets\Modules\Awake.png" />
<Content Include="Assets\Modules\FancyZones.png" />
<Content Include="Assets\Modules\ImageResizer.png" />
<Content Include="Assets\Modules\KBM.png" />
<Content Include="Assets\Modules\OOBE\ColorPicker.gif" />
<Content Include="Assets\Modules\OOBE\Espresso.png" />
<Content Include="Assets\Modules\OOBE\Awake.png" />
<Content Include="Assets\Modules\OOBE\FancyZones.gif" />
<Content Include="Assets\Modules\OOBE\FileExplorer.png" />
<Content Include="Assets\Modules\OOBE\ImageResizer.gif" />
@@ -308,7 +308,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="OOBE\Views\OobeEspresso.xaml">
<Page Include="OOBE\Views\OobeAwake.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
@@ -384,7 +384,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\EspressoPage.xaml">
<Page Include="Views\AwakePage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
@@ -466,4 +466,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

View File

@@ -8,7 +8,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Enums
{
Overview = 0,
ColorPicker,
Espresso,
Awake,
FancyZones,
FileExplorer,
ImageResizer,

View File

@@ -1,4 +1,4 @@
<Page x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeEspresso"
<Page x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeAwake"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
@@ -42,13 +42,13 @@
AutomationProperties.HeadingLevel="Level3"
Style="{StaticResource OobeSubtitleStyle}" />
<controls:ShortcutTextControl x:Uid="Oobe_Espresso_HowToUse" />
<controls:ShortcutTextControl x:Uid="Oobe_Awake_HowToUse" />
<TextBlock x:Uid="Oobe_TipsAndTricks"
AutomationProperties.HeadingLevel="Level3"
Style="{StaticResource OobeSubtitleStyle}"/>
<controls:ShortcutTextControl x:Uid="Oobe_Espresso_TipsAndTricks" />
<controls:ShortcutTextControl x:Uid="Oobe_Awake_TipsAndTricks" />
<StackPanel Orientation="Horizontal"
Spacing="4"

View File

@@ -2,7 +2,6 @@
// 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.Threading;
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
using Microsoft.PowerToys.Settings.UI.Views;
@@ -14,14 +13,14 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class OobeEspresso : Page
public sealed partial class OobeAwake : Page
{
public OobePowerToysModule ViewModel { get; set; }
public OobeEspresso()
public OobeAwake()
{
this.InitializeComponent();
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModulesEnum.Espresso]);
InitializeComponent();
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModulesEnum.Awake]);
DataContext = ViewModel;
}
@@ -29,7 +28,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
{
if (OobeShellPage.OpenMainWindowCallback != null)
{
OobeShellPage.OpenMainWindowCallback(typeof(EspressoPage));
OobeShellPage.OpenMainWindowCallback(typeof(AwakePage));
}
ViewModel.LogOpeningSettingsEvent();

View File

@@ -81,17 +81,17 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
Description = loader.GetString("Oobe_ColorPicker_Description"),
Link = "https://aka.ms/PowerToysOverview_ColorPicker",
});
Modules.Insert((int)PowerToysModulesEnum.Espresso, new OobePowerToysModule()
Modules.Insert((int)PowerToysModulesEnum.Awake, new OobePowerToysModule()
{
ModuleName = loader.GetString("Oobe_Espresso"),
Tag = "Espresso",
ModuleName = loader.GetString("Oobe_Awake"),
Tag = "Awake",
IsNew = false,
Icon = "\uEC32",
Image = "ms-appx:///Assets/Modules/Espresso.png",
FluentIcon = "ms-appx:///Assets/FluentIcons/FluentIconsEspresso.png",
PreviewImageSource = "ms-appx:///Assets/Modules/OOBE/Espresso.png",
Description = loader.GetString("Oobe_Espresso_Description"),
Link = "https://aka.ms/PowerToysOverview_Espresso",
Image = "ms-appx:///Assets/Modules/Awake.png",
FluentIcon = "ms-appx:///Assets/FluentIcons/FluentIconsAwake.png",
PreviewImageSource = "ms-appx:///Assets/Modules/OOBE/Awake.png",
Description = loader.GetString("Oobe_Awake_Description"),
Link = "https://aka.ms/PowerToysOverview_Awake",
});
Modules.Insert((int)PowerToysModulesEnum.FancyZones, new OobePowerToysModule()
{
@@ -216,7 +216,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
{
case "Overview": NavigationFrame.Navigate(typeof(OobeOverview)); break;
case "ColorPicker": NavigationFrame.Navigate(typeof(OobeColorPicker)); break;
case "Espresso": NavigationFrame.Navigate(typeof(OobeEspresso)); break;
case "Awake": NavigationFrame.Navigate(typeof(OobeAwake)); break;
case "FancyZones": NavigationFrame.Navigate(typeof(OobeFancyZones)); break;
case "Run": NavigationFrame.Navigate(typeof(OobeRun)); break;
case "ImageResizer": NavigationFrame.Navigate(typeof(OobeImageResizer)); break;

View File

@@ -121,9 +121,9 @@
<value>General</value>
<comment>Navigation view item name for General</comment>
</data>
<data name="Shell_Espresso.Content" xml:space="preserve">
<value>Espresso</value>
<comment>Product name: Navigation view item name for Espresso</comment>
<data name="Shell_Awake.Content" xml:space="preserve">
<value>Awake</value>
<comment>Product name: Navigation view item name for Awake</comment>
</data>
<data name="Shell_PowerLauncher.Content" xml:space="preserve">
<value>PowerToys Run</value>
@@ -912,8 +912,8 @@
<value>https://aka.ms/PowerToysOverview_ColorPicker</value>
<comment>URL. Do not loc</comment>
</data>
<data name="Espresso_ImageHyperlinkToDocs.NavigateUri" xml:space="preserve">
<value>https://aka.ms/PowerToysOverview_Espresso</value>
<data name="Awake_ImageHyperlinkToDocs.NavigateUri" xml:space="preserve">
<value>https://aka.ms/PowerToysOverview_Awake</value>
<comment>URL. Do not loc</comment>
</data>
<data name="FancyZones_ImageHyperlinkToDocs.NavigateUri" xml:space="preserve">
@@ -1209,67 +1209,67 @@ From there, simply click on a Markdown file or SVG icon in the File Explorer and
<data name="SettingsWindow_Title" xml:space="preserve">
<value>PowerToys Settings</value>
</data>
<data name="About_Espresso.Text" xml:space="preserve">
<value>About Espresso</value>
<data name="About_Awake.Text" xml:space="preserve">
<value>About Awake</value>
</data>
<data name="Espresso_Description.Text" xml:space="preserve">
<data name="Awake_Description.Text" xml:space="preserve">
<value>A convenient way to keep your PC awake on-demand.</value>
</data>
<data name="Espresso_EnableEspresso.Header" xml:space="preserve">
<value>Enable Espresso</value>
<data name="Awake_EnableAwake.Header" xml:space="preserve">
<value>Enable Awake</value>
</data>
<data name="Espresso_NoKeepAwakeContent.Text" xml:space="preserve">
<data name="Awake_NoKeepAwakeContent.Text" xml:space="preserve">
<value>Off (Passive)</value>
</data>
<data name="Espresso_IndefiniteKeepAwakeContent.Text" xml:space="preserve">
<data name="Awake_IndefiniteKeepAwakeContent.Text" xml:space="preserve">
<value>Keep awake indefinitely</value>
</data>
<data name="Espresso_TemporaryKeepAwakeContent.Text" xml:space="preserve">
<data name="Awake_TemporaryKeepAwakeContent.Text" xml:space="preserve">
<value>Keep awake temporarily</value>
</data>
<data name="Espresso_NoKeepAwakeDescription.Text" xml:space="preserve">
<data name="Awake_NoKeepAwakeDescription.Text" xml:space="preserve">
<value>Your PC operates according to its current power plan</value>
</data>
<data name="Espresso_IndefiniteKeepAwakeDescription.Text" xml:space="preserve">
<data name="Awake_IndefiniteKeepAwakeDescription.Text" xml:space="preserve">
<value>Keeps your PC awake until the setting is disabled</value>
</data>
<data name="Espresso_TemporaryKeepAwakeDescription.Text" xml:space="preserve">
<data name="Awake_TemporaryKeepAwakeDescription.Text" xml:space="preserve">
<value>Keeps your PC awake until the set time elapses</value>
</data>
<data name="Espresso_EnableDisplayKeepAwake.Content" xml:space="preserve">
<data name="Awake_EnableDisplayKeepAwake.Content" xml:space="preserve">
<value>Keep screen on</value>
</data>
<data name="Espresso_Mode.Text" xml:space="preserve">
<data name="Awake_Mode.Text" xml:space="preserve">
<value>Mode</value>
</data>
<data name="Espresso_Behavior_GroupSettings.Text" xml:space="preserve">
<data name="Awake_Behavior_GroupSettings.Text" xml:space="preserve">
<value>Behavior</value>
</data>
<data name="Espresso_TemporaryKeepAwake_Hours.Header" xml:space="preserve">
<data name="Awake_TemporaryKeepAwake_Hours.Header" xml:space="preserve">
<value>Hours</value>
</data>
<data name="Espresso_TemporaryKeepAwake_Minutes.Header" xml:space="preserve">
<data name="Awake_TemporaryKeepAwake_Minutes.Header" xml:space="preserve">
<value>Minutes</value>
</data>
<data name="Espresso_ModuleAttributionLabel.Text" xml:space="preserve">
<value>Den Delimarsky's Espresso</value>
<data name="Awake_ModuleAttributionLabel.Text" xml:space="preserve">
<value>Den Delimarsky's Awake</value>
</data>
<data name="Espresso_ModuleAttributionHyperlink.NavigateUri" xml:space="preserve">
<value>https://espresso.den.dev</value>
<data name="Awake_ModuleAttributionHyperlink.NavigateUri" xml:space="preserve">
<value>https://Awake.den.dev</value>
<comment>URL. Do not loc</comment>
</data>
<data name="Oobe_Espresso" xml:space="preserve">
<value>Espresso</value>
<data name="Oobe_Awake" xml:space="preserve">
<value>Awake</value>
<comment>Module name, do not loc</comment>
</data>
<data name="Oobe_Espresso_Description" xml:space="preserve">
<value>Espresso is a Windows tool designed to keep your PC awake on-demand without having to manage its power settings. This behavior can be helpful when running time-consuming tasks while ensuring that your PC does not go to sleep or turn off its screens.</value>
<data name="Oobe_Awake_Description" xml:space="preserve">
<value>Awake is a Windows tool designed to keep your PC awake on-demand without having to manage its power settings. This behavior can be helpful when running time-consuming tasks while ensuring that your PC does not go to sleep or turn off its screens.</value>
</data>
<data name="Oobe_Espresso_HowToUse.Text" xml:space="preserve">
<value>Open {PowerToys Settings} and enable Espresso</value>
<data name="Oobe_Awake_HowToUse.Text" xml:space="preserve">
<value>Open {PowerToys Settings} and enable Awake</value>
</data>
<data name="Oobe_Espresso_TipsAndTricks.Text" xml:space="preserve">
<value>You can always change modes quickly by {right-clicking the Espresso icon} in the system tray.</value>
<data name="Oobe_Awake_TipsAndTricks.Text" xml:space="preserve">
<value>You can always change modes quickly by {right-clicking the Awake icon} in the system tray.</value>
</data>
<data name="General_FailedToDownloadTheNewVersion.Text" xml:space="preserve">
<value>An error occurred trying to update to</value>

View File

@@ -1,5 +1,5 @@
<Page
x:Class="Microsoft.PowerToys.Settings.UI.Views.EspressoPage"
x:Class="Microsoft.PowerToys.Settings.UI.Views.AwakePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -13,7 +13,7 @@
AutomationProperties.LandmarkType="Main">
<Page.Resources>
<c:EspressoModeToBoolConverter x:Key="EspressoModeToBoolConverter" />
<c:AwakeModeToBoolConverter x:Key="AwakeModeToBoolConverter" />
</Page.Resources>
<Grid RowSpacing="{StaticResource DefaultRowSpacing}">
@@ -50,68 +50,70 @@
</Grid.RowDefinitions>
<StackPanel Orientation="Vertical"
x:Name="EspressoView"
x:Name="AwakeView"
HorizontalAlignment="Left"
Margin="0,0,48,0"
MaxWidth="{StaticResource MaxContentWidth}">
<ToggleSwitch x:Uid="Espresso_EnableEspresso" IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" />
<ToggleSwitch x:Uid="Awake_EnableAwake" IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" />
<TextBlock x:Uid="Espresso_Behavior_GroupSettings"
<TextBlock x:Uid="Awake_Behavior_GroupSettings"
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"
Style="{StaticResource SettingsGroupTitleStyle}"/>
<CheckBox x:Uid="Espresso_EnableDisplayKeepAwake"
<CheckBox x:Uid="Awake_EnableDisplayKeepAwake"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
IsChecked="{x:Bind ViewModel.KeepDisplayOn, Mode=TwoWay}"
Margin="{StaticResource XSmallTopMargin}" />
<TextBlock x:Uid="Espresso_Mode"
<TextBlock x:Uid="Awake_Mode"
Margin="{StaticResource SmallTopMargin}"
x:Name="ModeTitleLabel"
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}" />
<StackPanel AutomationProperties.LabeledBy="{Binding ElementName=ModeTitleLabel}">
<RadioButton x:Uid="Espresso_NoKeepAwake"
<StackPanel AutomationProperties.LabeledBy="{Binding ElementName=ModeTitleLabel}"
Margin="0,-8,0,0">
<RadioButton x:Uid="Awake_NoKeepAwake"
Margin="{StaticResource SmallTopMargin}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
IsChecked="{x:Bind Path=ViewModel.Mode, Mode=TwoWay, Converter={StaticResource EspressoModeToBoolConverter}, ConverterParameter=0}">
IsChecked="{x:Bind Path=ViewModel.Mode, Mode=TwoWay, Converter={StaticResource AwakeModeToBoolConverter}, ConverterParameter=0}">
<RadioButton.Content>
<TextBlock TextWrapping="WrapWholeWords" LineHeight="20">
<Run x:Uid="Espresso_NoKeepAwakeContent"/>
<Run x:Uid="Awake_NoKeepAwakeContent"/>
<LineBreak/>
<Run Foreground="{ThemeResource SystemBaseMediumColor}"
x:Uid="Espresso_NoKeepAwakeDescription"/>
x:Uid="Awake_NoKeepAwakeDescription"/>
</TextBlock>
</RadioButton.Content>
</RadioButton>
<RadioButton x:Uid="Espresso_IndefiniteKeepAwake"
<RadioButton x:Uid="Awake_IndefiniteKeepAwake"
Margin="{StaticResource SmallTopMargin}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
IsChecked="{x:Bind Path=ViewModel.Mode, Mode=TwoWay, Converter={StaticResource EspressoModeToBoolConverter}, ConverterParameter=1}">
IsChecked="{x:Bind Path=ViewModel.Mode, Mode=TwoWay, Converter={StaticResource AwakeModeToBoolConverter}, ConverterParameter=1}">
<RadioButton.Content>
<TextBlock TextWrapping="WrapWholeWords" LineHeight="20">
<Run x:Uid="Espresso_IndefiniteKeepAwakeContent"/>
<Run x:Uid="Awake_IndefiniteKeepAwakeContent"/>
<LineBreak/>
<Run Foreground="{ThemeResource SystemBaseMediumColor}"
x:Uid="Espresso_IndefiniteKeepAwakeDescription"/>
x:Uid="Awake_IndefiniteKeepAwakeDescription"/>
</TextBlock>
</RadioButton.Content>
</RadioButton>
<RadioButton x:Uid="Espresso_TemporaryKeepAwake"
<RadioButton x:Uid="Awake_TemporaryKeepAwake"
Margin="{StaticResource SmallTopMargin}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
IsChecked="{x:Bind Path=ViewModel.Mode, Mode=TwoWay, Converter={StaticResource EspressoModeToBoolConverter}, ConverterParameter=2}">
IsChecked="{x:Bind Path=ViewModel.Mode, Mode=TwoWay, Converter={StaticResource AwakeModeToBoolConverter}, ConverterParameter=2}">
<RadioButton.Content>
<TextBlock TextWrapping="WrapWholeWords" LineHeight="20">
<Run x:Uid="Espresso_TemporaryKeepAwakeContent"/>
<Run x:Uid="Awake_TemporaryKeepAwakeContent"/>
<LineBreak/>
<Run Foreground="{ThemeResource SystemBaseMediumColor}"
x:Uid="Espresso_TemporaryKeepAwakeDescription"/>
x:Uid="Awake_TemporaryKeepAwakeDescription"/>
</TextBlock>
</RadioButton.Content>
</RadioButton>
<StackPanel Margin="28,8,0,0" Orientation="Horizontal">
<muxc:NumberBox x:Uid="Espresso_TemporaryKeepAwake_Hours"
<muxc:NumberBox x:Uid="Awake_TemporaryKeepAwake_Hours"
Value="{x:Bind ViewModel.Hours, Mode=TwoWay}"
Minimum="0"
SpinButtonPlacementMode="Compact"
@@ -120,7 +122,7 @@
IsEnabled="{x:Bind ViewModel.IsTimeConfigurationEnabled, Mode=OneWay}"
SmallChange="1"
LargeChange="5"/>
<muxc:NumberBox x:Uid="Espresso_TemporaryKeepAwake_Minutes"
<muxc:NumberBox x:Uid="Awake_TemporaryKeepAwake_Minutes"
Value="{x:Bind ViewModel.Minutes, Mode=TwoWay}"
Minimum="0"
SpinButtonPlacementMode="Compact"
@@ -139,12 +141,12 @@
Width="{StaticResource SidePanelWidth}"
Grid.Column="1">
<StackPanel x:Name="DescriptionPanel">
<TextBlock x:Uid="About_Espresso"
<TextBlock x:Uid="About_Awake"
x:Name="AboutTitle"
Grid.ColumnSpan="2"
Style="{StaticResource SettingsGroupTitleStyle}"
Margin="{StaticResource XSmallBottomMargin}"/>
<TextBlock x:Uid="Espresso_Description"
<TextBlock x:Uid="Awake_Description"
TextWrapping="Wrap"
Grid.Row="1" />
</StackPanel>
@@ -156,15 +158,15 @@
HorizontalAlignment="Left"
Margin="{StaticResource SmallTopBottomMargin}"
RelativePanel.Below="DescriptionPanel">
<HyperlinkButton x:Uid="Espresso_ImageHyperlinkToDocs">
<Image x:Uid="Espresso_Image" Source="ms-appx:///Assets/Modules/Espresso.png" />
<HyperlinkButton x:Uid="Awake_ImageHyperlinkToDocs">
<Image x:Uid="Awake_Image" Source="ms-appx:///Assets/Modules/Awake.png" />
</HyperlinkButton>
</Border>
<StackPanel x:Name="LinksPanel"
Margin="0,1,0,0"
RelativePanel.Below="AboutImage"
Orientation="Vertical" >
<HyperlinkButton x:Uid="Espresso_ImageHyperlinkToDocs">
<HyperlinkButton x:Uid="Awake_ImageHyperlinkToDocs">
<TextBlock x:Uid="Module_overview" />
</HyperlinkButton>
<HyperlinkButton NavigateUri="https://aka.ms/powerToysGiveFeedback">
@@ -176,11 +178,11 @@
Style="{StaticResource SettingsGroupTitleStyle}" />
<HyperlinkButton Margin="0,-3,0,0"
x:Uid="Espresso_ModuleAttributionHyperlink">
<TextBlock x:Uid="Espresso_ModuleAttributionLabel"
x:Uid="Awake_ModuleAttributionHyperlink">
<TextBlock x:Uid="Awake_ModuleAttributionLabel"
TextWrapping="Wrap" />
</HyperlinkButton>
</StackPanel>
</RelativePanel>
</Grid>
</Page>
</Page>

View File

@@ -8,14 +8,14 @@ using Windows.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class EspressoPage : Page
public sealed partial class AwakePage : Page
{
private EspressoViewModel ViewModel { get; set; }
private AwakeViewModel ViewModel { get; set; }
public EspressoPage()
public AwakePage()
{
var settingsUtils = new SettingsUtils();
ViewModel = new EspressoViewModel(SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), SettingsRepository<EspressoSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
ViewModel = new AwakeViewModel(SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), SettingsRepository<AwakeSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
DataContext = ViewModel;
InitializeComponent();
}

View File

@@ -42,7 +42,7 @@
</winui:NavigationViewItem.Icon>
</winui:NavigationViewItem>
<winui:NavigationViewItem x:Uid="Shell_Espresso" helpers:NavHelper.NavigateTo="views:EspressoPage" AutomationProperties.HeadingLevel="Level1">
<winui:NavigationViewItem x:Uid="Shell_Awake" helpers:NavHelper.NavigateTo="views:AwakePage" AutomationProperties.HeadingLevel="Level1">
<winui:NavigationViewItem.Icon>
<FontIcon Glyph="&#xEC32;"/>
</winui:NavigationViewItem.Icon>