public override void Execute() { IDocument activeDocument = this.documentService.ActiveDocument; if (activeDocument == null || !DocumentUtilities.PromptUserAndSaveDocument(activeDocument, true, this.messageDisplayService)) { return; } this.documentService.CloseDocument(activeDocument); }
public static bool PromptUserAndSaveDocument(IDocument document, bool saveAsOnFailure, IMessageDisplayService messageManager) { bool flag = false; if (document.IsDirty) { IDictionary <MessageChoice, string> dictionary = (IDictionary <MessageChoice, string>) new Dictionary <MessageChoice, string>() { { MessageChoice.Yes, StringTable.SaveChangesYesResponse }, { MessageChoice.No, StringTable.SaveChangesNoResponse } }; MessageBoxArgs args = new MessageBoxArgs() { Message = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.SaveChangesTo, new object[1] { (object)document.DocumentReference.DisplayName }), Button = MessageBoxButton.YesNoCancel, Image = MessageBoxImage.Exclamation, TextOverrides = dictionary }; switch (messageManager.ShowMessage(args)) { case MessageBoxResult.Yes: flag = DocumentUtilities.SaveDocument(document, saveAsOnFailure, messageManager); break; case MessageBoxResult.No: flag = true; break; } } else { flag = true; } return(flag); }
public static bool SaveDocument(IDocument document, bool saveAsOnFailure, IMessageDisplayService messageManager) { return(DocumentUtilities.SaveDocument(document, saveAsOnFailure, false, messageManager)); }
public override void Execute() { DocumentUtilities.SaveDocument(this.documentService.ActiveDocument, true, true, this.messageDisplayService); }
public bool PromptToSaveAssociatedDocument(IDocument document, IMessageDisplayService messageDisplayService) { return(DocumentUtilities.PromptUserAndSaveDocument(document, true, messageDisplayService)); }