BlueSky.SyntaxEditorWindow.Window_Closing C# (CSharp) Метод

Window_Closing() приватный Метод

private Window_Closing ( object sender, System e ) : void
sender object
e System
Результат void
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (this.Visibility == System.Windows.Visibility.Visible)//Do this only if Syn Edtr is visible.
            {
                this.Activate();
                System.Windows.Forms.DialogResult dresult = System.Windows.Forms.DialogResult.OK;
                if (Modified)
                {
                    dresult = System.Windows.Forms.MessageBox.Show(
                              "Do you want to save commands before closing Command Editor?",
                              "Save & Exit Command Editor?",
                              System.Windows.Forms.MessageBoxButtons.YesNoCancel,
                              System.Windows.Forms.MessageBoxIcon.Question);
                }
                if (dresult == System.Windows.Forms.DialogResult.Cancel)//dont close
                {
                    e.Cancel = true; // do not close this window
                    this.SEForceClose = false;
                }
                else /// [just hide. OR hide and close] with or without saving
                {
                    ///before closing save R scripts in Syntax Editor text area..13Feb2013
                    if (dresult == System.Windows.Forms.DialogResult.Yes)//Save
                        SyntaxEditorSaveAs();

                    /// Do hide OR hide & close ///
                    inputTextbox.Text = string.Empty; //Clean window
                    this.Visibility = System.Windows.Visibility.Hidden;// hide window. If you close down you can't reopen it again.
                    if (!this.SEForceClose)
                        e.Cancel = true;//stop closing
                    //else we Forcefully close this window. We dont want to open it again, Since application is exiting.
                    Modified = false;
                    Title = "Command Editor Window";
                }
            }

        }
SyntaxEditorWindow