EXAMPLE: HelloWorld MSIX module for embedding into setup
|
@ -1,6 +1,6 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 16.0.28803.452
|
VisualStudioVersion = 16.0.31410.357
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runner", "src\runner\runner.vcxproj", "{9412D5C6-2CF2-4FC2-A601-B55508EA9B27}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runner", "src\runner\runner.vcxproj", "{9412D5C6-2CF2-4FC2-A601-B55508EA9B27}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
@ -363,6 +363,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VideoConferenceProxyFilter"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VideoConference", "VideoConference", "{470FBAF9-E1F8-4F3E-8786-198A1C81C8A8}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VideoConference", "VideoConference", "{470FBAF9-E1F8-4F3E-8786-198A1C81C8A8}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloModule", "src\modules\HelloModule\HelloModule.csproj", "{841BAE3A-60D7-492F-85FD-B1F3D2455CA1}"
|
||||||
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PdfThumbnailProvider", "src\modules\previewpane\PdfThumbnailProvider\PdfThumbnailProvider.csproj", "{11491FD8-F921-48BF-880C-7FEA185B80A1}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PdfThumbnailProvider", "src\modules\previewpane\PdfThumbnailProvider\PdfThumbnailProvider.csproj", "{11491FD8-F921-48BF-880C-7FEA185B80A1}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests-PdfThumbnailProvider", "src\modules\previewpane\UnitTests-PdfThumbnailProvider\UnitTests-PdfThumbnailProvider.csproj", "{F40C3397-1834-4530-B2D9-8F8B8456BCDF}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests-PdfThumbnailProvider", "src\modules\previewpane\UnitTests-PdfThumbnailProvider\UnitTests-PdfThumbnailProvider.csproj", "{F40C3397-1834-4530-B2D9-8F8B8456BCDF}"
|
||||||
|
@ -953,6 +955,18 @@ Global
|
||||||
{AC2857B4-103D-4D6D-9740-926EBF785042}.Release|x64.Build.0 = Release|x64
|
{AC2857B4-103D-4D6D-9740-926EBF785042}.Release|x64.Build.0 = Release|x64
|
||||||
{AC2857B4-103D-4D6D-9740-926EBF785042}.Release|x86.ActiveCfg = Release|Win32
|
{AC2857B4-103D-4D6D-9740-926EBF785042}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{AC2857B4-103D-4D6D-9740-926EBF785042}.Release|x86.Build.0 = Release|Win32
|
{AC2857B4-103D-4D6D-9740-926EBF785042}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{841BAE3A-60D7-492F-85FD-B1F3D2455CA1}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{841BAE3A-60D7-492F-85FD-B1F3D2455CA1}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{841BAE3A-60D7-492F-85FD-B1F3D2455CA1}.Debug|x64.Deploy.0 = Debug|x64
|
||||||
|
{841BAE3A-60D7-492F-85FD-B1F3D2455CA1}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
|
{841BAE3A-60D7-492F-85FD-B1F3D2455CA1}.Debug|x86.Build.0 = Debug|x86
|
||||||
|
{841BAE3A-60D7-492F-85FD-B1F3D2455CA1}.Debug|x86.Deploy.0 = Debug|x86
|
||||||
|
{841BAE3A-60D7-492F-85FD-B1F3D2455CA1}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{841BAE3A-60D7-492F-85FD-B1F3D2455CA1}.Release|x64.Build.0 = Release|x64
|
||||||
|
{841BAE3A-60D7-492F-85FD-B1F3D2455CA1}.Release|x64.Deploy.0 = Release|x64
|
||||||
|
{841BAE3A-60D7-492F-85FD-B1F3D2455CA1}.Release|x86.ActiveCfg = Release|x86
|
||||||
|
{841BAE3A-60D7-492F-85FD-B1F3D2455CA1}.Release|x86.Build.0 = Release|x86
|
||||||
|
{841BAE3A-60D7-492F-85FD-B1F3D2455CA1}.Release|x86.Deploy.0 = Release|x86
|
||||||
{11491FD8-F921-48BF-880C-7FEA185B80A1}.Debug|x64.ActiveCfg = Debug|x64
|
{11491FD8-F921-48BF-880C-7FEA185B80A1}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{11491FD8-F921-48BF-880C-7FEA185B80A1}.Debug|x64.Build.0 = Debug|x64
|
{11491FD8-F921-48BF-880C-7FEA185B80A1}.Debug|x64.Build.0 = Debug|x64
|
||||||
{11491FD8-F921-48BF-880C-7FEA185B80A1}.Debug|x86.ActiveCfg = Debug|x64
|
{11491FD8-F921-48BF-880C-7FEA185B80A1}.Debug|x86.ActiveCfg = Debug|x64
|
||||||
|
@ -1078,6 +1092,7 @@ Global
|
||||||
{5ABA70DE-3A3F-41F6-A1F5-D1F74F54F9BB} = {470FBAF9-E1F8-4F3E-8786-198A1C81C8A8}
|
{5ABA70DE-3A3F-41F6-A1F5-D1F74F54F9BB} = {470FBAF9-E1F8-4F3E-8786-198A1C81C8A8}
|
||||||
{AC2857B4-103D-4D6D-9740-926EBF785042} = {470FBAF9-E1F8-4F3E-8786-198A1C81C8A8}
|
{AC2857B4-103D-4D6D-9740-926EBF785042} = {470FBAF9-E1F8-4F3E-8786-198A1C81C8A8}
|
||||||
{470FBAF9-E1F8-4F3E-8786-198A1C81C8A8} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
|
{470FBAF9-E1F8-4F3E-8786-198A1C81C8A8} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
|
||||||
|
{841BAE3A-60D7-492F-85FD-B1F3D2455CA1} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
|
||||||
{11491FD8-F921-48BF-880C-7FEA185B80A1} = {2F305555-C296-497E-AC20-5FA1B237996A}
|
{11491FD8-F921-48BF-880C-7FEA185B80A1} = {2F305555-C296-497E-AC20-5FA1B237996A}
|
||||||
{F40C3397-1834-4530-B2D9-8F8B8456BCDF} = {2F305555-C296-497E-AC20-5FA1B237996A}
|
{F40C3397-1834-4530-B2D9-8F8B8456BCDF} = {2F305555-C296-497E-AC20-5FA1B237996A}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
|
7
src/modules/HelloModule/App.xaml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<Application
|
||||||
|
x:Class="HelloModule.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="using:HelloModule">
|
||||||
|
|
||||||
|
</Application>
|
100
src/modules/HelloModule/App.xaml.cs
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
|
using Windows.ApplicationModel;
|
||||||
|
using Windows.ApplicationModel.Activation;
|
||||||
|
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 HelloModule
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides application-specific behavior to supplement the default Application class.
|
||||||
|
/// </summary>
|
||||||
|
sealed partial class App : Application
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes the singleton application object. This is the first line of authored code
|
||||||
|
/// executed, and as such is the logical equivalent of main() or WinMain().
|
||||||
|
/// </summary>
|
||||||
|
public App()
|
||||||
|
{
|
||||||
|
this.InitializeComponent();
|
||||||
|
this.Suspending += OnSuspending;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when the application is launched normally by the end user. Other entry points
|
||||||
|
/// will be used such as when the application is launched to open a specific file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e">Details about the launch request and process.</param>
|
||||||
|
protected override void OnLaunched(LaunchActivatedEventArgs e)
|
||||||
|
{
|
||||||
|
Frame rootFrame = Window.Current.Content as Frame;
|
||||||
|
|
||||||
|
// Do not repeat app initialization when the Window already has content,
|
||||||
|
// just ensure that the window is active
|
||||||
|
if (rootFrame == null)
|
||||||
|
{
|
||||||
|
// Create a Frame to act as the navigation context and navigate to the first page
|
||||||
|
rootFrame = new Frame();
|
||||||
|
|
||||||
|
rootFrame.NavigationFailed += OnNavigationFailed;
|
||||||
|
|
||||||
|
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
|
||||||
|
{
|
||||||
|
//TODO: Load state from previously suspended application
|
||||||
|
}
|
||||||
|
|
||||||
|
// Place the frame in the current Window
|
||||||
|
Window.Current.Content = rootFrame;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.PrelaunchActivated == false)
|
||||||
|
{
|
||||||
|
if (rootFrame.Content == null)
|
||||||
|
{
|
||||||
|
// When the navigation stack isn't restored navigate to the first page,
|
||||||
|
// configuring the new page by passing required information as a navigation
|
||||||
|
// parameter
|
||||||
|
rootFrame.Navigate(typeof(MainPage), e.Arguments);
|
||||||
|
}
|
||||||
|
// Ensure the current window is active
|
||||||
|
Window.Current.Activate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when Navigation to a certain page fails
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">The Frame which failed navigation</param>
|
||||||
|
/// <param name="e">Details about the navigation failure</param>
|
||||||
|
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
|
||||||
|
{
|
||||||
|
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when application execution is being suspended. Application state is saved
|
||||||
|
/// without knowing whether the application will be terminated or resumed with the contents
|
||||||
|
/// of memory still intact.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">The source of the suspend request.</param>
|
||||||
|
/// <param name="e">Details about the suspend request.</param>
|
||||||
|
private void OnSuspending(object sender, SuspendingEventArgs e)
|
||||||
|
{
|
||||||
|
var deferral = e.SuspendingOperation.GetDeferral();
|
||||||
|
//TODO: Save application state and stop any background activity
|
||||||
|
deferral.Complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
src/modules/HelloModule/Assets/LockScreenLogo.scale-200.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
src/modules/HelloModule/Assets/SplashScreen.scale-200.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
src/modules/HelloModule/Assets/Square150x150Logo.scale-200.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
src/modules/HelloModule/Assets/Square44x44Logo.scale-200.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.2 KiB |
BIN
src/modules/HelloModule/Assets/StoreLogo.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
src/modules/HelloModule/Assets/Wide310x150Logo.scale-200.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
179
src/modules/HelloModule/HelloModule.csproj
Normal file
|
@ -0,0 +1,179 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||||
|
<ProjectGuid>{841BAE3A-60D7-492F-85FD-B1F3D2455CA1}</ProjectGuid>
|
||||||
|
<OutputType>AppContainerExe</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>HelloModule</RootNamespace>
|
||||||
|
<AssemblyName>HelloModule</AssemblyName>
|
||||||
|
<DefaultLanguage>en-US</DefaultLanguage>
|
||||||
|
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||||
|
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
|
||||||
|
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
|
||||||
|
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview>
|
||||||
|
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
|
||||||
|
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
|
||||||
|
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
|
||||||
|
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
|
||||||
|
<GenerateTestArtifacts>True</GenerateTestArtifacts>
|
||||||
|
<AppxBundle>Never</AppxBundle>
|
||||||
|
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
|
||||||
|
<PackageCertificateKeyFile>HelloModule_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||||
|
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||||
|
<NoWarn>;2008</NoWarn>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||||
|
<OutputPath>bin\x86\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<NoWarn>;2008</NoWarn>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
|
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<OutputPath>bin\ARM\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||||
|
<NoWarn>;2008</NoWarn>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<PlatformTarget>ARM</PlatformTarget>
|
||||||
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
|
||||||
|
<OutputPath>bin\ARM\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<NoWarn>;2008</NoWarn>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>ARM</PlatformTarget>
|
||||||
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
|
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<OutputPath>bin\ARM64\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||||
|
<NoWarn>;2008</NoWarn>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<PlatformTarget>ARM64</PlatformTarget>
|
||||||
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
|
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
|
||||||
|
<OutputPath>bin\ARM64\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<NoWarn>;2008</NoWarn>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>ARM64</PlatformTarget>
|
||||||
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
|
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||||
|
<NoWarn>;2008</NoWarn>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||||
|
<OutputPath>bin\x64\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<NoWarn>;2008</NoWarn>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
|
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="App.xaml.cs">
|
||||||
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="MainPage.xaml.cs">
|
||||||
|
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AppxManifest Include="Package.appxmanifest">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</AppxManifest>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Properties\Default.rd.xml" />
|
||||||
|
<Content Include="Assets\LockScreenLogo.scale-200.png" />
|
||||||
|
<Content Include="Assets\SplashScreen.scale-200.png" />
|
||||||
|
<Content Include="Assets\Square150x150Logo.scale-200.png" />
|
||||||
|
<Content Include="Assets\Square44x44Logo.scale-200.png" />
|
||||||
|
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
|
||||||
|
<Content Include="Assets\StoreLogo.png" />
|
||||||
|
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ApplicationDefinition Include="App.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</ApplicationDefinition>
|
||||||
|
<Page Include="MainPage.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
||||||
|
<Version>6.2.12</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="HelloModule_TemporaryKey.pfx" />
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||||
|
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
16
src/modules/HelloModule/MainPage.xaml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<Page x:Class="HelloModule.MainPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:HelloModule"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
|
||||||
|
x:Name="TheMainPage"
|
||||||
|
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||||
|
<StackPanel>
|
||||||
|
<Button Click="Button_Click">Load Settings</Button>
|
||||||
|
<Grid>
|
||||||
|
<TextBox
|
||||||
|
Text="{x:Bind Mode=TwoWay, Path=ViewModel.StringProp, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
MinWidth="500" MinHeight="500"></TextBox>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Page>
|
102
src/modules/HelloModule/MainPage.xaml.cs
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Windows.Foundation;
|
||||||
|
using Windows.Foundation.Collections;
|
||||||
|
using Windows.Storage;
|
||||||
|
using Windows.System;
|
||||||
|
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;
|
||||||
|
|
||||||
|
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
||||||
|
|
||||||
|
namespace HelloModule
|
||||||
|
{
|
||||||
|
public class MainViewModel : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
protected virtual void OnPropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
PropertyChangedEventHandler handler = PropertyChanged;
|
||||||
|
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
protected bool SetField<T>(ref T field, T value, string propertyName)
|
||||||
|
{
|
||||||
|
if (EqualityComparer<T>.Default.Equals(field, value)) return false;
|
||||||
|
field = value;
|
||||||
|
OnPropertyChanged(propertyName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private string _stripProp;
|
||||||
|
public string StringProp
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _stripProp;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != _stripProp)
|
||||||
|
{
|
||||||
|
_stripProp = value;
|
||||||
|
OnPropertyChanged(nameof(StringProp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||||
|
/// </summary>
|
||||||
|
public sealed partial class MainPage : Page
|
||||||
|
{
|
||||||
|
private async Task<string> LoadSettings()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var path = UserDataPaths.GetDefault().LocalAppData;
|
||||||
|
path += "\\Microsoft\\PowerToys\\Hello World\\settings.json";
|
||||||
|
var f = await StorageFile.GetFileFromPathAsync(path);
|
||||||
|
return await FileIO.ReadTextAsync(f);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// from https://stackoverflow.com/a/53533414/657390
|
||||||
|
await Launcher.LaunchUriAsync(new Uri("ms-settings:appsfeatures-app"));
|
||||||
|
return "Please enable filesystem for your app";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public MainViewModel ViewModel { get; set; }
|
||||||
|
public MainPage()
|
||||||
|
{
|
||||||
|
this.InitializeComponent();
|
||||||
|
ViewModel = new MainViewModel();
|
||||||
|
DataContext = ViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Button btn = sender as Button;
|
||||||
|
MainPage content = btn.FindName("TheMainPage") as MainPage;
|
||||||
|
content.ViewModel.StringProp = await LoadSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
51
src/modules/HelloModule/Package.appxmanifest
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<Package
|
||||||
|
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||||
|
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||||
|
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||||
|
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
||||||
|
IgnorableNamespaces="uap mp rescap">
|
||||||
|
|
||||||
|
<Identity
|
||||||
|
Name="46b35c25-b593-48d5-aeb1-d3e9c3b796e9"
|
||||||
|
Publisher="CN=yuyoyuppe"
|
||||||
|
Version="1.0.0.0" />
|
||||||
|
|
||||||
|
<mp:PhoneIdentity PhoneProductId="46b35c25-b593-48d5-aeb1-d3e9c3b796e9" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||||
|
|
||||||
|
<Properties>
|
||||||
|
<DisplayName>HelloModule</DisplayName>
|
||||||
|
<PublisherDisplayName>yuyoyuppe</PublisherDisplayName>
|
||||||
|
<Logo>Assets\StoreLogo.png</Logo>
|
||||||
|
</Properties>
|
||||||
|
|
||||||
|
<Dependencies>
|
||||||
|
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||||
|
</Dependencies>
|
||||||
|
|
||||||
|
<Resources>
|
||||||
|
<Resource Language="x-generate"/>
|
||||||
|
</Resources>
|
||||||
|
|
||||||
|
<Applications>
|
||||||
|
<Application Id="App"
|
||||||
|
Executable="$targetnametoken$.exe"
|
||||||
|
EntryPoint="HelloModule.App">
|
||||||
|
<uap:VisualElements
|
||||||
|
DisplayName="HelloModule"
|
||||||
|
Square150x150Logo="Assets\Square150x150Logo.png"
|
||||||
|
Square44x44Logo="Assets\Square44x44Logo.png"
|
||||||
|
Description="HelloModule"
|
||||||
|
BackgroundColor="transparent">
|
||||||
|
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
|
||||||
|
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
||||||
|
</uap:VisualElements>
|
||||||
|
</Application>
|
||||||
|
</Applications>
|
||||||
|
|
||||||
|
<Capabilities>
|
||||||
|
<Capability Name="internetClient" />
|
||||||
|
<rescap:Capability Name="broadFileSystemAccess" />
|
||||||
|
</Capabilities>
|
||||||
|
</Package>
|
29
src/modules/HelloModule/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("HelloModule")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("HelloModule")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
|
[assembly: ComVisible(false)]
|
31
src/modules/HelloModule/Properties/Default.rd.xml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<!--
|
||||||
|
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
|
||||||
|
developers. However, you can modify these parameters to modify the behavior of the .NET Native
|
||||||
|
optimizer.
|
||||||
|
|
||||||
|
Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919
|
||||||
|
|
||||||
|
To fully enable reflection for App1.MyClass and all of its public/private members
|
||||||
|
<Type Name="App1.MyClass" Dynamic="Required All"/>
|
||||||
|
|
||||||
|
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
|
||||||
|
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
|
||||||
|
|
||||||
|
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
|
||||||
|
<Namespace Name="DataClasses.ViewModels" Serialize="All" />
|
||||||
|
-->
|
||||||
|
|
||||||
|
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
|
||||||
|
<Application>
|
||||||
|
<!--
|
||||||
|
An Assembly element with Name="*Application*" applies to all assemblies in
|
||||||
|
the application package. The asterisks are not wildcards.
|
||||||
|
-->
|
||||||
|
<Assembly Name="*Application*" Dynamic="Required All" />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Add your application specific runtime directives here. -->
|
||||||
|
|
||||||
|
|
||||||
|
</Application>
|
||||||
|
</Directives>
|
|
@ -159,6 +159,22 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool helloWorld = true;
|
||||||
|
|
||||||
|
[JsonPropertyName("HelloWorld")]
|
||||||
|
public bool HelloWorld
|
||||||
|
{
|
||||||
|
get => helloWorld;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (helloWorld != value)
|
||||||
|
{
|
||||||
|
LogTelemetryEvent(value);
|
||||||
|
helloWorld = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool awake;
|
private bool awake;
|
||||||
|
|
||||||
[JsonPropertyName("Awake")]
|
[JsonPropertyName("Awake")]
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<RepositoryType>Github</RepositoryType>
|
<RepositoryType>Github</RepositoryType>
|
||||||
<PackageTags>PowerToys</PackageTags>
|
<PackageTags>PowerToys</PackageTags>
|
||||||
<NeutralLanguage>en-US</NeutralLanguage>
|
<NeutralLanguage>en-US</NeutralLanguage>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||||
<AssemblyName>Microsoft.PowerToys.Settings.UI.Lib</AssemblyName>
|
<AssemblyName>Microsoft.PowerToys.Settings.UI.Lib</AssemblyName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<WarningsAsErrors />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<Prefer32Bit>true</Prefer32Bit>
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||||
<OutputPath>..\..\..\x64\Release\SettingsUI\</OutputPath>
|
<OutputPath>..\..\..\x64\Release\SettingsUI\</OutputPath>
|
||||||
|
@ -80,6 +81,7 @@
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<Prefer32Bit>true</Prefer32Bit>
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
|
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
|
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||||
|
@ -105,7 +107,7 @@
|
||||||
<Compile Include="Controls\ShortcutControl\ShortcutDialogContentControl.xaml.cs">
|
<Compile Include="Controls\ShortcutControl\ShortcutDialogContentControl.xaml.cs">
|
||||||
<DependentUpon>ShortcutDialogContentControl.xaml</DependentUpon>
|
<DependentUpon>ShortcutDialogContentControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Controls\ShortcutControl\ShortcutWithTextLabelControl.xaml.cs">
|
<Compile Include="Controls\ShortcutControl\ShortcutWithTextLabelControl.xaml.cs">
|
||||||
<DependentUpon>ShortcutWithTextLabelControl.xaml</DependentUpon>
|
<DependentUpon>ShortcutWithTextLabelControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Controls\SettingsPageControl\SettingsPageControl.xaml.cs">
|
<Compile Include="Controls\SettingsPageControl\SettingsPageControl.xaml.cs">
|
||||||
|
@ -186,6 +188,9 @@
|
||||||
<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\HelloWorldPage.xaml.cs">
|
||||||
|
<DependentUpon>HelloWorldPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Views\ImageResizerPage.xaml.cs">
|
<Compile Include="Views\ImageResizerPage.xaml.cs">
|
||||||
<DependentUpon>ImageResizerPage.xaml</DependentUpon>
|
<DependentUpon>ImageResizerPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -421,6 +426,10 @@
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Views\HelloWorldPage.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Views\ImageResizerPage.xaml">
|
<Page Include="Views\ImageResizerPage.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|
|
@ -228,6 +228,11 @@
|
||||||
<value>Shortcut Guide</value>
|
<value>Shortcut Guide</value>
|
||||||
<comment>Product name: Navigation view item name for Shortcut Guide</comment>
|
<comment>Product name: Navigation view item name for Shortcut Guide</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Shell_HelloWorld.Content" xml:space="preserve">
|
||||||
|
<value>Hello World</value>
|
||||||
|
<comment>Product name: Navigation view item name for Hello World</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
<data name="Shell_PowerPreview.Content" xml:space="preserve">
|
<data name="Shell_PowerPreview.Content" xml:space="preserve">
|
||||||
<value>File Explorer add-ons</value>
|
<value>File Explorer add-ons</value>
|
||||||
<comment>Product name: Navigation view item name for File Explorer. Please use File Explorer as in the context of File Explorer in Windows</comment>
|
<comment>Product name: Navigation view item name for File Explorer. Please use File Explorer as in the context of File Explorer in Windows</comment>
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<Page x:Class="Microsoft.PowerToys.Settings.UI.Views.HelloWorldPage"
|
||||||
|
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"
|
||||||
|
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||||
|
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" mc:Ignorable="d"
|
||||||
|
AutomationProperties.LandmarkType="Main">
|
||||||
|
<controls:SettingsPageControl x:Uid="HelloWorld"
|
||||||
|
ModuleImageSource="ms-appx:///Assets/Modules/ShortcutGuide.png">
|
||||||
|
<controls:SettingsPageControl.ModuleContent>
|
||||||
|
<TextBox x:Uid="ShortcutGuide_DisabledApps_TextBoxControl"
|
||||||
|
Margin="{StaticResource ExpanderSettingMargin}"
|
||||||
|
Text="{x:Bind Mode=TwoWay, Path=ViewModel.StringProp, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
||||||
|
ScrollViewer.VerticalScrollMode="Enabled"
|
||||||
|
ScrollViewer.IsVerticalRailEnabled="True" TextWrapping="Wrap"
|
||||||
|
AcceptsReturn="True" MinWidth="240" MinHeight="160" />
|
||||||
|
</controls:SettingsPageControl.ModuleContent>
|
||||||
|
</controls:SettingsPageControl>
|
||||||
|
</Page>
|
|
@ -0,0 +1,284 @@
|
||||||
|
// 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 System.Text.Json.Serialization;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.Library;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||||
|
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
|
||||||
|
using Windows.UI.Xaml.Controls;
|
||||||
|
|
||||||
|
namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||||
|
{
|
||||||
|
public class HelloWorldViewModel : Observable
|
||||||
|
{
|
||||||
|
private ISettingsUtils SettingsUtils { get; set; }
|
||||||
|
|
||||||
|
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||||
|
|
||||||
|
private HelloWorldSettings Settings { get; set; }
|
||||||
|
|
||||||
|
private const string ModuleName = HelloWorldSettings.ModuleName;
|
||||||
|
|
||||||
|
private Func<string, int> SendConfigMSG { get; }
|
||||||
|
|
||||||
|
private string _settingsConfigFileFolder = string.Empty;
|
||||||
|
private string _stringProp;
|
||||||
|
|
||||||
|
public HelloWorldViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<HelloWorldSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
|
||||||
|
{
|
||||||
|
SettingsUtils = settingsUtils;
|
||||||
|
|
||||||
|
// Update Settings file folder:
|
||||||
|
_settingsConfigFileFolder = configFileSubfolder;
|
||||||
|
|
||||||
|
// To obtain the general PowerToys settings.
|
||||||
|
if (settingsRepository == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(settingsRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
// To obtain the shortcut guide settings, if the file exists.
|
||||||
|
// If not, to create a file with the default settings and to return the default configurations.
|
||||||
|
if (moduleSettingsRepository == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(moduleSettingsRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings = moduleSettingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
// set the callback functions value to hangle outgoing IPC message.
|
||||||
|
SendConfigMSG = ipcMSGCallBackFunc;
|
||||||
|
|
||||||
|
_isEnabled = GeneralSettingsConfig.Enabled.HelloWorld;
|
||||||
|
_stringProp = Settings.Properties.StringProp.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _isEnabled;
|
||||||
|
|
||||||
|
public bool IsEnabled
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _isEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != _isEnabled)
|
||||||
|
{
|
||||||
|
_isEnabled = value;
|
||||||
|
|
||||||
|
// To update the status of shortcut guide in General PowerToy settings.
|
||||||
|
GeneralSettingsConfig.Enabled.HelloWorld = value;
|
||||||
|
OutGoingGeneralSettings snd = new OutGoingGeneralSettings(GeneralSettingsConfig);
|
||||||
|
|
||||||
|
OnPropertyChanged(nameof(IsEnabled));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string StringProp
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _stringProp;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != _stringProp)
|
||||||
|
{
|
||||||
|
_stringProp = value;
|
||||||
|
Settings.Properties.StringProp.Value = value;
|
||||||
|
NotifyPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetSettingsSubPath()
|
||||||
|
{
|
||||||
|
return _settingsConfigFileFolder + "\\" + ModuleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
|
||||||
|
{
|
||||||
|
OnPropertyChanged(propertyName);
|
||||||
|
|
||||||
|
SettingsUtils.SaveSettings(Settings.ToJsonString(), ModuleName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||||
|
{
|
||||||
|
public class HelloWorldProperties
|
||||||
|
{
|
||||||
|
public HelloWorldProperties()
|
||||||
|
{
|
||||||
|
StringProp = new StringProperty();
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonPropertyName("string_prop")]
|
||||||
|
public StringProperty StringProp { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class HelloWorldSettings : BasePTModuleSettings, ISettingsConfig
|
||||||
|
{
|
||||||
|
public const string ModuleName = "Hello World";
|
||||||
|
|
||||||
|
[JsonPropertyName("properties")]
|
||||||
|
public HelloWorldProperties Properties { get; set; }
|
||||||
|
|
||||||
|
public HelloWorldSettings()
|
||||||
|
{
|
||||||
|
Name = ModuleName;
|
||||||
|
Properties = new HelloWorldProperties();
|
||||||
|
Version = "1.0";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetModuleName()
|
||||||
|
{
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This can be utilized in the future if the settings.json file is to be modified/deleted.
|
||||||
|
public bool UpgradeSettingsConfiguration()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||||
|
{
|
||||||
|
public class HelloWorldViewModel : Observable
|
||||||
|
{
|
||||||
|
private ISettingsUtils SettingsUtils { get; set; }
|
||||||
|
|
||||||
|
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||||
|
|
||||||
|
private HelloWorldSettings Settings { get; set; }
|
||||||
|
|
||||||
|
private const string ModuleName = HelloWorldSettings.ModuleName;
|
||||||
|
|
||||||
|
private Func<string, int> SendConfigMSG { get; }
|
||||||
|
|
||||||
|
private string _settingsConfigFileFolder = string.Empty;
|
||||||
|
private string _stringProp;
|
||||||
|
|
||||||
|
public HelloWorldViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<HelloWorldSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
|
||||||
|
{
|
||||||
|
SettingsUtils = settingsUtils;
|
||||||
|
|
||||||
|
// Update Settings file folder:
|
||||||
|
_settingsConfigFileFolder = configFileSubfolder;
|
||||||
|
|
||||||
|
// To obtain the general PowerToys settings.
|
||||||
|
if (settingsRepository == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(settingsRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
// To obtain the shortcut guide settings, if the file exists.
|
||||||
|
// If not, to create a file with the default settings and to return the default configurations.
|
||||||
|
if (moduleSettingsRepository == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(moduleSettingsRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings = moduleSettingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
// set the callback functions value to hangle outgoing IPC message.
|
||||||
|
SendConfigMSG = ipcMSGCallBackFunc;
|
||||||
|
|
||||||
|
_isEnabled = GeneralSettingsConfig.Enabled.HelloWorld;
|
||||||
|
_stringProp = Settings.Properties.StringProp.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _isEnabled;
|
||||||
|
|
||||||
|
public bool IsEnabled
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _isEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != _isEnabled)
|
||||||
|
{
|
||||||
|
_isEnabled = value;
|
||||||
|
|
||||||
|
// To update the status of shortcut guide in General PowerToy settings.
|
||||||
|
GeneralSettingsConfig.Enabled.HelloWorld = value;
|
||||||
|
OutGoingGeneralSettings snd = new OutGoingGeneralSettings(GeneralSettingsConfig);
|
||||||
|
|
||||||
|
SendConfigMSG(snd.ToString());
|
||||||
|
OnPropertyChanged(nameof(IsEnabled));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string DisabledApps
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _stringProp;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != _stringProp)
|
||||||
|
{
|
||||||
|
_stringProp = value;
|
||||||
|
Settings.Properties.StringProp.Value = value;
|
||||||
|
NotifyPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetSettingsSubPath()
|
||||||
|
{
|
||||||
|
return _settingsConfigFileFolder + "\\" + ModuleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
|
||||||
|
{
|
||||||
|
OnPropertyChanged(propertyName);
|
||||||
|
|
||||||
|
SettingsUtils.SaveSettings(Settings.ToJsonString(), ModuleName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||||
|
{
|
||||||
|
public sealed partial class HelloWorldPage : Page
|
||||||
|
{
|
||||||
|
private HelloWorldViewModel ViewModel { get; set; }
|
||||||
|
|
||||||
|
public HelloWorldPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
var settingsUtils = new SettingsUtils();
|
||||||
|
ViewModel = new HelloWorldViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), SettingsRepository<HelloWorldSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
|
||||||
|
DataContext = ViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OpenColorsSettings_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Helpers.StartProcessHelper.Start(Helpers.StartProcessHelper.ColorsSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -129,7 +129,16 @@
|
||||||
ShowAsMonochrome="False" />
|
ShowAsMonochrome="False" />
|
||||||
</muxc:NavigationViewItem.Icon>
|
</muxc:NavigationViewItem.Icon>
|
||||||
</muxc:NavigationViewItem>
|
</muxc:NavigationViewItem>
|
||||||
|
|
||||||
|
<muxc:NavigationViewItem x:Uid="Shell_HelloWorld"
|
||||||
|
helpers:NavHelper.NavigateTo="views:HelloWorldPage"
|
||||||
|
Margin="0,0,12,0">
|
||||||
|
<muxc:NavigationViewItem.Icon>
|
||||||
|
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsShortcutGuide.png"
|
||||||
|
ShowAsMonochrome="False" />
|
||||||
|
</muxc:NavigationViewItem.Icon>
|
||||||
|
</muxc:NavigationViewItem>
|
||||||
|
|
||||||
<!--TODO(yuyoyuppe): uncomment when VCM should be enabled-->
|
<!--TODO(yuyoyuppe): uncomment when VCM should be enabled-->
|
||||||
<!--<muxc:NavigationViewItem x:Uid="Shell_VideoConference"
|
<!--<muxc:NavigationViewItem x:Uid="Shell_VideoConference"
|
||||||
helpers:NavHelper.NavigateTo="views:VideoConferencePage"
|
helpers:NavHelper.NavigateTo="views:VideoConferencePage"
|
||||||
|
|