https://github.com/dkackman/desktopbridgeenvironment
Library that helps a Desktop Bridge application run both as a package and regular exe.
https://github.com/dkackman/desktopbridgeenvironment
Last synced: 10 months ago
JSON representation
Library that helps a Desktop Bridge application run both as a package and regular exe.
- Host: GitHub
- URL: https://github.com/dkackman/desktopbridgeenvironment
- Owner: dkackman
- License: mit
- Created: 2017-02-26T17:54:41.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-26T21:00:11.000Z (over 9 years ago)
- Last Synced: 2025-03-14T20:45:34.638Z (over 1 year ago)
- Language: PowerShell
- Size: 1.25 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DesktopBridgeEnvironment
Library that helps a Desktop Bridge application run both as a package and regular exe.
[NuGet Package](https://www.nuget.org/packages/DesktopBridgeEnvironment/)
A Desktop Bridge exe doesn't share the same Launch.Suspend semantics as a UWP app. This make Toast notifcations somewhat cumbersome as everytime a user reacts to a UWP notificaiton an new instance is invoked. Further, the lifetime a UWP toast can outlast the app instance. This package helps smooth over those differences between UWP and Win32.
static void Main(string [] args)
{
using (var instance = new SingleInstance(ExecutionEnvironment.Current.AppId))
{
// make sure we are the only instance running before doing anything.
if (instance.IsFirstInstance)
{
ExecutionEnvironment.Current.StartupArgs = args;
Application.Run(new Form1());
}
}
}
And then elsewhere in the app:
protected override void OnLoad(EventArgs e)
{
if (ExecutionEnvironment.Current.IsUwp)
{
// do uwp form load stuff
if (ExecutionEnvironment.Current.StartupArgs != null && ExecutionEnvironment.Current.StartupArgs.Length > 0)
{
// process Uwp notification message
}
}
else
{
// do win32 form load stuff
}
base.OnLoad(e);
}