//TODO: implement //public void Reload() //{ // _app.Dispatcher.Invoke(() => // { // WPFWindow oldWindow = Window; // Window = (WPFWindow) Activator.CreateInstance(_windowType, this, _app, Title); // ColourManager.Window = Window; // _app.Dispatcher.Invoke(() => _app.Run(Window)); // oldWindow.Close(); // }); //} /// <inheritdoc /> public override void Start() { ThreadUtils.BlockingThread wpfThread = new ThreadUtils.BlockingThread(reset => { _app = new App(this); ColourManager.App = _app; Window = (WPFWindow)Activator.CreateInstance(_windowType, this, _app, _title); AssignToLog(); AppDomain.CurrentDomain.UnhandledException += Window.HandleUnhandledException; ColourManager.Window = Window; lock (_onWindowStartup) { if (_onWindowStartup != null) { foreach (Action <object> action in _onWindowStartup) { _app.Startup += (sender, args) => action?.Invoke(Window); } } _app.Startup += (sender, args) => _onWindowStartupExecuted = true; } _app.Startup += (sender, args) => { reset.Set(); }; try { _app.Run(Window); } catch (Exception e) { _log.Fatal("Uncaught exception in Sigma UI has been thrown.", e); throw; } }); _wpfThread = wpfThread.Thread; //Start the new thread with the given priority and set it to a STAThread (required for WPF windows) wpfThread.Thread.SetApartmentState(ApartmentState.STA); wpfThread.Thread.Priority = Priority; wpfThread.Thread.CurrentUICulture = _uiCultureInfo; wpfThread.Start(); ColourManager.ForceUpdate(); _log.Debug($"{nameof(WPFMonitor)} has been started. The window {_windowType.Name} should now be visible. "); }