mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
Merge branch 'master' into master
This commit is contained in:
@@ -143,6 +143,22 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
}
|
||||
}
|
||||
|
||||
private bool espresso = true;
|
||||
|
||||
[JsonPropertyName("Espresso")]
|
||||
public bool Espresso
|
||||
{
|
||||
get => espresso;
|
||||
set
|
||||
{
|
||||
if (espresso != value)
|
||||
{
|
||||
LogTelemetryEvent(value);
|
||||
espresso = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// 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.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class EspressoProperties
|
||||
{
|
||||
public EspressoProperties()
|
||||
{
|
||||
KeepDisplayOn = false;
|
||||
Mode = EspressoMode.INDEFINITE;
|
||||
Hours = 0;
|
||||
Minutes = 0;
|
||||
}
|
||||
|
||||
[JsonPropertyName("espresso_keep_display_on")]
|
||||
public bool KeepDisplayOn { get; set; }
|
||||
|
||||
[JsonPropertyName("espresso_mode")]
|
||||
public EspressoMode Mode { get; set; }
|
||||
|
||||
[JsonPropertyName("espresso_hours")]
|
||||
public uint Hours { get; set; }
|
||||
|
||||
[JsonPropertyName("espresso_minutes")]
|
||||
public uint Minutes { get; set; }
|
||||
}
|
||||
|
||||
public enum EspressoMode
|
||||
{
|
||||
INDEFINITE = 0,
|
||||
TIMED = 1,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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.Text.Json.Serialization;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class EspressoSettings : BasePTModuleSettings, ISettingsConfig
|
||||
{
|
||||
public const string ModuleName = "Espresso";
|
||||
public const string ModuleVersion = "1.0.0";
|
||||
|
||||
public EspressoSettings()
|
||||
{
|
||||
Name = ModuleName;
|
||||
Version = ModuleVersion;
|
||||
Properties = new EspressoProperties();
|
||||
}
|
||||
|
||||
[JsonPropertyName("properties")]
|
||||
public EspressoProperties Properties { get; set; }
|
||||
|
||||
public string GetModuleName()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public bool UpgradeSettingsConfiguration()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,5 +19,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
bool SettingsExists(string powertoy = "", string fileName = "settings.json");
|
||||
|
||||
void DeleteSettings(string powertoy = "");
|
||||
|
||||
string GetSettingsFilePath(string powertoy = "", string fileName = "settings.json");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
||||
@@ -135,5 +135,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the file path to the settings file, that is exposed from the local ISettingsPath instance.
|
||||
public string GetSettingsFilePath(string powertoy = "", string fileName = "settings.json")
|
||||
{
|
||||
return _settingsPath.GetSettingsPath(powertoy, fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
// 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 System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class SndEspressoSettings
|
||||
{
|
||||
[JsonPropertyName("Espresso")]
|
||||
public EspressoSettings Settings { get; set; }
|
||||
|
||||
public SndEspressoSettings()
|
||||
{
|
||||
}
|
||||
|
||||
public SndEspressoSettings(EspressoSettings settings)
|
||||
{
|
||||
Settings = settings;
|
||||
}
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
// 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 System.Runtime.CompilerServices;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
{
|
||||
public class EspressoViewModel : Observable
|
||||
{
|
||||
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||
|
||||
private EspressoSettings Settings { get; set; }
|
||||
|
||||
private Func<string, int> SendConfigMSG { get; }
|
||||
|
||||
public EspressoViewModel(ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<EspressoSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
|
||||
{
|
||||
// To obtain the general settings configurations of PowerToys Settings.
|
||||
if (settingsRepository == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(settingsRepository));
|
||||
}
|
||||
|
||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||
|
||||
// To obtain the settings configurations of Fancy zones.
|
||||
if (moduleSettingsRepository == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(moduleSettingsRepository));
|
||||
}
|
||||
|
||||
Settings = moduleSettingsRepository.SettingsConfig;
|
||||
|
||||
_isEnabled = GeneralSettingsConfig.Enabled.Espresso;
|
||||
_keepDisplayOn = Settings.Properties.KeepDisplayOn;
|
||||
_mode = Settings.Properties.Mode;
|
||||
_hours = Settings.Properties.Hours;
|
||||
_minutes = Settings.Properties.Minutes;
|
||||
|
||||
// set the callback functions value to hangle outgoing IPC message.
|
||||
SendConfigMSG = ipcMSGCallBackFunc;
|
||||
}
|
||||
|
||||
public bool IsEnabled
|
||||
{
|
||||
get => _isEnabled;
|
||||
set
|
||||
{
|
||||
if (_isEnabled != value)
|
||||
{
|
||||
_isEnabled = value;
|
||||
|
||||
GeneralSettingsConfig.Enabled.Espresso = value;
|
||||
|
||||
var outgoing = new OutGoingGeneralSettings(GeneralSettingsConfig);
|
||||
SendConfigMSG(outgoing.ToString());
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EspressoMode Mode
|
||||
{
|
||||
get => _mode;
|
||||
set
|
||||
{
|
||||
if (_mode != value)
|
||||
{
|
||||
_mode = value;
|
||||
OnPropertyChanged(nameof(Mode));
|
||||
|
||||
Settings.Properties.Mode = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool KeepDisplayOn
|
||||
{
|
||||
get => _keepDisplayOn;
|
||||
set
|
||||
{
|
||||
if (_keepDisplayOn != value)
|
||||
{
|
||||
_keepDisplayOn = value;
|
||||
OnPropertyChanged(nameof(KeepDisplayOn));
|
||||
|
||||
Settings.Properties.KeepDisplayOn = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public uint Hours
|
||||
{
|
||||
get => _hours;
|
||||
set
|
||||
{
|
||||
if (_hours != value)
|
||||
{
|
||||
_hours = value;
|
||||
OnPropertyChanged(nameof(Hours));
|
||||
|
||||
Settings.Properties.Hours = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public uint Minutes
|
||||
{
|
||||
get => _minutes;
|
||||
set
|
||||
{
|
||||
if (_minutes != value)
|
||||
{
|
||||
_minutes = value;
|
||||
OnPropertyChanged(nameof(Minutes));
|
||||
|
||||
Settings.Properties.Minutes = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
OnPropertyChanged(propertyName);
|
||||
if (SendConfigMSG != null)
|
||||
{
|
||||
SndEspressoSettings outsettings = new SndEspressoSettings(Settings);
|
||||
SndModuleSettings<SndEspressoSettings> ipcMessage = new SndModuleSettings<SndEspressoSettings>(outsettings);
|
||||
|
||||
var targetMessage = ipcMessage.ToJsonString();
|
||||
SendConfigMSG(targetMessage);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isEnabled;
|
||||
private uint _hours;
|
||||
private uint _minutes;
|
||||
private bool _keepDisplayOn;
|
||||
private EspressoMode _mode;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
@@ -9,6 +9,9 @@
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutputPath>..\..\..\x64\Debug\SettingsTests\</OutputPath>
|
||||
<DebugType>full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
@@ -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">
|
||||
<DependentUpon>ShortcutVisualControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Converters\EspressoModeToBoolConverter.cs" />
|
||||
<Compile Include="Converters\EspressoModeToReverseBoolConverter.cs" />
|
||||
<Compile Include="Converters\ModuleEnabledToForegroundConverter.cs" />
|
||||
<Compile Include="Generated Files\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
@@ -121,6 +123,9 @@
|
||||
<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>
|
||||
<Compile Include="OOBE\Views\OobeColorPicker.xaml.cs">
|
||||
<DependentUpon>OobeColorPicker.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -158,6 +163,9 @@
|
||||
<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>
|
||||
<Compile Include="Views\ColorPickerPage.xaml.cs">
|
||||
<DependentUpon>ColorPickerPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -197,6 +205,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\FluentIcons\FluentIconsColorPicker.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsEspresso.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsFancyZones.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsFileExplorerPreview.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsImageResizer.png" />
|
||||
@@ -275,7 +284,7 @@
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PRIResource Include="Strings\*\Resources.resw" />
|
||||
<PRIResource Include="Strings\en-us\Resources.resw" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="Controls\HotkeySettingsControl.xaml">
|
||||
@@ -294,6 +303,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="OOBE\Views\OobeEspresso.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="OOBE\Views\OobeColorPicker.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -366,6 +379,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\EspressoPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\ColorPickerPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Enums
|
||||
{
|
||||
Overview = 0,
|
||||
ColorPicker,
|
||||
Espresso,
|
||||
FancyZones,
|
||||
FileExplorer,
|
||||
ImageResizer,
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<Page x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeEspresso"
|
||||
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"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="280" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image Stretch="UniformToFill"
|
||||
Source="{x:Bind ViewModel.PreviewImageSource}" />
|
||||
|
||||
<ScrollViewer Grid.Row="1"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Orientation="Vertical"
|
||||
Margin="{StaticResource OobePageContentMargin}"
|
||||
VerticalAlignment="Top">
|
||||
|
||||
<TextBlock Text="{x:Bind ViewModel.ModuleName}"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
Style="{StaticResource PageTitleStyle}" />
|
||||
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
Margin="0,4,0,0"
|
||||
Text="{x:Bind ViewModel.Description}" />
|
||||
|
||||
<HyperlinkButton NavigateUri="{x:Bind ViewModel.Link}" Margin="0,0,0,4">
|
||||
<TextBlock>
|
||||
<Run x:Uid="Oobe_LearnMore" />
|
||||
<Run Text="{x:Bind ViewModel.ModuleName}" />
|
||||
</TextBlock>
|
||||
</HyperlinkButton>
|
||||
|
||||
<TextBlock x:Uid="Oobe_HowToUse"
|
||||
AutomationProperties.HeadingLevel="Level3"
|
||||
Style="{StaticResource OobeSubtitleStyle}" />
|
||||
|
||||
<controls:ShortcutTextControl x:Uid="Oobe_Espresso_HowToUse" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_TipsAndTricks"
|
||||
AutomationProperties.HeadingLevel="Level3"
|
||||
Style="{StaticResource OobeSubtitleStyle}"/>
|
||||
|
||||
<controls:ShortcutTextControl x:Uid="Oobe_Espresso_TipsAndTricks" />
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="4"
|
||||
Margin="0,32,0,0">
|
||||
<Button Click="SettingsLaunchButton_Click"
|
||||
AutomationProperties.LabeledBy="{Binding ElementName=SettingsLabel}">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<TextBlock Text=""
|
||||
Margin="0,3,0,0"
|
||||
FontFamily="Segoe MDL2 Assets" />
|
||||
<TextBlock x:Uid="OOBE_Settings" Name="SettingsLabel" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,48 @@
|
||||
// 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.Threading;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
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 OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobeEspresso()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModulesEnum.Espresso]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.OpenMainWindowCallback != null)
|
||||
{
|
||||
OobeShellPage.OpenMainWindowCallback(typeof(EspressoPage));
|
||||
}
|
||||
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,6 +88,18 @@ 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()
|
||||
{
|
||||
ModuleName = loader.GetString("Oobe_Espresso"),
|
||||
Tag = "Espresso",
|
||||
IsNew = false,
|
||||
Icon = "\uEC32",
|
||||
Image = "ms-appx:///Assets/Modules/Espresso.png",
|
||||
FluentIcon = "ms-appx:///Assets/FluentIcons/FluentIconsEspresso.png",
|
||||
PreviewImageSource = "ms-appx:///Assets/Modules/OOBE/FancyZones.gif",
|
||||
Description = loader.GetString("Oobe_Espresso_Description"),
|
||||
Link = "https://aka.ms/PowerToysOverview_Espresso",
|
||||
});
|
||||
Modules.Insert((int)PowerToysModulesEnum.FancyZones, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = loader.GetString("Oobe_FancyZones"),
|
||||
@@ -211,6 +223,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 "FancyZones": NavigationFrame.Navigate(typeof(OobeFancyZones)); break;
|
||||
case "Run": NavigationFrame.Navigate(typeof(OobeRun)); break;
|
||||
case "ImageResizer": NavigationFrame.Navigate(typeof(OobeImageResizer)); break;
|
||||
|
||||
@@ -121,6 +121,10 @@
|
||||
<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>
|
||||
<data name="Shell_PowerLauncher.Content" xml:space="preserve">
|
||||
<value>PowerToys Run</value>
|
||||
<comment>Product name: Navigation view item name for PowerToys Run</comment>
|
||||
@@ -905,6 +909,10 @@
|
||||
<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>
|
||||
<comment>URL. Do not loc</comment>
|
||||
</data>
|
||||
<data name="FancyZones_ImageHyperlinkToDocs.NavigateUri" xml:space="preserve">
|
||||
<value>https://aka.ms/PowerToysOverview_FancyZones</value>
|
||||
<comment>URL. Do not loc</comment>
|
||||
@@ -1161,38 +1169,60 @@ 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="Run_PositionAppearance_GroupSettings.Text" xml:space="preserve">
|
||||
<value>Position & appearance</value>
|
||||
<data name="About_Espresso.Text" xml:space="preserve">
|
||||
<value>About Espresso</value>
|
||||
</data>
|
||||
<data name="Run_PositionHeader.Text" xml:space="preserve">
|
||||
<value>Show PowerToys Run on</value>
|
||||
<comment>as in Show PowerToys Run on primary monitor</comment>
|
||||
<data name="Espresso_Description.Text" xml:space="preserve">
|
||||
<value>A convenient way to keep your computer awake on-demand.</value>
|
||||
</data>
|
||||
<data name="Run_Radio_Position_Cursor.Content" xml:space="preserve">
|
||||
<value>Monitor with mouse cursor</value>
|
||||
<data name="Espresso_EnableEspresso.Header" xml:space="preserve">
|
||||
<value>Enable Espresso</value>
|
||||
</data>
|
||||
<data name="Run_Radio_Position_Focus.Content" xml:space="preserve">
|
||||
<value>Monitor with focused window</value>
|
||||
<data name="Espresso_IndefiniteKeepAwakeContent.Text" xml:space="preserve">
|
||||
<value>Keep awake indefinitely</value>
|
||||
</data>
|
||||
<data name="Run_Radio_Position_Primary_Monitor.Content" xml:space="preserve">
|
||||
<value>Primary monitor</value>
|
||||
<data name="Espresso_TemporaryKeepAwakeContent.Text" xml:space="preserve">
|
||||
<value>Keep awake temporarily</value>
|
||||
</data>
|
||||
<data name="Run_PluginsLoading.Text" xml:space="preserve">
|
||||
<value>Plugins are loading...</value>
|
||||
<data name="Espresso_IndefiniteKeepAwakeDescription.Text" xml:space="preserve">
|
||||
<value>Keeps the computer awake until the setting is disabled.</value>
|
||||
</data>
|
||||
<data name="ColorPicker_ButtonDown.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Move the color down</value>
|
||||
<data name="Espresso_TemporaryKeepAwakeDescription.Text" xml:space="preserve">
|
||||
<value>Keeps the computer awake until the set time elapses.</value>
|
||||
</data>
|
||||
<data name="ColorPicker_ButtonUp.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Move the color up</value>
|
||||
<data name="Espresso_EnableDisplayKeepAwake.Content" xml:space="preserve">
|
||||
<value>Keep screen on</value>
|
||||
</data>
|
||||
<data name="FancyZones_FlashZonesOnQuickSwitch.Content" xml:space="preserve">
|
||||
<value>Flash zones when switching layout</value>
|
||||
<data name="Espresso_Mode.Text" xml:space="preserve">
|
||||
<value>Mode</value>
|
||||
</data>
|
||||
<data name="FancyZones_QuickLayoutSwitch.Content" xml:space="preserve">
|
||||
<value>Enable quick layout switch</value>
|
||||
<data name="Espresso_Behavior_GroupSettings.Text" xml:space="preserve">
|
||||
<value>Behavior</value>
|
||||
</data>
|
||||
<data name="FancyZones_QuickLayoutSwitch_GroupSettings.Text" xml:space="preserve">
|
||||
<value>Quick layout switch</value>
|
||||
<data name="Espresso_TemporaryKeepAwake_Hours.Header" xml:space="preserve">
|
||||
<value>Hours</value>
|
||||
</data>
|
||||
</root>
|
||||
<data name="Espresso_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>
|
||||
<data name="Espresso_ModuleAttributionHyperlink.NavigateUri" xml:space="preserve">
|
||||
<value>https://espresso.den.dev</value>
|
||||
<comment>URL. Do not loc</comment>
|
||||
</data>
|
||||
<data name="Oobe_Espresso" xml:space="preserve">
|
||||
<value>Espresso</value>
|
||||
<comment>Module name, do not loc</comment>
|
||||
</data>
|
||||
<data name="Oobe_Espresso_Description" xml:space="preserve">
|
||||
<value>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</value>
|
||||
</data>
|
||||
<data name="Oobe_Espresso_HowToUse.Text" xml:space="preserve">
|
||||
<value>Open PowerToys Settings and {turn on Espresso}</value>
|
||||
</data>
|
||||
<data name="Oobe_Espresso_TipsAndTricks.Text" xml:space="preserve">
|
||||
<value>You can always change modes quickly by clicking the {Espresso icon in the system tray}</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,188 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.EspressoPage"
|
||||
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.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
xmlns:c="using:Microsoft.PowerToys.Settings.UI.Converters"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="400"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
|
||||
<Page.Resources>
|
||||
<c:EspressoModeToBoolConverter x:Key="EspressoModeToBoolConverter" />
|
||||
<c:EspressoModeToReverseBoolConverter x:Key="EspressoModeToReverseBoolConverter" />
|
||||
</Page.Resources>
|
||||
|
||||
<Grid RowSpacing="{StaticResource DefaultRowSpacing}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="LayoutVisualStates">
|
||||
<VisualState x:Name="WideLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource WideLayoutMinWidth}" />
|
||||
</VisualState.StateTriggers>
|
||||
</VisualState>
|
||||
<VisualState x:Name="SmallLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource SmallLayoutMinWidth}" />
|
||||
<AdaptiveTrigger MinWindowWidth="0" />
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="SidePanel.(Grid.Column)" Value="0" />
|
||||
<Setter Target="SidePanel.Width" Value="Auto" />
|
||||
<Setter Target="ColorPickerView.(Grid.Row)" Value="1" />
|
||||
<Setter Target="ColorPickerView.Margin" Value="0" />
|
||||
<Setter Target="LinksPanel.(RelativePanel.RightOf)" Value="AboutImage" />
|
||||
<Setter Target="LinksPanel.(RelativePanel.AlignTopWith)" Value="AboutImage" />
|
||||
<Setter Target="AboutImage.Margin" Value="0,12,12,0" />
|
||||
<Setter Target="AboutTitle.Visibility" Value="Collapsed" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Orientation="Vertical"
|
||||
x:Name="EspressoView"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,0,48,0"
|
||||
MaxWidth="{StaticResource MaxContentWidth}">
|
||||
<ToggleSwitch x:Uid="Espresso_EnableEspresso" IsOn="{Binding IsEnabled, Mode=TwoWay}" />
|
||||
<!--IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.EnablePowerLauncher}"/>-->
|
||||
|
||||
<!--<TextBlock x:Uid="Shortcuts"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>-->
|
||||
|
||||
<TextBlock x:Uid="Espresso_Behavior_GroupSettings"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"/>
|
||||
|
||||
<CheckBox x:Uid="Espresso_EnableDisplayKeepAwake"
|
||||
IsEnabled="{Binding IsEnabled}"
|
||||
IsChecked="{Binding KeepDisplayOn, Mode=TwoWay}"
|
||||
Margin="{StaticResource XSmallTopMargin}" />
|
||||
|
||||
<TextBlock x:Uid="Espresso_Mode"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
x:Name="ModeTitleLabel"
|
||||
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}" />
|
||||
|
||||
<StackPanel AutomationProperties.LabeledBy="{Binding ElementName=ModeTitleLabel}"
|
||||
Margin="0,-4,0,0">
|
||||
<RadioButton x:Uid="Espresso_IndefiniteKeepAwake"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsEnabled="{Binding IsEnabled}"
|
||||
IsChecked="{Binding Mode, Mode=TwoWay, Converter={StaticResource EspressoModeToBoolConverter}}">
|
||||
<RadioButton.Content>
|
||||
<TextBlock TextWrapping="WrapWholeWords" LineHeight="20">
|
||||
<Run x:Uid="Espresso_IndefiniteKeepAwakeContent"/>
|
||||
<LineBreak/>
|
||||
<Run Foreground="{ThemeResource SystemBaseMediumColor}"
|
||||
x:Uid="Espresso_IndefiniteKeepAwakeDescription"/>
|
||||
</TextBlock>
|
||||
</RadioButton.Content>
|
||||
</RadioButton>
|
||||
<RadioButton x:Uid="Espresso_TemporaryKeepAwake"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsEnabled="{Binding IsEnabled}"
|
||||
IsChecked="{Binding Mode, Mode=TwoWay, Converter={StaticResource EspressoModeToReverseBoolConverter}}">
|
||||
<RadioButton.Content>
|
||||
<TextBlock TextWrapping="WrapWholeWords" LineHeight="20">
|
||||
<Run x:Uid="Espresso_TemporaryKeepAwakeContent"/>
|
||||
<LineBreak/>
|
||||
<Run Foreground="{ThemeResource SystemBaseMediumColor}"
|
||||
x:Uid="Espresso_TemporaryKeepAwakeDescription"/>
|
||||
</TextBlock>
|
||||
</RadioButton.Content>
|
||||
</RadioButton>
|
||||
|
||||
<StackPanel Margin="28,8,0,0" Orientation="Horizontal">
|
||||
<muxc:NumberBox x:Uid="Espresso_TemporaryKeepAwake_Hours"
|
||||
Value="{Binding Hours, Mode=TwoWay}"
|
||||
Minimum="0"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
HorizontalAlignment="Left"
|
||||
MinWidth="90"
|
||||
IsEnabled="{Binding Mode, Converter={StaticResource EspressoModeToReverseBoolConverter}}"
|
||||
SmallChange="1"
|
||||
LargeChange="5"/>
|
||||
<muxc:NumberBox x:Uid="Espresso_TemporaryKeepAwake_Minutes"
|
||||
Value="{Binding Minutes, Mode=TwoWay}"
|
||||
Minimum="1"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
Margin="8,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
MinWidth="90"
|
||||
IsEnabled="{Binding Mode, Converter={StaticResource EspressoModeToReverseBoolConverter}}"
|
||||
SmallChange="1"
|
||||
LargeChange="5"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<!--Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"-->
|
||||
</StackPanel>
|
||||
|
||||
<RelativePanel x:Name="SidePanel"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
<StackPanel x:Name="DescriptionPanel">
|
||||
<TextBlock x:Uid="About_Espresso"
|
||||
x:Name="AboutTitle"
|
||||
Grid.ColumnSpan="2"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
<TextBlock x:Uid="Espresso_Description"
|
||||
TextWrapping="Wrap"
|
||||
Grid.Row="1" />
|
||||
</StackPanel>
|
||||
|
||||
<Border x:Name="AboutImage"
|
||||
CornerRadius="4"
|
||||
Grid.Row="2"
|
||||
MaxWidth="240"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopBottomMargin}"
|
||||
RelativePanel.Below="DescriptionPanel">
|
||||
<HyperlinkButton x:Uid="Espresso_ImageHyperlinkToDocs">
|
||||
<Image x:Uid="Espresso_Image" Source="ms-appx:///Assets/Modules/ColorPicker.png" />
|
||||
</HyperlinkButton>
|
||||
</Border>
|
||||
<StackPanel x:Name="LinksPanel"
|
||||
Margin="0,1,0,0"
|
||||
RelativePanel.Below="AboutImage"
|
||||
Orientation="Vertical" >
|
||||
<HyperlinkButton x:Uid="Espresso_ImageHyperlinkToDocs">
|
||||
<TextBlock x:Uid="Module_overview" />
|
||||
</HyperlinkButton>
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/powerToysGiveFeedback">
|
||||
<TextBlock x:Uid="Give_Feedback" />
|
||||
</HyperlinkButton>
|
||||
|
||||
<TextBlock
|
||||
x:Uid="AttributionTitle"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}" />
|
||||
|
||||
<HyperlinkButton Margin="0,-3,0,0"
|
||||
x:Uid="Espresso_ModuleAttributionHyperlink">
|
||||
<TextBlock x:Uid="Espresso_ModuleAttributionLabel"
|
||||
TextWrapping="Wrap" />
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
</RelativePanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,23 @@
|
||||
// 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 Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
public sealed partial class EspressoPage : Page
|
||||
{
|
||||
private EspressoViewModel ViewModel { get; set; }
|
||||
|
||||
public EspressoPage()
|
||||
{
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ViewModel = new EspressoViewModel(SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), SettingsRepository<EspressoSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,13 @@
|
||||
<FontIcon Glyph=""/>
|
||||
</winui:NavigationViewItem.Icon>
|
||||
</winui:NavigationViewItem>
|
||||
|
||||
|
||||
<winui:NavigationViewItem x:Uid="Shell_Espresso" helpers:NavHelper.NavigateTo="views:EspressoPage" AutomationProperties.HeadingLevel="Level1">
|
||||
<winui:NavigationViewItem.Icon>
|
||||
<FontIcon Glyph=""/>
|
||||
</winui:NavigationViewItem.Icon>
|
||||
</winui:NavigationViewItem>
|
||||
|
||||
<winui:NavigationViewItem x:Uid="Shell_FancyZones" helpers:NavHelper.NavigateTo="views:FancyZonesPage" AutomationProperties.HeadingLevel="Level1">
|
||||
<winui:NavigationViewItem.Icon>
|
||||
<PathIcon Data="M45,48H25.5V45H45V25.5H25.5v-3H45V3H25.5V0H48V48ZM22.5,48H3V45H22.5V3H3V0H25.5V48ZM0,48V0H3V48Z"/>
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutputPath>..\..\..\$(Platform)\$(Configuration)\Settings</OutputPath>
|
||||
<Optimize>false</Optimize>
|
||||
<DebugType>full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
||||
Reference in New Issue
Block a user