|
@@ -27,6 +27,8 @@ public enum MessageWindowResult
|
|
|
None,
|
|
|
OK,
|
|
|
Cancel,
|
|
|
+ Yes,
|
|
|
+ No,
|
|
|
Other
|
|
|
}
|
|
|
|
|
@@ -159,6 +161,30 @@ public partial class MessageWindow : Window, INotifyPropertyChanged
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public MessageWindow AddYesButton(string content = "Yes")
|
|
|
+ {
|
|
|
+ Buttons.Add(new MessageWindowButton(content, YesButton_Click, MessageWindowButtonPosition.Right));
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public MessageWindow AddNoButton(string content = "No")
|
|
|
+ {
|
|
|
+ Buttons.Add(new MessageWindowButton(content, NoButton_Click, MessageWindowButtonPosition.Right));
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void YesButton_Click(MessageWindow window, MessageWindowButton button)
|
|
|
+ {
|
|
|
+ Result = MessageWindowResult.Yes;
|
|
|
+ Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void NoButton_Click(MessageWindow window, MessageWindowButton button)
|
|
|
+ {
|
|
|
+ Result = MessageWindowResult.No;
|
|
|
+ Close();
|
|
|
+ }
|
|
|
+
|
|
|
private void CancelButton_Click(MessageWindow window, MessageWindowButton button)
|
|
|
{
|
|
|
Result = MessageWindowResult.Cancel;
|
|
@@ -222,14 +248,29 @@ public partial class MessageWindow : Window, INotifyPropertyChanged
|
|
|
.Title(title)
|
|
|
.Message(message)
|
|
|
.Image(image)
|
|
|
- .AddOKButton("Yes")
|
|
|
- .AddCancelButton("No");
|
|
|
+ .AddYesButton()
|
|
|
+ .AddNoButton();
|
|
|
}
|
|
|
public static bool ShowYesNo(string message, string title, ImageSource? image = null)
|
|
|
{
|
|
|
return NewYesNo(message, title, image)
|
|
|
.Display()
|
|
|
- .Result == MessageWindowResult.OK;
|
|
|
+ .Result == MessageWindowResult.Yes;
|
|
|
+ }
|
|
|
+ public static MessageWindow NewYesNoCancel(string message, string title, ImageSource? image = null)
|
|
|
+ {
|
|
|
+ return new MessageWindow()
|
|
|
+ .Title(title)
|
|
|
+ .Message(message)
|
|
|
+ .Image(image)
|
|
|
+ .AddYesButton()
|
|
|
+ .AddNoButton()
|
|
|
+ .AddCancelButton();
|
|
|
+ }
|
|
|
+ public static MessageWindowResult ShowYesNoCancel(string message, string title, ImageSource? image = null)
|
|
|
+ {
|
|
|
+ return NewYesNoCancel(message, title, image)
|
|
|
+ .Display().Result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|