mirror of
https://github.com/leiurayer/downkyi.git
synced 2024-04-21 12:41:55 +00:00
优化弹出框的UI
This commit is contained in:
@@ -18,12 +18,13 @@ namespace DownKyi.Services
|
||||
/// 显示一个信息弹窗
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="buttonNumber"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -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 =>
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,16 +73,22 @@ namespace DownKyi.ViewModels.Dialogs
|
||||
Image = parameters.GetValue<VectorImage>("image");
|
||||
Title = parameters.GetValue<string>("title");
|
||||
Message = parameters.GetValue<string>("message");
|
||||
int number = parameters.GetValue<int>("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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,24 +90,28 @@
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1" Margin="15,10,15,20">
|
||||
<Grid Grid.Row="1" Margin="0,10,0,20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock
|
||||
<ScrollViewer
|
||||
Grid.Row="0"
|
||||
MaxWidth="500"
|
||||
MaxHeight="180"
|
||||
MaxHeight="190"
|
||||
Margin="0,10,0,30"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource BrushTextDark}"
|
||||
Text="{Binding Message}"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextWrapping="WrapWithOverflow" />
|
||||
Padding="15,0"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource BrushTextDark}"
|
||||
Text="{Binding Message}"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextWrapping="WrapWithOverflow" />
|
||||
</ScrollViewer>
|
||||
|
||||
<Button
|
||||
Grid.Row="1"
|
||||
|
||||
Reference in New Issue
Block a user