| Name | Message | Date |
|---|---|---|
| 📄 AvaloniaManager.cs | 1 month ago | |
| 📄 GridTreeWindow.cs | 1 month ago | |
| 📄 OutGridTree.cs | 1 month ago | |
| 📄 OutGridTree.csproj | 1 month ago | |
| 📄 packages.lock.json | 1 month ago |
📄
OutGridTree/AvaloniaManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System; using System.Threading; using System.Threading.Tasks; using Avalonia; using Avalonia.Controls; using Avalonia.Threading; namespace OutGridTree; internal static class AvaloniaManager { private static readonly Lazy<Task> appBuilder = new( static () => { var tcs = new TaskCompletionSource<object>(); var t = new Thread(() => AppBuilder .Configure<Application>() .UsePlatformDetect() .AfterPlatformServicesSetup(_ => tcs.SetResult(new())) .Start((app, _) => app.Run(CancellationToken.None), []) ); t.Start(); return tcs.Task; }, LazyThreadSafetyMode.ExecutionAndPublication ); public static TWindow OpenWindow<TWindow>() where TWindow : Window, new() { appBuilder.Value.Wait(); return Dispatcher.UIThread.Invoke(() => { var window = new TWindow(); window.Show(); return window; }); } }