Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shortdevelopment/shortdev.uwp.fulltrust

Create a performant WinUI application with Uwp and CoreWindow and run as full-trust win32
https://github.com/shortdevelopment/shortdev.uwp.fulltrust

full-trust star uwp winui2 xaml-islands xaml-ui

Last synced: 4 months ago
JSON representation

Create a performant WinUI application with Uwp and CoreWindow and run as full-trust win32

Awesome Lists containing this project

README

        

# ShortDev.Uwp.FullTrust

Create highly performant UI with `WinUi2` (Uwp) and enjoy the freedom of `Win32`!
You don't need any interop code for the `.GetForCurrentView()` methods.

### Problems
- The library does currently not support any Uwp-Frame related apis
- Therefore not frame customization
- Creating a new window is only possible with the library apis
- Pickers still need `IInitializeWithWindow` (See [#11](https://github.com/ShortDevelopment/ShortDev.Uwp.FullTrust/issues/11))

## Setup

1. Create new Uwp project (*UI-Project*)
2. Add `false` in to the project file
3. Add reference to this library
---
5. Create new `netcoreapp3.1` `WinExe` project (*Host-Project*)
6. Add reference to `Microsoft.Toolkit.Win32.UI.SDK`
7. Add reference to Uwp project
8. Add `TargetPlatformVersion` and `AssetTargetFallback` to the project file
9. Redirect main method to the Uwp main method (See below)

### *Host-Project* (netcoreapp3.1)
This is needed for the management of all the dependency and runtime stuff.
Should contain no logic.
```xml


WinExe
netcoreapp3.1
x86;x64
uap10.0.19041
10.0.19041





```

#### `Program.cs`
```csharp
public class Program
{
[STAThread]
public static void Main(string[] args)
{
NAMESPACE.Program.Main(args);
}
}
```

### *UI-Project* (Uwp)
Should contain all logic.
```xml



false

...

```

#### `Program.cs`
```csharp
public class Program
{
[STAThread]
public static void Main(string[] args)
{
FullTrustApplication.Start((_) => new App());
}
}
```

## Examples
#### Create New Window
```csharp
var view = FullTrustApplication.CreateNewView();
_ = view.CoreWindow.Dispatcher.RunIdleAsync((x) =>
{
Window.Current.Content = new MainPage();
Window.Current.Activate();
});
```