コード例 #1
0
ファイル: StartUp.xaml.cs プロジェクト: UmaxSoftWorks/UDS2
        protected void ShowMainWindow()
        {
            // Loading data
            this.stateLabel.Content = "Loading data...";
            WPFApplication.DoEvents();

            mainBackgroundWorker.RunWorkerAsync();
        }
コード例 #2
0
ファイル: StartUp.xaml.cs プロジェクト: UmaxSoftWorks/UDS2
        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();
        }
コード例 #3
0
        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;
            }
        }