public static Task ShowOkDialogAsync(string title, string message = null) { DetailTextDialog dialog = new DetailTextDialog() { Title = title, Message = message, PrimaryButtonText = "确定", IsPrimaryButtonEnabled = true }; return(dialog.ShowAsync()); }
public static Task ShowErrorDialogAsync(string title, string message, string detail) { DetailTextDialog dialog = new DetailTextDialog() { Detail = detail, PrimaryButtonText = "确定", IsPrimaryButtonEnabled = true, Icon = "\uEA39", Title = title, Message = message, IconBrush = System.Windows.Media.Brushes.Red }; return(dialog.ShowAsync()); }
public static async Task <bool> ShowYesNoDialogAsync(string title, string message = null, string detail = null) { DetailTextDialog dialog = new DetailTextDialog() { Title = title, Message = message, PrimaryButtonText = "是", IsPrimaryButtonEnabled = true, SecondaryButtonText = "否", IsSecondaryButtonEnabled = true, Detail = detail }; var result = await dialog.ShowAsync(); return(result == ContentDialogResult.Primary); }
public static Task ShowErrorDialogAsync(Exception ex, string message = null) { DetailTextDialog dialog = new DetailTextDialog() { Detail = ex == null ? null : ex.ToString(), PrimaryButtonText = "确定", IsPrimaryButtonEnabled = true, Icon = "\uEA39", IconBrush = System.Windows.Media.Brushes.Red }; if (ex == null) { dialog.Title = "错误"; dialog.Message = message; } else { dialog.Title = message ?? "错误"; dialog.Message = ex.Message; } return(dialog.ShowAsync()); }