ProcessForUWP.Core
0.0.4
dotnet add package ProcessForUWP.Core --version 0.0.4
NuGet\Install-Package ProcessForUWP.Core -Version 0.0.4
<PackageReference Include="ProcessForUWP.Core" Version="0.0.4" />
paket add ProcessForUWP.Core --version 0.0.4
#r "nuget: ProcessForUWP.Core, 0.0.4"
// Install ProcessForUWP.Core as a Cake Addin #addin nuget:?package=ProcessForUWP.Core&version=0.0.4 // Install ProcessForUWP.Core as a Cake Tool #tool nuget:?package=ProcessForUWP.Core&version=0.0.4
Process for UWP
一种适用于 UWP 平台的 Process 方法
基于 @Silver-Fang 的项目 (Github)
目录
简介
本项目基于 @Silver-Fang 的项目 ProcessForUWP,与其不同的是,本项目利用了通信接口 AppServiceConnection
来进行应用间的通信,所以不用执行一次就弹一次 UAC,但是使用起来会比较麻烦。目前仍在开发当中,如果有兴趣欢迎加入。
如何使用
在你的解决方案中添加一个打包项目和一个空白桌面应用项目。在打包项目中引用你的 UWP 项目和桌面应用项目。在 UWP 项目中添加引用 ProcessForUWP.UWP
,在桌面应用项目中引用 ProcessForUWP.Desktop
。
然后在打包项目的 Package.appxmanifest
中添加:
<Package
...
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
IgnorableNamespaces="uap rescap desktop">
...
<Applications>
<Application>
...
<Extensions>
<uap:Extension Category="windows.appService">
<uap:AppService Name="ProcessForUWP.Delegate"/>
</uap:Extension>
<desktop:Extension Category="windows.fullTrustProcess" Executable="【桌面应用项目的路径,如:ProcessForUWP.Demo.Delegate\ProcessForUWP.Demo.Delegate.exe】" />
</Extensions>
</Application>
</Applications>
...
</Package>
在 UWP 项目的 App.xaml.cs
中添加:
public sealed partial class App : Application
{
...
protected override async void OnLaunched(LaunchActivatedEventArgs e)
{
Communication.InitializeAppServiceConnection();
...
}
/// <summary>
/// Handles connection requests to the app service
/// </summary>
/// <param name="args">Data about the background activation.</param>
protected override void OnBackgroundActivated(BackgroundActivatedEventArgs args)
{
base.OnBackgroundActivated(args);
Communication.OnBackgroundActivated(args);
}
}
在桌面项目的 Program.cs
中添加:
internal class Program
{
private static void Main(string[] args)
{
Communication.InitializeAppServiceConnection();
...
EventWaitHandle WaitHandle = new AutoResetEvent(false);
_ = WaitHandle.WaitOne();
}
...
}
在解决方案配置管理器中,三个项目的平台需保持一致,建议都设为x64。生成都要勾选。部署只需勾选打包项目,UWP 项目和桌面项目都不需部署。
解决方案的启动项目应设为打包项目。
注意事项
- 具体使用方法请查看 Demo
- 请不要在应用初始化过程中新建 Process 类,虽然我已经做了未加载完成的判断,但是这个判断可能会占用了线程导致应用初始化无法完成,如果真的要在应用初始化时新建 Process 类,请把它挪到别的线程去,或者提出 issue 帮助我解决这个问题。
Star 数量统计
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net452 is compatible. net46 was computed. net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap10.0.15138 is compatible. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- Newtonsoft.Json (>= 13.0.3)
-
.NETFramework 4.5.2
- Newtonsoft.Json (>= 13.0.3)
-
.NETFramework 4.6.2
- Newtonsoft.Json (>= 13.0.3)
-
.NETFramework 4.8
- Newtonsoft.Json (>= 13.0.3)
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.3)
-
net6.0
- Newtonsoft.Json (>= 13.0.3)
-
UAP 10.0.15138
- Newtonsoft.Json (>= 13.0.3)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on ProcessForUWP.Core:
Package | Downloads |
---|---|
ProcessForUWP.Desktop
一种适用于 UWP 平台的 Process 方法 本项目基于 @Silver-Fang 的项目 ProcessForUWP,与其不同的是,本项目利用了通信接口 AppServiceConnection 来进行应用间的通信,所以不用执行一次就弹一次 UAC,但是使用起来会比较麻烦。目前仍在开发当中,如果有兴趣欢迎加入。 本 Nuget 包为桌面端,具体使用方法请查阅项目仓库中的 Readme。 |
|
ProcessForUWP.UWP
一种适用于 UWP 平台的 Process 方法 本项目基于 @Silver-Fang 的项目 ProcessForUWP,与其不同的是,本项目利用了通信接口 AppServiceConnection 来进行应用间的通信,所以不用执行一次就弹一次 UAC,但是使用起来会比较麻烦。目前仍在开发当中,如果有兴趣欢迎加入。 本 Nuget 包为 UWP 端,具体使用方法请查阅项目仓库中的 Readme。 |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|