コード例 #1
0
        public static void Main()
        {
            var startupKind = StartupKind.Explict;

            if (startupKind == StartupKind.CustomAppSettings)
            {
                using (var xamlApp = new Win32.UI.XamlHost.XamlApplication(new List <IXamlMetadataProvider>()
                {
                    new MyMetadataProvider(),
                })
                {
                    Resources = new global::Windows.UI.Xaml.ResourceDictionary()
                    {
                        { "MyResourceKey", "MyValue" },
                    },
                })
                {
                    var app = new Microsoft.Toolkit.Sample.Wpf.App.App();
                    app.InitializeComponent();
                    app.Run();
                }
            }
#if !NET462
            else if (startupKind == StartupKind.Explict)
            {
                //using (var xamlApp = new Microsoft.Toolkit.Sample.UWP.App.AppWrapper())
                using (var xamlApp = new CppUwpApp.Wrapper())
                {
                    var app = new Microsoft.Toolkit.Sample.Wpf.App.App();
                    app.InitializeComponent();
                    app.Run();
                }
            }
#endif
            else
            {
                var app = new Microsoft.Toolkit.Sample.Wpf.App.App();
                app.InitializeComponent();
                app.Run();
            }
        }
コード例 #2
0
        public static void Main()
        {
            var startupKind = StartupKind.MultiThread;

            if (startupKind == StartupKind.CustomAppSettings)
            {
                using (var xamlApp = new Win32.UI.XamlHost.XamlApplication()
                {
                    Resources = new global::Windows.UI.Xaml.ResourceDictionary()
                    {
                        { "MyResourceKey", "MyValue" },
                    },
                    MetadataProviders =
                    {
                        new MyMetadataProvider(),
                    },
                })
                {
                    var app = new Microsoft.Toolkit.Sample.Wpf.App.App();
                    app.InitializeComponent();
                    app.Run();
                }
            }
            else if (startupKind == StartupKind.MultiThread)
            {
                using (var xamlApp = new Win32.UI.XamlHost.XamlApplication())
                {
                    var appOwnedWindowsXamlManager = xamlApp.WindowsXamlManager;
                    var app = new Microsoft.Toolkit.Sample.Wpf.App.App();
                    app.InitializeComponent();
                    app.Run();
                }
            }
            else
            {
                var app = new Microsoft.Toolkit.Sample.Wpf.App.App();
                app.InitializeComponent();
                app.Run();
            }
        }