In Luminous Code & in Start Page+'s DialogService, I have various message helpers, but I was using WPF's MessageBox.Show which I learned recently in one of Mads's shows that it shouldn't be done that way. A perfect example of the raison d'etre for VSSDK.Helpers! Or Microsoft.Toolbox.VSSDK as I've suggested in issue #2.
I then built on that to have:
public Result ShowMessage(string message, string title = null, Button button = Button.OK, Icon icon = Icon.None)
=> MessageBox.Show(message, title ?? Vsix.Name, button, icon);
public void ShowExclamation(string message, string title = null)
=> ShowMessage(message, title, button: Button.OK, icon: Icon.Exclamation);
public void ShowWarning(string message, string title = null)
=> ShowMessage(message, title, button: Button.OK, icon: Icon.Warning);
public void ShowError(string message, string title = null)
=> ShowMessage(message, title, button: Button.OK, icon: Icon.Error);
public void ShowError(Exception ex, bool extendedMessage = true)
=> ShowError(extendedMessage ? ex.ExtendedMessage() : ex.Message);
public Result ShowConfirm(string question, string title = null, Button button = Button.YesNo)
=> ShowMessage(question, title: title ?? "Please Confirm", button, icon: Icon.Question);
In
Luminous Code
& in Start Page+'sDialogService
, I have various message helpers, but I was using WPF'sMessageBox.Show
which I learned recently in one of Mads's shows that it shouldn't be done that way. A perfect example of the raison d'etre for VSSDK.Helpers! OrMicrosoft.Toolbox.VSSDK
as I've suggested in issue #2.I then built on that to have:
Building on that idea, we could have:
etc
Writing code like: