123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using System;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Navigation;
-
- namespace ViewShotExample.Net46
- {
-
-
-
- public partial class App : Application
- {
- private readonly AppReactPage _reactPage = new AppReactPage();
-
-
-
-
-
- public App()
- {
- }
-
-
-
-
-
- protected override void OnStartup(StartupEventArgs e)
- {
- base.OnStartup(e);
- OnCreate(e.Args);
- }
-
-
-
-
-
- private void OnCreate(string[] arguments)
- {
- var shellWindow = Application.Current.MainWindow;
-
- if (shellWindow == null)
- {
- shellWindow = new Window
- {
- ShowActivated = true,
- ShowInTaskbar = true,
- Title = "ViewShotExample.Net46",
- Height = 768,
- Width = 1024,
- WindowStartupLocation = WindowStartupLocation.CenterScreen
- };
-
- Application.Current.MainWindow = shellWindow;
- }
-
-
- if (!shellWindow.IsLoaded)
- {
- shellWindow.Show();
- }
-
- var rootFrame = shellWindow.Content as Frame;
-
-
-
- if (rootFrame == null)
- {
- _reactPage.OnCreate(arguments);
-
-
- rootFrame = new Frame();
-
- rootFrame.NavigationFailed += OnNavigationFailed;
-
-
- shellWindow.Content = rootFrame;
- }
-
- if (rootFrame.Content == null)
- {
-
-
-
- rootFrame.Content = _reactPage;
- }
-
-
- shellWindow.Activate();
- }
-
-
-
-
-
-
- private void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
- {
- throw new Exception("Failed to load Page...");
- }
- }
- }
|