-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
62 lines (53 loc) · 1.85 KB
/
Program.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Threading;
using Microsoft.UI.Dispatching;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Markup;
using Microsoft.UI.Xaml.XamlTypeInfo;
namespace WPF_XAML_Islands_WinUI3
{
internal class Program : Microsoft.UI.Xaml.Application, IXamlMetadataProvider
{
private static XamlControlsXamlMetaDataProvider? xamlMetaDataProvider = null;
public Program()
{
var app = new App();
app.InitializeComponent();
app.Run();
}
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
XamlControlsXamlMetaDataProvider.Initialize();
xamlMetaDataProvider = new();
this.Resources.MergedDictionaries.Add(new Microsoft.UI.Xaml.Controls.XamlControlsResources());
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Microsoft.UI.Xaml.Application.Start((p) =>
{
var syncContext = new DispatcherQueueSynchronizationContext(DispatcherQueue.GetForCurrentThread());
SynchronizationContext.SetSynchronizationContext(syncContext);
new Program();
var currentApp = Microsoft.UI.Xaml.Application.Current;
if (currentApp is not null)
currentApp.Exit();
});
}
public IXamlType GetXamlType(Type type)
{
return xamlMetaDataProvider.GetXamlType(type);
}
public IXamlType GetXamlType(string fullName)
{
return xamlMetaDataProvider.GetXamlType(fullName);
}
public XmlnsDefinition[] GetXmlnsDefinitions()
{
return xamlMetaDataProvider.GetXmlnsDefinitions();
}
}
}