示例#1
0
            public override void Execute()
            {
                IDocument activeDocument = this.documentService.ActiveDocument;

                if (activeDocument == null || !DocumentUtilities.PromptUserAndSaveDocument(activeDocument, true, this.messageDisplayService))
                {
                    return;
                }
                this.documentService.CloseDocument(activeDocument);
            }
示例#2
0
        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);
        }
示例#3
0
 public static bool SaveDocument(IDocument document, bool saveAsOnFailure, IMessageDisplayService messageManager)
 {
     return(DocumentUtilities.SaveDocument(document, saveAsOnFailure, false, messageManager));
 }
示例#4
0
 public override void Execute()
 {
     DocumentUtilities.SaveDocument(this.documentService.ActiveDocument, true, true, this.messageDisplayService);
 }
示例#5
0
 public bool PromptToSaveAssociatedDocument(IDocument document, IMessageDisplayService messageDisplayService)
 {
     return(DocumentUtilities.PromptUserAndSaveDocument(document, true, messageDisplayService));
 }