152 lines
13 KiB
C#
152 lines
13 KiB
C#
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
|
|
namespace WPFluent.Controls;
|
|
|
|
public static partial class MessageBox
|
|
{
|
|
public static System.Windows.MessageBoxResult Information(string messageBoxText) =>
|
|
Show(messageBoxText, "提示", System.Windows.MessageBoxButton.OK, MessageBoxImage.Information, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Information(string messageBoxText, string caption) =>
|
|
Show(messageBoxText, caption, System.Windows.MessageBoxButton.OK, MessageBoxImage.Information, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Information(string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
Show(messageBoxText, caption, button, MessageBoxImage.Information, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Information(string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
Show(messageBoxText, caption, button, MessageBoxImage.Information.ToSymbol(), defaultResult);
|
|
|
|
public static System.Windows.MessageBoxResult Information(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
Show(owner, messageBoxText, caption, button, MessageBoxImage.Information, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Information(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
Show(owner, messageBoxText, caption, button, MessageBoxImage.Information.ToSymbol(), defaultResult);
|
|
|
|
public static System.Windows.MessageBoxResult Warning(string messageBoxText) =>
|
|
Show(messageBoxText, "警告", System.Windows.MessageBoxButton.OK, MessageBoxImage.Warning, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Warning(string messageBoxText, string caption) =>
|
|
Show(messageBoxText, caption, System.Windows.MessageBoxButton.OK, MessageBoxImage.Warning, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Warning(string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
Show(messageBoxText, caption, button, MessageBoxImage.Warning, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Warning(string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
Show(messageBoxText, caption, button, MessageBoxImage.Warning.ToSymbol(), defaultResult);
|
|
|
|
public static System.Windows.MessageBoxResult Warning(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
Show(owner, messageBoxText, caption, button, MessageBoxImage.Warning, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Warning(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
Show(owner, messageBoxText, caption, button, MessageBoxImage.Warning.ToSymbol(), defaultResult);
|
|
|
|
public static System.Windows.MessageBoxResult Question(string messageBoxText) =>
|
|
Show(messageBoxText, "询问", System.Windows.MessageBoxButton.YesNo, MessageBoxImage.Question, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Question(string messageBoxText, string caption) =>
|
|
Show(messageBoxText, caption, System.Windows.MessageBoxButton.YesNo, MessageBoxImage.Question, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Question(string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
Show(messageBoxText, caption, button, MessageBoxImage.Question, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Question(string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
Show(messageBoxText, caption, button, MessageBoxImage.Question.ToSymbol(), defaultResult);
|
|
|
|
public static System.Windows.MessageBoxResult Question(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
Show(owner, messageBoxText, caption, button, MessageBoxImage.Question, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Question(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
Show(owner, messageBoxText, caption, button, MessageBoxImage.Question.ToSymbol(), defaultResult);
|
|
|
|
public static System.Windows.MessageBoxResult Error(string messageBoxText) =>
|
|
Show(messageBoxText, "错误", System.Windows.MessageBoxButton.OK, MessageBoxImage.Error, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Error(string messageBoxText, string caption) =>
|
|
Show(messageBoxText, caption, System.Windows.MessageBoxButton.OK, MessageBoxImage.Error, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Error(string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
Show(messageBoxText, caption, button, MessageBoxImage.Error, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Error(string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
Show(messageBoxText, caption, button, MessageBoxImage.Error.ToSymbol(), defaultResult);
|
|
|
|
public static System.Windows.MessageBoxResult Error(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
Show(owner, messageBoxText, caption, button, MessageBoxImage.Error, System.Windows.MessageBoxResult.None);
|
|
|
|
public static System.Windows.MessageBoxResult Error(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
Show(owner, messageBoxText, caption, button, MessageBoxImage.Error.ToSymbol(), defaultResult);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> InformationAsync(string messageBoxText) =>
|
|
ShowAsync(messageBoxText, "信息", System.Windows.MessageBoxButton.OK, MessageBoxImage.Information, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> InformationAsync(string messageBoxText, string caption) =>
|
|
ShowAsync(messageBoxText, caption, System.Windows.MessageBoxButton.OK, MessageBoxImage.Information, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> InformationAsync(string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
ShowAsync(messageBoxText, caption, button, MessageBoxImage.Information, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> InformationAsync(string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
ShowAsync(null!, messageBoxText, caption, button, MessageBoxImage.Information, defaultResult);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> InformationAsync(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
ShowAsync(owner, messageBoxText, caption, button, MessageBoxImage.Information, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> InformationAsync(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
ShowAsync(owner, messageBoxText, caption, button, MessageBoxImage.Information.ToSymbol(), defaultResult);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> WarningAsync(string messageBoxText) =>
|
|
ShowAsync(messageBoxText, "警告", System.Windows.MessageBoxButton.OK, MessageBoxImage.Warning, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> WarningAsync(string messageBoxText, string caption) =>
|
|
ShowAsync(messageBoxText, caption, System.Windows.MessageBoxButton.OK, MessageBoxImage.Warning, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> WarningAsync(string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
ShowAsync(messageBoxText, caption, button, MessageBoxImage.Warning, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> WarningAsync(string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
ShowAsync(null!, messageBoxText, caption, button, MessageBoxImage.Warning, defaultResult);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> WarningAsync(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
ShowAsync(owner, messageBoxText, caption, button, MessageBoxImage.Warning, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> WarningAsync(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
ShowAsync(owner, messageBoxText, caption, button, MessageBoxImage.Warning.ToSymbol(), defaultResult);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> QuestionAsync(string messageBoxText) =>
|
|
ShowAsync(messageBoxText, "询问", System.Windows.MessageBoxButton.YesNo, MessageBoxImage.Information, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> QuestionAsync(string messageBoxText, string caption) =>
|
|
ShowAsync(messageBoxText, caption, System.Windows.MessageBoxButton.YesNo, MessageBoxImage.Question, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> QuestionAsync(string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
ShowAsync(messageBoxText, caption, button, MessageBoxImage.Question, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> QuestionAsync(string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
ShowAsync(null!, messageBoxText, caption, button, MessageBoxImage.Question, defaultResult);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> QuestionAsync(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
ShowAsync(owner, messageBoxText, caption, button, MessageBoxImage.Question, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> QuestionAsync(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
ShowAsync(owner, messageBoxText, caption, button, MessageBoxImage.Question.ToSymbol(), defaultResult);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> ErrorAsync(string messageBoxText) =>
|
|
ShowAsync(messageBoxText, "错误", System.Windows.MessageBoxButton.OK, MessageBoxImage.Error, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> ErrorAsync(string messageBoxText, string caption) =>
|
|
ShowAsync(messageBoxText, caption, System.Windows.MessageBoxButton.OK, MessageBoxImage.Error, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> ErrorAsync(string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
ShowAsync(messageBoxText, caption, button, MessageBoxImage.Error, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> ErrorAsync(string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
ShowAsync(null!, messageBoxText, caption, button, MessageBoxImage.Error, defaultResult);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> ErrorAsync(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button) =>
|
|
ShowAsync(owner, messageBoxText, caption, button, MessageBoxImage.Error, System.Windows.MessageBoxResult.None);
|
|
|
|
public static Task<System.Windows.MessageBoxResult> ErrorAsync(Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxResult defaultResult) =>
|
|
ShowAsync(owner, messageBoxText, caption, button, MessageBoxImage.Error.ToSymbol(), defaultResult);
|
|
}
|