protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); //this.MainWindow = new winMain(); //this.MainWindow.Show(); // Initialize the splash screen var splash = new winSplash(); this.MainWindow = splash; splash.Show(); splash.Focus(); // Ensure the UI stays responsive Task.Factory.StartNew(() => { // Loading something // DO ... splash.InvokeUpdate("Load the main window ..."); // Return UI thread this.Dispatcher.Invoke(() => { this.MainWindow = new winMain(splash); this.MainWindow.Loaded += (object sender, RoutedEventArgs e) => { splash.Close(); }; this.MainWindow.Show(); this.MainWindow.Focus(); }); }); }
public winMain(winSplash splash = null) { InitializeComponent(); DataContext = this; if (splash != null) { splash.InvokeUpdate("Loading application settings ..."); } _FormulaZoom = Settings.Default.FormulaScale; ClipBgColor.SelectedColor = Settings.Default.BgColorToClip; JpgBgColor.SelectedColor = Settings.Default.BgColorToJpg; if (splash != null) { splash.InvokeUpdate("Loading V8 javascipt engine ..."); } _ = MathjaxParser.GetInstance(); if (splash != null) { splash.InvokeUpdate("Loading application resouces ..."); } //InitializeFontSelector(); //formulaFontName = ((FontFamily)eFontFamily.GetFirstCheckedItem().Tag).ToString(); //formulaFontSize = (double)eFontSize.EditValue; DataObject.AddCopyingHandler(txtInputFomula, OnInputFomulaCopying); if (Clipboard.ContainsText()) { myClipboard.Add(Clipboard.GetText()); } if (splash != null) { splash.InvokeUpdate("Loading latex resources ..."); } LoadSymbols(); if (splash != null) { splash.InvokeUpdate("Show window ..."); } AddNotifiactions(); Application.Current.Exit += OnApplicationExit; }