diff --git a/DownKyi/Services/AlertService.cs b/DownKyi/Services/AlertService.cs index 5302459..4b46ecf 100644 --- a/DownKyi/Services/AlertService.cs +++ b/DownKyi/Services/AlertService.cs @@ -18,12 +18,13 @@ namespace DownKyi.Services /// 显示一个信息弹窗 /// /// + /// /// - public ButtonResult ShowInfo(string message) + public ButtonResult ShowInfo(string message, int buttonNumber = 2) { VectorImage image = SystemIcon.Instance().Info; string title = DictionaryResource.GetString("Info"); - return ShowMessage(image, title, message); + return ShowMessage(image, title, message, buttonNumber); } /// @@ -35,7 +36,7 @@ namespace DownKyi.Services { VectorImage image = SystemIcon.Instance().Warning; string title = DictionaryResource.GetString("Warning"); - return ShowMessage(image, title, message); + return ShowMessage(image, title, message, 1); } /// @@ -47,10 +48,10 @@ namespace DownKyi.Services { VectorImage image = SystemIcon.Instance().Error; string title = DictionaryResource.GetString("Error"); - return ShowMessage(image, title, message); + return ShowMessage(image, title, message, 1); } - public ButtonResult ShowMessage(VectorImage image, string type, string message) + public ButtonResult ShowMessage(VectorImage image, string type, string message, int buttonNumber) { ButtonResult result = ButtonResult.None; if (dialogService == null) @@ -62,7 +63,8 @@ namespace DownKyi.Services { { "image", image }, { "title", type }, - { "message", message } + { "message", message }, + { "button_number", buttonNumber } }; dialogService.ShowDialog(ViewAlertDialogViewModel.Tag, param, buttonResult => { diff --git a/DownKyi/Services/Download/AriaDownloadService.cs b/DownKyi/Services/Download/AriaDownloadService.cs index 3847787..460ae98 100644 --- a/DownKyi/Services/Download/AriaDownloadService.cs +++ b/DownKyi/Services/Download/AriaDownloadService.cs @@ -347,7 +347,8 @@ namespace DownKyi.Services.Download AlertService alertService = new AlertService(dialogService); ButtonResult result = alertService.ShowMessage(SystemIcon.Instance().Error, $"Aria2 {DictionaryResource.GetString("Error")}", - errorMessage); + errorMessage, + 1); return; } diff --git a/DownKyi/ViewModels/Dialogs/ViewAlertDialogViewModel.cs b/DownKyi/ViewModels/Dialogs/ViewAlertDialogViewModel.cs index 4bd897f..02ba1ee 100644 --- a/DownKyi/ViewModels/Dialogs/ViewAlertDialogViewModel.cs +++ b/DownKyi/ViewModels/Dialogs/ViewAlertDialogViewModel.cs @@ -73,16 +73,22 @@ namespace DownKyi.ViewModels.Dialogs Image = parameters.GetValue("image"); Title = parameters.GetValue("title"); Message = parameters.GetValue("message"); + int number = parameters.GetValue("button_number"); - if (Image == SystemIcon.Instance().Error) + switch (number) { - AloneButton = Visibility.Visible; - TwoButton = Visibility.Collapsed; - } - else - { - AloneButton = Visibility.Collapsed; - TwoButton = Visibility.Visible; + case 1: + AloneButton = Visibility.Visible; + TwoButton = Visibility.Collapsed; + break; + case 2: + AloneButton = Visibility.Collapsed; + TwoButton = Visibility.Visible; + break; + default: + AloneButton = Visibility.Collapsed; + TwoButton = Visibility.Visible; + break; } } diff --git a/DownKyi/Views/Dialogs/ViewAlertDialog.xaml b/DownKyi/Views/Dialogs/ViewAlertDialog.xaml index becee3e..17eb4b3 100644 --- a/DownKyi/Views/Dialogs/ViewAlertDialog.xaml +++ b/DownKyi/Views/Dialogs/ViewAlertDialog.xaml @@ -90,24 +90,28 @@ - + - + Padding="15,0" + VerticalScrollBarVisibility="Auto"> + +