Skip to content

Commit

Permalink
(chocolatey#904) Add wrapping methods for all Show methods
Browse files Browse the repository at this point in the history
There are 12 show methods in the MessageBox class, instead of just
wrapping the few we currently use, this adds wrappers for the rest.
  • Loading branch information
corbob committed Jan 16, 2022
1 parent 344560e commit 4262b5d
Showing 1 changed file with 73 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,79 @@ public static MessageBoxResult Show(string messageBoxText, string caption, Messa
return result;
}

public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult)
{
var dummyWindow = DummyWindow();
dummyWindow.Show();
var result = MessageBox.Show(messageBoxText, caption, button, icon, defaultResult);
dummyWindow.Show();
return result;
}

public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon)
{
var dummyWindow = DummyWindow();
dummyWindow.Show();
var result = MessageBox.Show(messageBoxText, caption, button, icon);
dummyWindow.Show();
return result;
}

public static MessageBoxResult Show(Window owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options)
{
var dummyWindow = DummyWindow();
dummyWindow.Show();
var result = MessageBox.Show(owner, messageBoxText, caption, button, icon, defaultResult, options);
dummyWindow.Show();
return result;
}

public static MessageBoxResult Show(Window owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult)
{
var dummyWindow = DummyWindow();
dummyWindow.Show();
var result = MessageBox.Show(owner, messageBoxText, caption, button, icon, defaultResult);
dummyWindow.Show();
return result;
}

public static MessageBoxResult Show(Window owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon)
{
var dummyWindow = DummyWindow();
dummyWindow.Show();
var result = MessageBox.Show(owner, messageBoxText, caption, button, icon);
dummyWindow.Show();
return result;
}

public static MessageBoxResult Show(Window owner, string messageBoxText, string caption, MessageBoxButton button)
{
var dummyWindow = DummyWindow();
dummyWindow.Show();
var result = MessageBox.Show(owner, messageBoxText, caption, button);
dummyWindow.Show();
return result;
}

public static MessageBoxResult Show(Window owner, string messageBoxText, string caption)
{
var dummyWindow = DummyWindow();
dummyWindow.Show();
var result = MessageBox.Show(owner, messageBoxText, caption);
dummyWindow.Show();
return result;
}

public static MessageBoxResult Show(Window owner, string messageBoxText)
{
var dummyWindow = DummyWindow();
dummyWindow.Show();
var result = MessageBox.Show(owner, messageBoxText);
dummyWindow.Show();
return result;
}


private static Window DummyWindow()
{
return new Window
Expand Down

0 comments on commit 4262b5d

Please sign in to comment.