示例#1
0
        /// <summary>
        /// This method handles the request to close the currently active window,
        /// when the user selects the Close menu item in the File menu. It prompts
        /// the user to save the file (if made any unsaved changes) before closing it.
        /// </summary>
        private void HandleClose()
        {
            if (!spreadsheet.Changed)
            {
                window.DoClose();
            }
            else
            {
                DialogResult result = window.Message("Do you wish to save your"
                                                     + " changes before closing this file?", "Save Before Exiting?",
                                                     MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);

                // if 'Yes' then save the file. If the save was cancelled, then dont close the
                // window.
                if (result == DialogResult.Yes)
                {
                    window.PerformSaveClick();
                    //HandleSave(filename);
                    if (saveCancelled)
                    {
                        return;
                    }
                }
                else if (result == DialogResult.Cancel)
                {
                    return;
                }

                // Notify the closing method that the file was asked to be closed
                // from the File menu. Then close it.
                closedFromMenu = true;
                window.DoClose();
            }
        }
示例#2
0
 private void HandleClose()
 {
     if (!model.Changed)
     {
         window.DoClose();
     }
 }
示例#3
0
 /// <summary>
 /// Closes this spreadsheet, and asks to save before it closes.
 /// </summary>
 private void HandleClose()
 {
     //Ask if they want to save if changed.
     if (spreadsheet.Changed)
     {
         window.AskSave();
     }
     window.DoClose();
 }
示例#4
0
 /// <summary>
 /// Handles a request to close the spreadsheet.
 /// If the spreadsheet has been changed since it was last saved, opens a dialogue box before closing.
 /// </summary>
 private void HandleCloseSpreadsheet(bool verified)
 {
     if (spreadsheet.Changed && !verified)
     {
         window.WarnClose();
     }
     else
     {
         window.DoClose();
     }
 }
示例#5
0
 private void HandleCloseSS()
 {
     if (!model.Changed)
     {
         spreadsheetView.DoClose();
     }
     else
     {
         try { spreadsheetView.DoCloseWithSave(model.Changed); }
         catch (Exception) { return; }
     }
 }
示例#6
0
 /// <summary>
 /// A private Event Handler that is called whenever the CloseEvent is fired.
 /// </summary>
 private void HandleCloseEvent()
 {
     // If the spreadsheet has been changed and hasn't been saved, begin the process the for
     // closing without saving.
     if (spreadsheet.Changed)
     {
         window.BeginCloseWithoutSave();
         return;
     }
     // Otherwise, just close the current window.
     window.DoClose();
 }
示例#7
0
 /// <summary>
 /// Handles a request to close the window
 /// </summary>
 private void HandleClose()
 {
     window.DoClose();
 }
 /// <summary>
 /// Handles a request to close the window
 /// </summary>
 private void HandleClose()
 {
     view.DoClose();
 }