add two way IPC

This commit is contained in:
Lavius Motileng
2020-04-07 14:19:33 -07:00
parent b351e60d52
commit 2a0e92e4e2
35 changed files with 1303 additions and 146 deletions

View File

@@ -0,0 +1,8 @@
<Application x:Class="Microsoft.PowerToys.Settings.UI.Runner.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace Microsoft.PowerToys.Settings.UI.Runner
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

View File

@@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

View File

@@ -0,0 +1,15 @@
<Window x:Class="Microsoft.PowerToys.Settings.UI.Runner.MainWindow"
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:local="clr-namespace:Microsoft.PowerToys.Settings.UI.Runner"
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"
mc:Ignorable="d"
Title="PowerToys Settings" Height="800" Width="1000">
<Grid>
<xaml:WindowsXamlHost InitialTypeName="Microsoft.PowerToys.Settings.UI.Views.ShellPage" ChildChanged="WindowsXamlHost_ChildChanged" />
</Grid>
</Window>

View File

@@ -0,0 +1,31 @@
// 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.Windows;
using Microsoft.PowerToys.Settings.UI.Views;
using Microsoft.Toolkit.Wpf.UI.XamlHost;
namespace Microsoft.PowerToys.Settings.UI.Runner
{
// Interaction logic for MainWindow.xaml.
public partial class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
}
private void WindowsXamlHost_ChildChanged(object sender, EventArgs e)
{
// Hook up x:Bind source.
WindowsXamlHost windowsXamlHost = sender as WindowsXamlHost;
ShellPage shellPage = windowsXamlHost.GetUwpInternalObject() as ShellPage;
if (shellPage != null)
{
}
}
}
}

View File

@@ -0,0 +1,69 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<StartupObject>Microsoft.PowerToys.Settings.UI.Runner.Program</StartupObject>
<Authors>Microsoft Corporation</Authors>
<Product>PowerToys</Product>
<Description>Windows system utilities to maximize productivity</Description>
<Company>Microsoft Corporation</Company>
<PackageIcon>logo.png</PackageIcon>
<PackageIconUrl />
<RepositoryUrl>https://github.com/microsoft/PowerToys</RepositoryUrl>
<RepositoryType>Github</RepositoryType>
<PackageTags>PowerToys</PackageTags>
<Version>0.15.2.0</Version>
<Platforms>x64</Platforms>
<ApplicationIcon>icon.ico</ApplicationIcon>
<Win32Resource />
<!-- crutkas TODO: added for fallback, may need to be removed for WinUI3 -->
<AssetTargetFallback>uap10.0.18362</AssetTargetFallback>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutputPath>..\..\..\$(Platform)\$(Configuration)\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutputPath>..\..\..\$(Platform)\$(Configuration)\</OutputPath>
</PropertyGroup>
<ItemGroup>
<AdditionalFiles Include="..\..\codeAnalysis\StyleCop.json" Link="StyleCop.json" />
</ItemGroup>
<ItemGroup>
<COMReference Include="TwoWayIPCLibLib.dll">
<Guid>7e00d5a3-11df-45c1-a675-96e408bd5bf5</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>false</Isolated>
</COMReference>
</ItemGroup>
<ItemGroup>
<None Include="..\settingsui\Assets\logo.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Toolkit.Wpf.UI.Controls" Version="6.0.0" />
<PackageReference Include="Microsoft.Toolkit.Wpf.UI.XamlHost" Version="6.0.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,45 @@
// 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.Windows;
using TwoWayIPCLibLib;
namespace Microsoft.PowerToys.Settings.UI.Runner
{
public class Program
{
// Create an instance of the IPC wrapper.
private static ITwoWayIPCManager ipcmanager = new TwoWayIPCManager();
[STAThreadAttribute()]
public static void Main(string[] args)
{
using (new UI.App())
{
App app = new App();
app.InitializeComponent();
if (args.Length > 1)
{
ipcmanager.Initialize(args[1], args[0]);
app.Run();
}
else
{
MessageBox.Show(
"The application cannot be run as a standalone process. Please start the application through the runner.",
"Forbidden",
MessageBoxButton.OK);
app.Shutdown();
}
}
}
public static ITwoWayIPCManager GetTwoWayIPCManager()
{
return ipcmanager;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB