|
3 | 3 | xmlns:vm="using:Client.Avalonia.ViewModels" |
4 | 4 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
5 | 5 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 6 | + xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls" |
6 | 7 | mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" |
7 | 8 | x:Class="Client.Avalonia.Views.MainWindow" |
8 | 9 | x:DataType="vm:MainWindowViewModel" |
|
12 | 13 | Title="{Binding Statistics.Version,StringFormat='General Update {0} 版本更新'}"> |
13 | 14 | <Window.Resources> |
14 | 15 | <ResourceDictionary> |
15 | | - <ResourceDictionary.MergedDictionaries> |
16 | | - <ResourceInclude Source="../Themes/ToggleSwitch.axaml" /> |
17 | | - </ResourceDictionary.MergedDictionaries> |
18 | | - <StreamGeometry x:Key="IconPlay">M 5 2.90101 C 5 2.09583 5.90303 1.62081 6.56653 2.07697 L 19.8014 11.1759 C 20.3794 11.5733 20.3794 12.4267 19.8014 12.824 L 6.56653 21.923 C 5.90303 22.3792 5 21.9041 5 21.0989 V 2.90101 Z</StreamGeometry> |
19 | | - <StreamGeometry x:Key="IconPause">M4.5 4.75C4.5 3.23122 5.73122 2 7.25 2C8.76878 2 10 3.23122 10 4.75V19.25C10 20.7688 8.76878 22 7.25 22C5.73122 22 4.5 20.7688 4.5 19.25V4.75ZM14 4.75C14 3.23122 15.2312 2 16.75 2C18.2688 2 19.5 3.23122 19.5 4.75V19.25C19.5 20.7688 18.2688 22 16.75 22C15.2312 22 14 20.7688 14 19.25V4.75Z</StreamGeometry> |
20 | | - <StreamGeometry x:Key="IconStop">M3 6C3 4.34315 4.34315 3 6 3H18C19.6569 3 21 4.34315 21 6V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18V6Z</StreamGeometry> |
21 | | - <StreamGeometry x:Key="IconRestart">M4.5 2C3.67157 2 3 2.67157 3 3.5V20.5C3 21.3284 3.67157 22 4.5 22C5.32843 22 6 21.3284 6 20.5V3.5C6 2.67157 5.32843 2 4.5 2ZM8.00083 11.2137L19.3822 2.27115C20.0384 1.75562 21.0001 2.22303 21.0001 3.05746V20.9425C21.0001 21.777 20.0384 22.2444 19.3822 21.7289L8.00083 12.7863C7.49126 12.3859 7.49126 11.6141 8.00083 11.2137Z</StreamGeometry> |
| 16 | + <converters:EnumToBoolConverter x:Key="EnumToBooleanConverter" /> |
22 | 17 | </ResourceDictionary> |
23 | 18 | </Window.Resources> |
24 | 19 |
|
|
68 | 63 | <ProgressBar |
69 | 64 | Name="Bar" |
70 | 65 | ShowProgressText="True" |
71 | | - Classes.Success="{Binding IsCompleted}" |
| 66 | + Classes.Success="{Binding Status, |
| 67 | + Converter={StaticResource EnumToBooleanConverter}, |
| 68 | + ConverterParameter={x:Static vm:DownloadStatus.Completed}}" |
72 | 69 | Value="{Binding Statistics.ProgressPercentage}"> |
73 | 70 | <ProgressBar.Styles> |
74 | 71 | <Style Selector="ProgressBar"> |
|
100 | 97 | <ToggleSwitch |
101 | 98 | Name="StartButton" |
102 | 99 | Padding="8" |
103 | | - IsChecked="{Binding IsDownloading}" |
| 100 | + IsChecked="{Binding Status, |
| 101 | + Converter={StaticResource EnumToBooleanConverter}, |
| 102 | + ConverterParameter={x:Static vm:DownloadStatus.Downloading}}" |
104 | 103 | Theme="{StaticResource ButtonToggleSwitch}" |
105 | 104 | Command="{Binding StartCommand}"> |
106 | 105 | <ToolTip.Tip> |
|
0 commit comments