protected void ShowMainWindow() { // Loading data this.stateLabel.Content = "Loading data..."; WPFApplication.DoEvents(); mainBackgroundWorker.RunWorkerAsync(); }
protected void mainBackgroundWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { // Hide StartUp Window this.Hide(); this.UpdateLayout(); WPFApplication.DoEvents(); // Show main window RunTime.Instance.MainWindow = (GuiOptions.Instanse.Manager ? (IExitableWindow) new Manager() : (IExitableWindow) new Main()); RunTime.Instance.MainWindow.Dismissed += this.mainWindowFormClosed; RunTime.Instance.MainWindow.Execute(); }
private void WindowClosing(object sender, CancelEventArgs e) { if (this.Exit) { if (WinHelper.MessageBox("Do you really want close program?", "Exit...", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No) { e.Cancel = true; return; } if (!this.Visible) { this.Visible = true; } // Log if (RunTime.Instance.LogWindow != null) { RunTime.Instance.LogWindow.Close(); WPFApplication.DoEvents(); } this.updateTimer.Stop(); // Events GuiOptions.Instanse.ManagerPinChanged -= this.ManagerPinChanged; GuiOptions.Instanse.ManagerLocationChanged -= this.ManagerLocationChanged; this.trayIcon.DoubleClick -= this.IconDoubleClick; this.mainMenu.DeInitializeEvents(); this.trayIcon.DeInitializeEvents(); // Notify Icon this.trayIcon.Visible = false; this.trayIcon.Dispose(); // Exit WindowsHelper.Exit(); } else { e.Cancel = true; this.Visible = false; } }