mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-10 13:35:31 +02:00
Added functionality for General Settings Page (#1664)
* archive * formmated code * reverted changes to test class file. * reverted changes to test file: reverted name * added class models and updated link * removed test console project
This commit is contained in:
4
.editorconfig
Normal file
4
.editorconfig
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[*.cs]
|
||||||
|
|
||||||
|
# SA1201: Elements should appear in the correct order
|
||||||
|
dotnet_diagnostic.SA1201.severity = none
|
||||||
@@ -186,6 +186,12 @@ EndProject
|
|||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerToys.Settings.UI", "src\core\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj", "{4EB9C181-96E2-4587-AB98-2DB84C1A2310}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerToys.Settings.UI", "src\core\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj", "{4EB9C181-96E2-4587-AB98-2DB84C1A2310}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.PowerToys.Settings.IPCWrapperPS", "src\core\Microsoft.PowerToys.Settings.IPCWrapperPS\Microsoft.PowerToys.Settings.IPCWrapperPS.vcxproj", "{C073B057-B157-40F0-8678-1DCD119D841C}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.PowerToys.Settings.IPCWrapperPS", "src\core\Microsoft.PowerToys.Settings.IPCWrapperPS\Microsoft.PowerToys.Settings.IPCWrapperPS.vcxproj", "{C073B057-B157-40F0-8678-1DCD119D841C}"
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4981CCD1-4CD9-4A49-B240-00AA46493FF8}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
.editorconfig = .editorconfig
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerToys.Settings.UI.Lib", "src\core\Microsoft.PowerToys.Settings.UI.Lib\Microsoft.PowerToys.Settings.UI.Lib.csproj", "{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -635,6 +641,14 @@ Global
|
|||||||
{C073B057-B157-40F0-8678-1DCD119D841C}.Release|ARM64.ActiveCfg = Release|Win32
|
{C073B057-B157-40F0-8678-1DCD119D841C}.Release|ARM64.ActiveCfg = Release|Win32
|
||||||
{C073B057-B157-40F0-8678-1DCD119D841C}.Release|x64.ActiveCfg = Release|x64
|
{C073B057-B157-40F0-8678-1DCD119D841C}.Release|x64.ActiveCfg = Release|x64
|
||||||
{C073B057-B157-40F0-8678-1DCD119D841C}.Release|x86.ActiveCfg = Release|Win32
|
{C073B057-B157-40F0-8678-1DCD119D841C}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|x64.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -683,6 +697,7 @@ Global
|
|||||||
{F88B6FD1-14BD-48DB-85C2-6C51B8045121} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
{F88B6FD1-14BD-48DB-85C2-6C51B8045121} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
||||||
{4EB9C181-96E2-4587-AB98-2DB84C1A2310} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
{4EB9C181-96E2-4587-AB98-2DB84C1A2310} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
||||||
{C073B057-B157-40F0-8678-1DCD119D841C} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
{C073B057-B157-40F0-8678-1DCD119D841C} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
||||||
|
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
|
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||||
|
{
|
||||||
|
public class GeneralSettings
|
||||||
|
{
|
||||||
|
public bool packaged { get; set; }
|
||||||
|
public bool startup { get; set; }
|
||||||
|
public bool is_elevated { get; set; }
|
||||||
|
public bool run_elevated { get; set; }
|
||||||
|
public bool is_admin { get; set; }
|
||||||
|
public string theme { get; set; }
|
||||||
|
public string system_theme { get; set; }
|
||||||
|
public string powertoys_version { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return JsonSerializer.Serialize(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OutGoingGeneralSettings
|
||||||
|
{
|
||||||
|
public GeneralSettings general { get; set; }
|
||||||
|
|
||||||
|
public OutGoingGeneralSettings()
|
||||||
|
{
|
||||||
|
this.general = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OutGoingGeneralSettings(GeneralSettings generalSettings)
|
||||||
|
{
|
||||||
|
this.general = generalSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return JsonSerializer.Serialize(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="System.Text.Json" Version="4.7.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||||
|
{
|
||||||
|
public static class SettingsUtils
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Get path to the json settings file.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>string path.</returns>
|
||||||
|
public static string GetSettingsPath(string powertoy)
|
||||||
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(powertoy))
|
||||||
|
{
|
||||||
|
return Path.Combine(
|
||||||
|
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||||
|
$"Microsoft\\PowerToys\\settings.json");
|
||||||
|
}
|
||||||
|
return Path.Combine(
|
||||||
|
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||||
|
$"Microsoft\\PowerToys\\{powertoy}\\settings.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a Deserialized object of the json settings string.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Deserialized json settings object.</returns>
|
||||||
|
public static T GetSettings<T>(string powertoy)
|
||||||
|
{
|
||||||
|
var jsonSettingsString = System.IO.File.ReadAllText(SettingsUtils.GetSettingsPath(powertoy));
|
||||||
|
return JsonSerializer.Deserialize<T>(jsonSettingsString);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Save settings to a json file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="settings">dynamic json settings object.</param>
|
||||||
|
public static void SaveSettings<T>(T settings, string powertoy)
|
||||||
|
{
|
||||||
|
if(settings != null)
|
||||||
|
{
|
||||||
|
System.IO.File.WriteAllText(
|
||||||
|
SettingsUtils.GetSettingsPath(powertoy),
|
||||||
|
settings.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,8 +7,10 @@
|
|||||||
xmlns:Controls="clr-namespace:Microsoft.Toolkit.Wpf.UI.Controls;assembly=Microsoft.Toolkit.Wpf.UI.Controls"
|
xmlns:Controls="clr-namespace:Microsoft.Toolkit.Wpf.UI.Controls;assembly=Microsoft.Toolkit.Wpf.UI.Controls"
|
||||||
xmlns:xaml="clr-namespace:Microsoft.Toolkit.Wpf.UI.XamlHost;assembly=Microsoft.Toolkit.Wpf.UI.XamlHost"
|
xmlns:xaml="clr-namespace:Microsoft.Toolkit.Wpf.UI.XamlHost;assembly=Microsoft.Toolkit.Wpf.UI.XamlHost"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="PowerToys Settings" Height="800" Width="1000">
|
Title="PowerToys Settings" Height="800" Width="800">
|
||||||
<Grid>
|
|
||||||
|
<Grid >
|
||||||
|
<!--<xaml:WindowsXamlHost InitialTypeName="Microsoft.PowerToys.Settings.UI.Controls.DummyUserControl" ChildChanged="WindowsXamlHost_ChildChanged" />-->
|
||||||
<xaml:WindowsXamlHost InitialTypeName="Microsoft.PowerToys.Settings.UI.Views.ShellPage" ChildChanged="WindowsXamlHost_ChildChanged" />
|
<xaml:WindowsXamlHost InitialTypeName="Microsoft.PowerToys.Settings.UI.Views.ShellPage" ChildChanged="WindowsXamlHost_ChildChanged" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Microsoft.PowerToys.Settings.UI.Views;
|
using Microsoft.PowerToys.Settings.UI.Views;
|
||||||
using Microsoft.Toolkit.Wpf.UI.XamlHost;
|
using System.Threading;
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Runner
|
namespace Microsoft.PowerToys.Settings.UI.Runner
|
||||||
{
|
{
|
||||||
@@ -23,6 +23,35 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
|
|||||||
WindowsXamlHost windowsXamlHost = sender as WindowsXamlHost;
|
WindowsXamlHost windowsXamlHost = sender as WindowsXamlHost;
|
||||||
ShellPage shellPage = windowsXamlHost.GetUwpInternalObject() as ShellPage;
|
ShellPage shellPage = windowsXamlHost.GetUwpInternalObject() as ShellPage;
|
||||||
|
|
||||||
|
if (shellPage != null)
|
||||||
|
{
|
||||||
|
shellPage.SetRestartElevatedCallback(delegate(string msg)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
msg,
|
||||||
|
"Restart Elevated",
|
||||||
|
MessageBoxButton.OK);
|
||||||
|
|
||||||
|
Program.ipcmanager.SendMessage(msg);
|
||||||
|
|
||||||
|
int milliseconds = 2000;
|
||||||
|
Thread.Sleep(milliseconds);
|
||||||
|
|
||||||
|
System.Windows.Application.Current.Shutdown();
|
||||||
|
});
|
||||||
|
|
||||||
|
shellPage.SetRunOnStartUpCallback(delegate (string msg)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
msg,
|
||||||
|
"Run On Start Up",
|
||||||
|
MessageBoxButton.OK);
|
||||||
|
|
||||||
|
Program.ipcmanager.SendMessage(msg);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (shellPage != null)
|
if (shellPage != null)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,29 +134,13 @@
|
|||||||
<Compile Include="Services\ActivationService.cs" />
|
<Compile Include="Services\ActivationService.cs" />
|
||||||
<Compile Include="Services\NavigationService.cs" />
|
<Compile Include="Services\NavigationService.cs" />
|
||||||
<Compile Include="ViewModels\GeneralViewModel.cs" />
|
<Compile Include="ViewModels\GeneralViewModel.cs" />
|
||||||
<Compile Include="ViewModels\MainViewModel.cs" />
|
|
||||||
<Compile Include="ViewModels\ShellViewModel.cs" />
|
<Compile Include="ViewModels\ShellViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Test1ViewModel.cs" />
|
|
||||||
<Compile Include="ViewModels\Test2ViewModel.cs" />
|
|
||||||
<Compile Include="ViewModels\Test3ViewModel.cs" />
|
|
||||||
<Compile Include="Views\GeneralPage.xaml.cs">
|
<Compile Include="Views\GeneralPage.xaml.cs">
|
||||||
<DependentUpon>GeneralPage.xaml</DependentUpon>
|
<DependentUpon>GeneralPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\MainPage.xaml.cs">
|
|
||||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Views\ShellPage.xaml.cs">
|
<Compile Include="Views\ShellPage.xaml.cs">
|
||||||
<DependentUpon>ShellPage.xaml</DependentUpon>
|
<DependentUpon>ShellPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\Test1Page.xaml.cs">
|
|
||||||
<DependentUpon>Test1Page.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Views\Test2Page.xaml.cs">
|
|
||||||
<DependentUpon>Test2Page.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Views\Test3Page.xaml.cs">
|
|
||||||
<DependentUpon>Test3Page.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AppxManifest Include="Package.appxmanifest">
|
<AppxManifest Include="Package.appxmanifest">
|
||||||
@@ -187,6 +171,9 @@
|
|||||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Uwp.Managed">
|
<PackageReference Include="Microsoft.Xaml.Behaviors.Uwp.Managed">
|
||||||
<Version>2.0.1</Version>
|
<Version>2.0.1</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="Newtonsoft.Json">
|
||||||
|
<Version>12.0.3</Version>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PRIResource Include="Strings\en-us\Resources.resw" />
|
<PRIResource Include="Strings\en-us\Resources.resw" />
|
||||||
@@ -220,26 +207,16 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\MainPage.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</Page>
|
|
||||||
<Page Include="Views\ShellPage.xaml">
|
<Page Include="Views\ShellPage.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\Test1Page.xaml">
|
</ItemGroup>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<ItemGroup>
|
||||||
<SubType>Designer</SubType>
|
<ProjectReference Include="..\Microsoft.PowerToys.Settings.UI.Lib\Microsoft.PowerToys.Settings.UI.Lib.csproj">
|
||||||
</Page>
|
<Project>{b1bcc8c6-46b5-4bfa-8f22-20f32d99ec6a}</Project>
|
||||||
<Page Include="Views\Test2Page.xaml">
|
<Name>Microsoft.PowerToys.Settings.UI.Lib</Name>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
</ProjectReference>
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</Page>
|
|
||||||
<Page Include="Views\Test3Page.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</Page>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|
||||||
{
|
|
||||||
public class MainViewModel : Observable
|
|
||||||
{
|
|
||||||
public MainViewModel()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +1,26 @@
|
|||||||
using System;
|
// <copyright file="ShellViewModel.cs" company="Microsoft Corp">
|
||||||
using System.Collections.Generic;
|
// Copyright (c) Microsoft Corp. All rights reserved.
|
||||||
using System.Linq;
|
// </copyright>
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Input;
|
|
||||||
|
|
||||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
|
||||||
using Microsoft.PowerToys.Settings.UI.Services;
|
|
||||||
|
|
||||||
using Windows.System;
|
|
||||||
using Windows.UI.Xaml.Controls;
|
|
||||||
using Windows.UI.Xaml.Input;
|
|
||||||
using Windows.UI.Xaml.Navigation;
|
|
||||||
|
|
||||||
using WinUI = Microsoft.UI.Xaml.Controls;
|
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||||
{
|
{
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.Services;
|
||||||
|
using Windows.System;
|
||||||
|
using Windows.UI.Xaml.Controls;
|
||||||
|
using Windows.UI.Xaml.Input;
|
||||||
|
using Windows.UI.Xaml.Navigation;
|
||||||
|
using WinUI = Microsoft.UI.Xaml.Controls;
|
||||||
|
|
||||||
public class ShellViewModel : Observable
|
public class ShellViewModel : Observable
|
||||||
{
|
{
|
||||||
private readonly KeyboardAccelerator _altLeftKeyboardAccelerator = BuildKeyboardAccelerator(VirtualKey.Left, VirtualKeyModifiers.Menu);
|
private readonly KeyboardAccelerator _altLeftKeyboardAccelerator = BuildKeyboardAccelerator(VirtualKey.Left, VirtualKeyModifiers.Menu);
|
||||||
|
|
||||||
private readonly KeyboardAccelerator _backKeyboardAccelerator = BuildKeyboardAccelerator(VirtualKey.GoBack);
|
private readonly KeyboardAccelerator _backKeyboardAccelerator = BuildKeyboardAccelerator(VirtualKey.GoBack);
|
||||||
|
|
||||||
private bool _isBackEnabled;
|
private bool _isBackEnabled;
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|
||||||
{
|
|
||||||
public class Test1ViewModel : Observable
|
|
||||||
{
|
|
||||||
public Test1ViewModel()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|
||||||
{
|
|
||||||
public class Test2ViewModel : Observable
|
|
||||||
{
|
|
||||||
public Test2ViewModel()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|
||||||
{
|
|
||||||
public class Test3ViewModel : Observable
|
|
||||||
{
|
|
||||||
public Test3ViewModel()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,17 +13,22 @@
|
|||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<StackPanel Orientation="Vertical" Margin="14,0,14,48">
|
<StackPanel Orientation="Vertical" Margin="14,0,14,48">
|
||||||
|
|
||||||
<ToggleSwitch Header="Start at startup" IsOn="True" Margin="0,14,0,0" />
|
<ToggleSwitch Header="Run at startup" x:Name="ToggleSwitch_RunAtStartUp" Margin="0,14,0,0" Toggled="ToggleSwitch_RunAtStartUp_Toggled" />
|
||||||
|
|
||||||
<muxc:RadioButtons Header="Theme" Margin="0, 28,0,0">
|
<muxc:RadioButtons Header="Theme" Margin="0, 28,0,0">
|
||||||
<RadioButton Content="Dark"/>
|
<RadioButton x:Name="Rodio_Theme_Dark" Content="Dark" Tag="Dark" Checked="Theme_Changed"/>
|
||||||
<RadioButton Content="Light"/>
|
<RadioButton x:Name="Rodio_Theme_Light" Content="Light" Tag="Light" Checked="Theme_Changed"/>
|
||||||
<RadioButton Content="System default" IsChecked="True"/>
|
<RadioButton x:Name="Rodio_Theme_Default" Content="System default" Tag="System" Checked="Theme_Changed"/>
|
||||||
</muxc:RadioButtons>
|
</muxc:RadioButtons>
|
||||||
|
|
||||||
|
<!--
|
||||||
<ToggleSwitch Header="Disable telemetry" IsOn="True" Margin="0,14,0,0" />
|
<ToggleSwitch Header="Disable telemetry" IsOn="True" Margin="0,14,0,0" />
|
||||||
<TextBlock Text="PowerToys currently respects the Windows data & feedback setting" Opacity="0.8" Margin="0,0,0,0" />
|
<TextBlock Text="PowerToys currently respects the Windows data & feedback setting" Opacity="0.8" Margin="0,0,0,0" />
|
||||||
|
-->
|
||||||
|
|
||||||
|
<Button Background="{ThemeResource SystemAccentColor}" Content="Restart as admin" Margin="0,10,0,0" Foreground="White" Click="Restart_Elevated" />
|
||||||
|
|
||||||
|
<!--
|
||||||
<TextBlock Text="Default apps" Style="{StaticResource SubtitleTextBlockStyle}" Margin="0,34,0,8"/>
|
<TextBlock Text="Default apps" Style="{StaticResource SubtitleTextBlockStyle}" Margin="0,34,0,8"/>
|
||||||
<ComboBox Header="Shell" SelectedIndex="0" MinWidth="240" Margin="0,14,0,0">
|
<ComboBox Header="Shell" SelectedIndex="0" MinWidth="240" Margin="0,14,0,0">
|
||||||
<ComboBoxItem>PowerShell</ComboBoxItem>
|
<ComboBoxItem>PowerShell</ComboBoxItem>
|
||||||
@@ -31,14 +36,16 @@
|
|||||||
<ComboBox Header="Terminal" SelectedIndex="0" MinWidth="240" Margin="0,14,0,0">
|
<ComboBox Header="Terminal" SelectedIndex="0" MinWidth="240" Margin="0,14,0,0">
|
||||||
<ComboBoxItem>Windows Console</ComboBoxItem>
|
<ComboBoxItem>Windows Console</ComboBoxItem>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
-->
|
||||||
|
|
||||||
<TextBlock Text="About PowerToys" Style="{StaticResource SubtitleTextBlockStyle}" Margin="0,34,0,8"/>
|
<TextBlock Text="About PowerToys" Style="{StaticResource SubtitleTextBlockStyle}" Margin="0,34,0,8"/>
|
||||||
<TextBlock FontWeight="Bold" Text="Version 0.15.1.0" Margin="0,14,0,0" />
|
<TextBlock FontWeight="Bold" Text="Version 0.15.1.0" Margin="0,14,0,0" />
|
||||||
<Button Background="{ThemeResource SystemAccentColor}" Content="Check for updates" Margin="0,10,0,0" Foreground="White"/>
|
<!--<Button Background="{ThemeResource SystemAccentColor}" Content="Check for updates" Margin="0,10,0,0" Foreground="White" />
|
||||||
<!-- TO DO: The styling of this button should be improved so the hover/pressed states are representing the SystemAccentColor -->
|
TO DO: The styling of this button should be improved so the hover/pressed states are representing the SystemAccentColor -->
|
||||||
|
|
||||||
<HyperlinkButton Content="Report a bug" Margin="0,14,0,0" />
|
<HyperlinkButton Content="Report a bug" Margin="0,14,0,0" NavigateUri="https://github.com/microsoft/PowerToys/issues" />
|
||||||
<HyperlinkButton Content="Request a feature" />
|
<HyperlinkButton Content="Request a feature" NavigateUri="https://github.com/microsoft/PowerToys/issues"/>
|
||||||
<HyperlinkButton Content="Privacy statement" />
|
<HyperlinkButton Content="Privacy statement" NavigateUri=" http://go.microsoft.com/fwlink/?LinkId=521839" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -1,29 +1,128 @@
|
|||||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
// <copyright file="GeneralPage.xaml.cs" company="Microsoft Corp">
|
||||||
using System;
|
// Copyright (c) Microsoft Corp. All rights reserved.
|
||||||
using System.Collections.Generic;
|
// </copyright>
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices.WindowsRuntime;
|
|
||||||
using Windows.Foundation;
|
|
||||||
using Windows.Foundation.Collections;
|
|
||||||
using Windows.UI.Xaml;
|
|
||||||
using Windows.UI.Xaml.Controls;
|
|
||||||
using Windows.UI.Xaml.Controls.Primitives;
|
|
||||||
using Windows.UI.Xaml.Data;
|
|
||||||
using Windows.UI.Xaml.Input;
|
|
||||||
using Windows.UI.Xaml.Media;
|
|
||||||
using Windows.UI.Xaml.Navigation;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||||
{
|
{
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||||
|
using Windows.UI.Popups;
|
||||||
|
using Windows.UI.Xaml;
|
||||||
|
using Windows.UI.Xaml.Controls;
|
||||||
|
using Windows.UI.Xaml.Navigation;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// General Settings Page.
|
||||||
|
/// </summary>
|
||||||
public sealed partial class GeneralPage : Page
|
public sealed partial class GeneralPage : Page
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets view model.
|
||||||
|
/// </summary>
|
||||||
public GeneralViewModel ViewModel { get; } = new GeneralViewModel();
|
public GeneralViewModel ViewModel { get; } = new GeneralViewModel();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="GeneralPage"/> class.
|
||||||
|
/// General Settings page constructor.
|
||||||
|
/// </summary>
|
||||||
public GeneralPage()
|
public GeneralPage()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||||
|
{
|
||||||
|
GeneralSettings settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||||
|
base.OnNavigatedTo(e);
|
||||||
|
|
||||||
|
// load and apply theme settings
|
||||||
|
this.ReLoadTheme(settings.theme);
|
||||||
|
|
||||||
|
// load run on start up ui settings value and update the ui state.
|
||||||
|
this.ToggleSwitch_RunAtStartUp.IsOn = settings.startup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update and save theme settings to json file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="themeName">theme name.</param>
|
||||||
|
private void ReLoadTheme(string themeName)
|
||||||
|
{
|
||||||
|
switch (themeName.ToLower())
|
||||||
|
{
|
||||||
|
case "light":
|
||||||
|
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Light;
|
||||||
|
this.Rodio_Theme_Light.IsChecked = true;
|
||||||
|
break;
|
||||||
|
case "dark":
|
||||||
|
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Dark;
|
||||||
|
this.Rodio_Theme_Dark.IsChecked = true;
|
||||||
|
break;
|
||||||
|
case "system":
|
||||||
|
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Default;
|
||||||
|
this.Rodio_Theme_Default.IsChecked = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToggleSwitch_RunAtStartUp_Toggled(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ToggleSwitch swt = sender as ToggleSwitch;
|
||||||
|
|
||||||
|
if (swt != null)
|
||||||
|
{
|
||||||
|
GeneralSettings settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||||
|
|
||||||
|
string startup = swt.IsOn.ToString().ToLower();
|
||||||
|
switch (startup)
|
||||||
|
{
|
||||||
|
case "true":
|
||||||
|
settings.startup = true;
|
||||||
|
break;
|
||||||
|
case "false":
|
||||||
|
settings.startup = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsUtils.SaveSettings<GeneralSettings>(settings, string.Empty);
|
||||||
|
OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(settings);
|
||||||
|
|
||||||
|
if (ShellPage.Run_OnStartUp_Callback != null)
|
||||||
|
{
|
||||||
|
ShellPage.Run_OnStartUp_Callback(outsettings.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Restart_Elevated(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
GeneralSettings settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||||
|
settings.run_elevated = true;
|
||||||
|
OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(settings);
|
||||||
|
|
||||||
|
if (ShellPage.Restart_Elevated_Callback != null)
|
||||||
|
{
|
||||||
|
ShellPage.Restart_Elevated_Callback(outsettings.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Theme_Changed(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
RadioButton rb = sender as RadioButton;
|
||||||
|
|
||||||
|
if (rb != null)
|
||||||
|
{
|
||||||
|
string themeName = rb.Tag.ToString();
|
||||||
|
this.ReLoadTheme(themeName);
|
||||||
|
|
||||||
|
// update and save settings to file.
|
||||||
|
GeneralSettings settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||||
|
settings.theme = themeName;
|
||||||
|
SettingsUtils.SaveSettings<GeneralSettings>(settings,string.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
<Page
|
|
||||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.MainPage"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
Style="{StaticResource PageStyle}"
|
|
||||||
mc:Ignorable="d">
|
|
||||||
<Grid x:Name="ContentArea" Margin="{StaticResource MediumLeftRightMargin}">
|
|
||||||
<Grid
|
|
||||||
Background="{ThemeResource SystemControlPageBackgroundChromeLowBrush}">
|
|
||||||
<!--
|
|
||||||
The SystemControlPageBackgroundChromeLowBrush background represents where you should place your content.
|
|
||||||
Place your content here.
|
|
||||||
-->
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
|
||||||
|
|
||||||
using Windows.UI.Xaml.Controls;
|
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
|
||||||
{
|
|
||||||
public sealed partial class MainPage : Page
|
|
||||||
{
|
|
||||||
public MainViewModel ViewModel { get; } = new MainViewModel();
|
|
||||||
|
|
||||||
public MainPage()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -52,10 +52,10 @@
|
|||||||
<FontIcon Glyph=""/>
|
<FontIcon Glyph=""/>
|
||||||
</winui:NavigationViewItem.Icon>
|
</winui:NavigationViewItem.Icon>
|
||||||
</winui:NavigationViewItem>
|
</winui:NavigationViewItem>
|
||||||
<winui:NavigationViewItem x:Uid="Shell_Main" Icon="Home" helpers:NavHelper.NavigateTo="views:MainPage" />
|
<!--<winui:NavigationViewItem x:Uid="Shell_Main" Icon="Home" helpers:NavHelper.NavigateTo="views:MainPage" />
|
||||||
<winui:NavigationViewItem x:Uid="Shell_Test1" Icon="Play" helpers:NavHelper.NavigateTo="views:Test1Page" />
|
<winui:NavigationViewItem x:Uid="Shell_Test1" Icon="Play" helpers:NavHelper.NavigateTo="views:Test1Page" />
|
||||||
<winui:NavigationViewItem x:Uid="Shell_Test2" Icon="Refresh" helpers:NavHelper.NavigateTo="views:Test2Page" />
|
<winui:NavigationViewItem x:Uid="Shell_Test2" Icon="Refresh" helpers:NavHelper.NavigateTo="views:Test2Page" />
|
||||||
<winui:NavigationViewItem x:Uid="Shell_Test3" Icon="Save" helpers:NavHelper.NavigateTo="views:Test3Page" />
|
<winui:NavigationViewItem x:Uid="Shell_Test3" Icon="Save" helpers:NavHelper.NavigateTo="views:Test3Page" />-->
|
||||||
</winui:NavigationView.MenuItems>
|
</winui:NavigationView.MenuItems>
|
||||||
<i:Interaction.Behaviors>
|
<i:Interaction.Behaviors>
|
||||||
<behaviors:NavigationViewHeaderBehavior
|
<behaviors:NavigationViewHeaderBehavior
|
||||||
|
|||||||
@@ -1,25 +1,79 @@
|
|||||||
using System;
|
// <copyright file="ShellPage.xaml.cs" company="Microsoft Corp">
|
||||||
using Microsoft.PowerToys.Settings.UI.Activation;
|
// Copyright (c) Microsoft Corp. All rights reserved.
|
||||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
// </copyright>
|
||||||
using Microsoft.PowerToys.Settings.UI.Services;
|
|
||||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
|
||||||
|
|
||||||
using Windows.UI.Xaml.Controls;
|
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||||
{
|
{
|
||||||
// TODO WTS: Change the icons and titles for all NavigationViewItems in ShellPage.xaml.
|
using System;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.Activation;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.Services;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||||
|
using Windows.UI.Xaml.Controls;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Root page.
|
||||||
|
/// </summary>
|
||||||
public sealed partial class ShellPage : UserControl
|
public sealed partial class ShellPage : UserControl
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Delcaration for the ipc callback function.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="msg">message.</param>
|
||||||
|
public delegate void IPCMessageCallback(string msg);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets view model.
|
||||||
|
/// </summary>
|
||||||
public ShellViewModel ViewModel { get; } = new ShellViewModel();
|
public ShellViewModel ViewModel { get; } = new ShellViewModel();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A shell handler to be used to update contents of the shell dynamically from page within the frame.
|
||||||
|
/// </summary>
|
||||||
|
public static Microsoft.UI.Xaml.Controls.NavigationView ShellHandler = null;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IPC callback function for restart elevated.
|
||||||
|
/// </summary>
|
||||||
|
public static IPCMessageCallback Restart_Elevated_Callback = null;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IPC callback function for run on start up.
|
||||||
|
/// </summary>
|
||||||
|
public static IPCMessageCallback Run_OnStartUp_Callback = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="ShellPage"/> class.
|
||||||
|
/// Shell page constructor.
|
||||||
|
/// </summary>
|
||||||
public ShellPage()
|
public ShellPage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
this.InitializeComponent();
|
||||||
|
|
||||||
DataContext = ViewModel;
|
this.DataContext = this.ViewModel;
|
||||||
ViewModel.Initialize(shellFrame, navigationView, KeyboardAccelerators);
|
ShellHandler = this.navigationView;
|
||||||
NavigationService.Navigate(typeof(MainPage));
|
this.ViewModel.Initialize(this.shellFrame, this.navigationView, this.KeyboardAccelerators);
|
||||||
|
this.shellFrame.Navigate(typeof(GeneralPage));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Restart elevated callback function initialization.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="implmentation">delegate function implementation.</param>
|
||||||
|
public void SetRestartElevatedCallback(IPCMessageCallback implmentation)
|
||||||
|
{
|
||||||
|
Restart_Elevated_Callback = implmentation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Run on start up callback function elevated initialization.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="implmentation">delegate function implementation.</param>
|
||||||
|
public void SetRunOnStartUpCallback(IPCMessageCallback implmentation)
|
||||||
|
{
|
||||||
|
Run_OnStartUp_Callback = implmentation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
<Page
|
|
||||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.Test1Page"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
Style="{StaticResource PageStyle}"
|
|
||||||
mc:Ignorable="d">
|
|
||||||
<Grid x:Name="ContentArea" Margin="{StaticResource MediumLeftRightMargin}">
|
|
||||||
<Grid
|
|
||||||
Background="{ThemeResource SystemControlPageBackgroundChromeLowBrush}">
|
|
||||||
<!--
|
|
||||||
The SystemControlPageBackgroundChromeLowBrush background represents where you should place your content.
|
|
||||||
Place your content here.
|
|
||||||
-->
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
|
||||||
|
|
||||||
using Windows.UI.Xaml.Controls;
|
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
|
||||||
{
|
|
||||||
public sealed partial class Test1Page : Page
|
|
||||||
{
|
|
||||||
public Test1ViewModel ViewModel { get; } = new Test1ViewModel();
|
|
||||||
|
|
||||||
public Test1Page()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<Page
|
|
||||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.Test2Page"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
Style="{StaticResource PageStyle}"
|
|
||||||
mc:Ignorable="d">
|
|
||||||
<Grid x:Name="ContentArea" Margin="{StaticResource MediumLeftRightMargin}">
|
|
||||||
<Grid
|
|
||||||
Background="{ThemeResource SystemControlPageBackgroundChromeLowBrush}">
|
|
||||||
<!--
|
|
||||||
The SystemControlPageBackgroundChromeLowBrush background represents where you should place your content.
|
|
||||||
Place your content here.
|
|
||||||
-->
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
|
||||||
|
|
||||||
using Windows.UI.Xaml.Controls;
|
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
|
||||||
{
|
|
||||||
public sealed partial class Test2Page : Page
|
|
||||||
{
|
|
||||||
public Test2ViewModel ViewModel { get; } = new Test2ViewModel();
|
|
||||||
|
|
||||||
public Test2Page()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<Page
|
|
||||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.Test3Page"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
Style="{StaticResource PageStyle}"
|
|
||||||
mc:Ignorable="d">
|
|
||||||
<Grid x:Name="ContentArea" Margin="{StaticResource MediumLeftRightMargin}">
|
|
||||||
<Grid
|
|
||||||
Background="{ThemeResource SystemControlPageBackgroundChromeLowBrush}">
|
|
||||||
<!--
|
|
||||||
The SystemControlPageBackgroundChromeLowBrush background represents where you should place your content.
|
|
||||||
Place your content here.
|
|
||||||
-->
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
|
||||||
|
|
||||||
using Windows.UI.Xaml.Controls;
|
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
|
||||||
{
|
|
||||||
public sealed partial class Test3Page : Page
|
|
||||||
{
|
|
||||||
public Test3ViewModel ViewModel { get; } = new Test3ViewModel();
|
|
||||||
|
|
||||||
public Test3Page()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
18
src/core/Test/Program.cs
Normal file
18
src/core/Test/Program.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Test
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
GeneralSettings settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||||
|
OutGoingGeneralSettings outSettings = new OutGoingGeneralSettings(settings);
|
||||||
|
Console.WriteLine(outSettings.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/core/Test/Test.csproj
Normal file
12
src/core/Test/Test.csproj
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Microsoft.PowerToys.Settings.UI.Lib\Microsoft.PowerToys.Settings.UI.Lib.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -9,14 +9,13 @@
|
|||||||
<AssemblyCopyright>Copyright (C) 2019 Microsoft Corp.</AssemblyCopyright>
|
<AssemblyCopyright>Copyright (C) 2019 Microsoft Corp.</AssemblyCopyright>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AssemblyVersionFiles Include="Generated Files\AssemblyInfo.cs"/>
|
<AssemblyVersionFiles Include="Generated Files\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Target Name="GenerateAssemblyInfo" BeforeTargets="PrepareForBuild">
|
<Target Name="GenerateAssemblyInfo" BeforeTargets="PrepareForBuild">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<HeaderLines Include="// Copyright (c) Microsoft Corporation" />
|
<HeaderLines Include="// Copyright (c) Microsoft Corporation" />
|
||||||
<HeaderLines Include="// The Microsoft Corporation licenses this file to you under the MIT license." />
|
<HeaderLines Include="// The Microsoft Corporation licenses this file to you under the MIT license." />
|
||||||
<HeaderLines Include="// See the LICENSE file in the project root for more information." />
|
<HeaderLines Include="// See the LICENSE file in the project root for more information." />
|
||||||
|
|
||||||
<HeaderLines Include="#pragma warning disable SA1516" />
|
<HeaderLines Include="#pragma warning disable SA1516" />
|
||||||
<HeaderLines Include="using System.Reflection%3b" />
|
<HeaderLines Include="using System.Reflection%3b" />
|
||||||
<HeaderLines Include="using System.Runtime.InteropServices%3b" />
|
<HeaderLines Include="using System.Runtime.InteropServices%3b" />
|
||||||
@@ -34,15 +33,8 @@
|
|||||||
<HeaderLines Include="[assembly: AssemblyVersion("$(Version).0")]" />
|
<HeaderLines Include="[assembly: AssemblyVersion("$(Version).0")]" />
|
||||||
<HeaderLines Include="[assembly: AssemblyFileVersion("$(Version).0")]" />
|
<HeaderLines Include="[assembly: AssemblyFileVersion("$(Version).0")]" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<WriteLinesToFile File="Generated Files\AssemblyInfo.cs" Lines="@(HeaderLines)" Overwrite="true" Encoding="Unicode" WriteOnlyWhenDifferent="true" />
|
||||||
<WriteLinesToFile
|
|
||||||
File="Generated Files\AssemblyInfo.cs"
|
|
||||||
Lines="@(HeaderLines)"
|
|
||||||
Overwrite="true"
|
|
||||||
Encoding="Unicode"
|
|
||||||
WriteOnlyWhenDifferent="true" />
|
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
|||||||
@@ -52,6 +52,9 @@
|
|||||||
<AdditionalFiles Include="..\..\..\codeAnalysis\StyleCop.json">
|
<AdditionalFiles Include="..\..\..\codeAnalysis\StyleCop.json">
|
||||||
<Link>StyleCop.json</Link>
|
<Link>StyleCop.json</Link>
|
||||||
</AdditionalFiles>
|
</AdditionalFiles>
|
||||||
|
<None Include="..\..\..\..\.editorconfig">
|
||||||
|
<Link>.editorconfig</Link>
|
||||||
|
</None>
|
||||||
<None Include="App.config">
|
<None Include="App.config">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</None>
|
</None>
|
||||||
|
|||||||
@@ -9,14 +9,13 @@
|
|||||||
<AssemblyCopyright>Copyright (C) 2019 Microsoft Corp.</AssemblyCopyright>
|
<AssemblyCopyright>Copyright (C) 2019 Microsoft Corp.</AssemblyCopyright>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AssemblyVersionFiles Include="Generated Files\AssemblyInfo.cs"/>
|
<AssemblyVersionFiles Include="Generated Files\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Target Name="GenerateAssemblyInfo" BeforeTargets="PrepareForBuild">
|
<Target Name="GenerateAssemblyInfo" BeforeTargets="PrepareForBuild">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<HeaderLines Include="// Copyright (c) Microsoft Corporation" />
|
<HeaderLines Include="// Copyright (c) Microsoft Corporation" />
|
||||||
<HeaderLines Include="// The Microsoft Corporation licenses this file to you under the MIT license." />
|
<HeaderLines Include="// The Microsoft Corporation licenses this file to you under the MIT license." />
|
||||||
<HeaderLines Include="// See the LICENSE file in the project root for more information." />
|
<HeaderLines Include="// See the LICENSE file in the project root for more information." />
|
||||||
|
|
||||||
<HeaderLines Include="#pragma warning disable SA1516" />
|
<HeaderLines Include="#pragma warning disable SA1516" />
|
||||||
<HeaderLines Include="using System.Reflection%3b" />
|
<HeaderLines Include="using System.Reflection%3b" />
|
||||||
<HeaderLines Include="using System.Resources%3b" />
|
<HeaderLines Include="using System.Resources%3b" />
|
||||||
@@ -36,13 +35,7 @@
|
|||||||
<HeaderLines Include="[assembly: AssemblyVersion("$(Version).0")]" />
|
<HeaderLines Include="[assembly: AssemblyVersion("$(Version).0")]" />
|
||||||
<HeaderLines Include="[assembly: AssemblyFileVersion("$(Version).0")]" />
|
<HeaderLines Include="[assembly: AssemblyFileVersion("$(Version).0")]" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<WriteLinesToFile File="Generated Files\AssemblyInfo.cs" Lines="@(HeaderLines)" Overwrite="true" Encoding="Unicode" WriteOnlyWhenDifferent="true" />
|
||||||
<WriteLinesToFile
|
|
||||||
File="Generated Files\AssemblyInfo.cs"
|
|
||||||
Lines="@(HeaderLines)"
|
|
||||||
Overwrite="true"
|
|
||||||
Encoding="Unicode"
|
|
||||||
WriteOnlyWhenDifferent="true" />
|
|
||||||
</Target>
|
</Target>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
|||||||
@@ -16,7 +16,21 @@
|
|||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
<NuGetPackageImportStamp>
|
<NuGetPackageImportStamp>
|
||||||
</NuGetPackageImportStamp>
|
</NuGetPackageImportStamp>
|
||||||
<IntermediateOutputPath>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(AssemblyName)\</IntermediateOutputPath>
|
<PublishUrl>publish\</PublishUrl>
|
||||||
|
<Install>true</Install>
|
||||||
|
<InstallFrom>Disk</InstallFrom>
|
||||||
|
<UpdateEnabled>false</UpdateEnabled>
|
||||||
|
<UpdateMode>Foreground</UpdateMode>
|
||||||
|
<UpdateInterval>7</UpdateInterval>
|
||||||
|
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||||
|
<UpdatePeriodically>false</UpdatePeriodically>
|
||||||
|
<UpdateRequired>false</UpdateRequired>
|
||||||
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
|||||||
Reference in New Issue
Block a user