Skip to content

Commit

Permalink
改UI
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbbbaixue committed Dec 30, 2023
1 parent e47b270 commit dbb1109
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 37 deletions.
75 changes: 45 additions & 30 deletions Ra3.BattleNet.Downloader/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,41 +1,56 @@
<Window x:Class="Ra3.BattleNet.Downloader.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Ra3.BattleNet.Downloader"
mc:Ignorable="d"
Title="{Binding Caption}" Height="270" Width="480" SizeToContent="Height"
Loaded="Window_Loaded">
<Window
x:Class="Ra3.BattleNet.Downloader.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Ra3.BattleNet.Downloader"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{Binding Caption}"
Width="460"
Height="240"
Loaded="Window_Loaded"
ResizeMode="CanMinimize"
SizeToContent="Height"
Topmost="True"
mc:Ignorable="d">
<Window.DataContext>
<local:ViewModel />
</Window.DataContext>
<StackPanel Margin="16">
<StackPanel.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Margin" Value="0,0,0,8"/>
</Style>
</StackPanel.Resources>
<TextBlock TextWrapping="Wrap" Text="{Binding DownloadText}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition Width="0.25*" />
<ColumnDefinition Width="0.25*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding DownloadedSize}" HorizontalAlignment="Left" />
<TextBlock Grid.Column="1" Text="{Binding Progress}" HorizontalAlignment="Right" />
<TextBlock Grid.Column="2" Text="{Binding DownloadSpeed}" HorizontalAlignment="Right" />
<StackPanel Margin="24,12,24,24">
<TextBlock Text="{Binding DownloadText}" TextWrapping="Wrap" />
<Grid Margin="0,2,0,10">
<TextBlock
HorizontalAlignment="Left"
FontSize="16"
Text="{Binding Progress}" />
<StackPanel
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Orientation="Horizontal">
<TextBlock Text="{Binding DownloadedSize}" />
<TextBlock Margin="5,0,5,0" Text="-" />
<TextBlock Text="{Binding DownloadSpeed}" />
</StackPanel>
</Grid>
<TextBlock TextWrapping="Wrap" Text="{Binding Description}" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,16,0,0">
<ProgressBar x:Name="DownloadProgressBar" Height="16" />
<TextBlock Text="{Binding Description}" TextWrapping="Wrap" Margin="0,10,0,0"/>
<StackPanel
Margin="0,16,0,0"
HorizontalAlignment="Right"
Orientation="Horizontal">
<StackPanel.Resources>
<Style TargetType="{x:Type RadioButton}">
<Setter Property="Margin" Value="8,0,0,0"/>
<Setter Property="Margin" Value="8,0,0,0" />
</Style>
</StackPanel.Resources>
<RadioButton x:Name="ChineseCheckbox" Content="中文" Checked="ChineseCheckbox_Checked" />
<RadioButton x:Name="EnglishCheckbox" Content="English" Checked="EnglishCheckbox_Checked" />
<RadioButton
x:Name="ChineseCheckbox"
Checked="ChineseCheckbox_Checked"
Content="中文" />
<RadioButton
x:Name="EnglishCheckbox"
Checked="EnglishCheckbox_Checked"
Content="English" />
</StackPanel>
</StackPanel>
</Window>
14 changes: 7 additions & 7 deletions Ra3.BattleNet.Downloader/ViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ public class ViewModel : INotifyPropertyChanged
public event PropertyChangedEventHandler? PropertyChanged;
private readonly Dictionary<string, string> _values = new()
{
["en.Caption"] = "RA3BattleNet Downloader",
["zh.Caption"] = "红警3战网客户端下载程序",
["en.Caption"] = "RA3BattleNet Installer",
["zh.Caption"] = "红警3战网客户端 自动安装程序",
["en.ErrorCaption"] = "RA3BattleNet Download Error",
["zh.ErrorCaption"] = "红警3战网下载错误",
["en.DownloadText"] = "Downloading {0} to {1}",
["zh.DownloadText"] = "正在下载 {0} 到 {1}",
["en.DownloadedSize"] = "{0} / {1}",
["zh.DownloadedSize"] = "{0} / {1}",
["en.Progress"] = "{0:P2}",
["zh.Progress"] = "{0:P2}",
["en.DownloadSpeed"] = "{0}",
["zh.DownloadSpeed"] = "{0}",
["en.Description"] = "After the download is complete, the installer will be executed automatically. You can visit https://ra3battle.net or join QQ group 604807102 for more information about RA3BattleNet.",
["en.Progress"] = "{0:P2} Completed",
["zh.Progress"] = "已完成 {0:P2}",
["en.DownloadSpeed"] = "{0}/s",
["zh.DownloadSpeed"] = "{0}/s",
["en.Description"] = "After the download is completed, the installer will be executed automatically. You can visit https://ra3battle.net for more information.",
["zh.Description"] = "下载完毕之后安装程序将自动执行。您可以访问 https://ra3battle.net 或者加入 QQ 群 604807102 以了解关于红警3战网的更多信息。",
["en.CannotRunInstaller"] = "Cannot run the installer.",
["zh.CannotRunInstaller"] = "无法执行安装程序。"
Expand Down

0 comments on commit dbb1109

Please sign in to comment.