From f5df4f9a018bd84cb44ea2dce27d8b448f55c9fb Mon Sep 17 00:00:00 2001 From: GrahamTheCoder Date: Sun, 1 Mar 2020 17:10:15 +0000 Subject: [PATCH] Make sure the user knows we're waiting for them Sometimes messageboxes can appear in odd positions on multi-monitor setups or setups that change resolution or number of displays within a session --- Vsix/CodeConversion.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Vsix/CodeConversion.cs b/Vsix/CodeConversion.cs index ba6152620..6fcc90cc0 100644 --- a/Vsix/CodeConversion.cs +++ b/Vsix/CodeConversion.cs @@ -59,7 +59,7 @@ await _joinableTaskFactory.RunAsync(async () => { }); } catch (OperationCanceledException) { if (!_packageCancellation.CancelAll.IsCancellationRequested) { - await _outputWindow.WriteToOutputWindowAsync("Previous conversion cancelled", forceShow: true); + await _outputWindow.WriteToOutputWindowAsync(Environment.NewLine + "Previous conversion cancelled", forceShow: true); } } } @@ -80,7 +80,7 @@ await _joinableTaskFactory.RunAsync(async () => { } } catch (OperationCanceledException) { if (!_packageCancellation.CancelAll.IsCancellationRequested) { - await _outputWindow.WriteToOutputWindowAsync("Previous conversion cancelled", forceShow: true); + await _outputWindow.WriteToOutputWindowAsync(Environment.NewLine + "Previous conversion cancelled", forceShow: true); } } } @@ -160,17 +160,20 @@ private async Task FinalizeConversionAsync(List files, List erro } - private Task UserHasConfirmedOverwriteAsync(List files, List errors, IReadOnlyCollection pathsToOverwrite) + private async Task UserHasConfirmedOverwriteAsync(List files, List errors, IReadOnlyCollection pathsToOverwrite) { var maxExamples = 30; // Avoid a huge unreadable dialog going off the screen var exampleText = pathsToOverwrite.Count > maxExamples ? $". First {maxExamples} examples" : ""; - return VisualStudioInteraction.ShowMessageBoxAsync(_serviceProvider, + await _outputWindow.WriteToOutputWindowAsync(Environment.NewLine + "Awaiting user confirmation for overwrite....", forceShow: true); + bool shouldOverwrite = await VisualStudioInteraction.ShowMessageBoxAsync(_serviceProvider, "Overwrite solution and referencing projects?", $@"The current solution file and any referencing projects will be overwritten to reference the new project(s){exampleText}: * {string.Join(Environment.NewLine + "* ", pathsToOverwrite.Take(maxExamples))} The old contents will be copied to 'currentFilename.bak'. Please 'Reload All' when Visual Studio prompts you.", true, files.Count > errors.Count); + await _outputWindow.WriteToOutputWindowAsync(shouldOverwrite ? "confirmed" : "declined"); + return shouldOverwrite; } private static bool WillOverwriteSource(ConversionResult convertedFile)