diff options
author | Mike Krüger <mikkrg@microsoft.com> | 2018-04-16 17:30:27 +0300 |
---|---|---|
committer | Marius Ungureanu <teromario@yahoo.com> | 2018-04-17 19:57:35 +0300 |
commit | 671999f9cb25531a0420cc5898c28d91c0a0d413 (patch) | |
tree | 622cd6f01845aad2f9ef14d05cbf6052448ee9f0 /main/src/core | |
parent | 0a9d5590b5e68857ef98b96b3b70ca69c01cbd9b (diff) |
Fixes VSTS 591324: Multiple Popup save dialog when close using
keyboard shortcut multiple times
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/591324
This method isn't called anywhere else.
Diffstat (limited to 'main/src/core')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs | 13 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs | 12 |
2 files changed, 19 insertions, 6 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs index 6e28dc5616..4e9b56c683 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs @@ -148,15 +148,22 @@ namespace MonoDevelop.Ide.Commands // MonoDevelop.Ide.Commands.FileCommands.CloseAllFiles public class CloseAllFilesHandler : CommandHandler { - protected override void Run () + static bool isRunning; + + protected override async void Run () { - IdeApp.Workbench.CloseAllDocuments (false); + try { + isRunning = true; + await IdeApp.Workbench.CloseAllDocumentsAsync (false); + } finally { + isRunning = false; + } } protected override void Update (CommandInfo info) { // No point in closing all when there are no documents open - info.Enabled = IdeApp.Workbench.Documents.Count != 0; + info.Enabled = !isRunning && IdeApp.Workbench.Documents.Count != 0; } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs index 2402906a83..99c853076d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs @@ -394,9 +394,15 @@ namespace MonoDevelop.Ide.Gui GettextCatalog.GetString ("If you don't save, all changes will be permanently lost."), AlertButton.CloseWithoutSave, AlertButton.Cancel, doc.Window.ViewContent.IsUntitled ? AlertButton.SaveAs : AlertButton.Save); } - + + [Obsolete("Use CloseAllDocumentsAsync")] public void CloseAllDocuments (bool leaveActiveDocumentOpen) { + CloseAllDocumentsAsync (leaveActiveDocumentOpen).Ignore (); + } + + public async Task CloseAllDocumentsAsync (bool leaveActiveDocumentOpen) + { Document[] docs = new Document [Documents.Count]; Documents.CopyTo (docs, 0); @@ -405,10 +411,10 @@ namespace MonoDevelop.Ide.Gui foreach (Document doc in docs) { if (doc != ActiveDocument) - doc.Close ().Ignore(); + await doc.Close (); } if (!leaveActiveDocumentOpen && ActiveDocument != null) - ActiveDocument.Close ().Ignore(); + await ActiveDocument.Close (); } internal Pad ShowPad (PadCodon content) |