Skip to content

Commit 05d0365

Browse files
committed
feat: upgrade to latest version.
1 parent 3bad897 commit 05d0365

File tree

8 files changed

+56
-181
lines changed

8 files changed

+56
-181
lines changed

UI/SemiUrsa/Client.Avalonia/App.axaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<Application.Resources>
1515
<ResourceDictionary>
1616
<ResourceDictionary.MergedDictionaries>
17-
<ResourceInclude Source="avares://Common.Avalonia/Themes/Resources/_index.axaml" />
1817
<ResourceInclude Source="avares://Common.Avalonia/Themes/Controls/_index.axaml" />
1918
</ResourceDictionary.MergedDictionaries>
2019
</ResourceDictionary>

UI/SemiUrsa/Client.Avalonia/Views/MainView.axaml

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
x:Class="Client.Avalonia.Views.MainView"
1111
x:DataType="vm:MainViewViewModel">
1212
<UserControl.Resources>
13-
<ResourceDictionary>
14-
<converters:EnumToBoolConverter x:Key="EnumToBooleanConverter" />
15-
</ResourceDictionary>
13+
<converters:EnumToBoolConverter x:Key="EnumToBooleanConverter" />
1614
</UserControl.Resources>
1715

1816
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="10" MinWidth="550">
@@ -92,52 +90,35 @@
9290
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="10">
9391
<Button
9492
Name="StopButton"
95-
Padding="8"
96-
Theme="{StaticResource BorderlessButton}"
93+
Theme="{StaticResource IconBorderlessButton}"
9794
Classes="Danger"
9895
ToolTip.Tip="停止"
99-
Command="{Binding StopCommand}">
100-
<PathIcon
101-
Theme="{StaticResource InnerPathIcon}"
102-
Data="{StaticResource SemiIconStop}" />
103-
</Button>
96+
Content="{StaticResource SemiIconStop}"
97+
Command="{Binding StopCommand}" />
10498
<ToggleSwitch
10599
Name="StartButton"
106-
Padding="8"
107100
IsChecked="{Binding Status,
108101
Converter={StaticResource EnumToBooleanConverter},
109102
ConverterParameter={x:Static services:DownloadStatus.Downloading},
110103
Mode=OneWay}"
111-
Theme="{StaticResource ButtonToggleSwitch}"
104+
Theme="{StaticResource IconBorderlessToggleSwitch}"
105+
OffContent="{StaticResource SemiIconPlay}"
106+
OnContent="{StaticResource SemiIconPause}"
112107
Command="{Binding StartCommand}">
113108
<ToolTip.Tip>
114109
<Panel>
115110
<TextBlock Text="下载" IsVisible="{Binding !$parent[ToggleSwitch].IsChecked}" />
116111
<TextBlock Text="暂停" IsVisible="{Binding $parent[ToggleSwitch].IsChecked}" />
117112
</Panel>
118113
</ToolTip.Tip>
119-
<ToggleSwitch.OffContent>
120-
<PathIcon
121-
Theme="{StaticResource InnerPathIcon}"
122-
Data="{StaticResource SemiIconPlay}" />
123-
</ToggleSwitch.OffContent>
124-
<ToggleSwitch.OnContent>
125-
<PathIcon
126-
Theme="{StaticResource InnerPathIcon}"
127-
Data="{StaticResource SemiIconPause}" />
128-
</ToggleSwitch.OnContent>
129114
</ToggleSwitch>
130115
<Button
131116
Name="RestartButton"
132-
Padding="8"
133-
Theme="{StaticResource BorderlessButton}"
117+
Theme="{StaticResource IconBorderlessButton}"
134118
Classes="Tertiary"
135119
ToolTip.Tip="重新下载"
136-
Command="{Binding RestartCommand}">
137-
<PathIcon
138-
Theme="{StaticResource InnerPathIcon}"
139-
Data="{StaticResource SemiIconRestart}" />
140-
</Button>
120+
Content="{StaticResource SemiIconRefresh}"
121+
Command="{Binding RestartCommand}" />
141122
</StackPanel>
142123
</Border>
143124
</StackPanel>
Lines changed: 30 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,35 @@
11
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
2-
<ControlTheme x:Key="ButtonToggleSwitch" TargetType="ToggleSwitch">
3-
<Setter Property="HorizontalAlignment" Value="Center" />
4-
<Setter Property="VerticalAlignment" Value="Center" />
5-
<Setter Property="HorizontalContentAlignment" Value="Center" />
6-
<Setter Property="VerticalContentAlignment" Value="Center" />
7-
<Setter Property="Padding" Value="{DynamicResource ButtonDefaultPadding}" />
8-
<Setter Property="Background" Value="Transparent" />
9-
<Setter Property="BackgroundSizing" Value="OuterBorderEdge" />
10-
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultBorderBrush}" />
11-
<Setter Property="BorderThickness" Value="{DynamicResource ButtonBorderThickness}" />
12-
<Setter Property="CornerRadius" Value="{DynamicResource ButtonCornerRadius}" />
13-
<Setter Property="Cursor" Value="Hand" />
14-
<Setter Property="OnContent" Value="{x:Null}" />
15-
<Setter Property="OffContent" Value="{x:Null}" />
16-
<Setter Property="Content" Value="{x:Null}" />
17-
<Setter Property="MinHeight" Value="{DynamicResource ButtonDefaultHeight}" />
18-
<Setter Property="FontSize" Value="{DynamicResource ButtonDefaultFontSize}" />
19-
<Setter Property="FontWeight" Value="{DynamicResource ButtonDefaultFontWeight}" />
20-
<Setter Property="Template">
21-
<ControlTemplate TargetType="ToggleSwitch">
22-
<Border
23-
Name="Background"
24-
Padding="{TemplateBinding Padding}"
25-
Background="{TemplateBinding Background}"
26-
BorderBrush="{TemplateBinding BorderBrush}"
27-
BorderThickness="{TemplateBinding BorderThickness}"
28-
CornerRadius="{TemplateBinding CornerRadius}">
29-
<Panel>
30-
<Panel Name="PART_SwitchKnob" />
31-
<Panel Name="PART_MovingKnobs" />
32-
<ContentPresenter
33-
Name="PART_OnContentPresenter"
34-
IsVisible="{TemplateBinding IsChecked}"
35-
Content="{TemplateBinding OnContent}"
36-
ContentTemplate="{TemplateBinding OnContentTemplate}" />
37-
<ContentPresenter
38-
Name="PART_OffContentPresenter"
39-
IsVisible="{TemplateBinding IsChecked, Converter={x:Static BoolConverters.Not}}"
40-
Content="{TemplateBinding OffContent}"
41-
ContentTemplate="{TemplateBinding OffContentTemplate}" />
42-
<ContentPresenter
43-
Name="PART_ContentPresenter"
44-
Content="{TemplateBinding Content}"
45-
ContentTemplate="{TemplateBinding ContentTemplate}">
46-
<ContentPresenter.IsVisible>
47-
<MultiBinding Converter="{x:Static BoolConverters.And}">
48-
<TemplateBinding Property="Content" Converter="{x:Static ObjectConverters.IsNotNull}" />
49-
<TemplateBinding Property="OnContent" Converter="{x:Static ObjectConverters.IsNull}" />
50-
<TemplateBinding Property="OffContent" Converter="{x:Static ObjectConverters.IsNull}" />
51-
</MultiBinding>
52-
</ContentPresenter.IsVisible>
53-
</ContentPresenter>
54-
</Panel>
55-
</Border>
56-
</ControlTemplate>
2+
<ControlTheme x:Key="IconBorderlessToggleSwitch"
3+
BasedOn="{StaticResource ButtonToggleSwitch}"
4+
TargetType="ToggleSwitch">
5+
<Setter Property="Padding" Value="{StaticResource SemiThicknessTight}" />
6+
<Setter Property="Width" Value="{StaticResource SemiSpacingExtraLoose}" />
7+
<Setter Property="Height" Value="{StaticResource SemiSpacingExtraLoose}" />
8+
<Setter Property="Foreground" Value="{DynamicResource SemiColorText1}" />
9+
<Setter Property="OnContentTemplate">
10+
<StaticResource ResourceKey="GeometryDataTemplate" />
5711
</Setter>
12+
<Setter Property="OffContentTemplate">
13+
<StaticResource ResourceKey="GeometryDataTemplate" />
14+
</Setter>
15+
<Setter Property="ContentTemplate">
16+
<StaticResource ResourceKey="GeometryDataTemplate" />
17+
</Setter>
18+
</ControlTheme>
5819

59-
<Style Selector="^:pressed">
60-
<Setter Property="RenderTransform" Value="scale(0.98)" />
61-
</Style>
62-
63-
<Style Selector="^ /template/ Border#Background">
64-
<Setter Property="BorderBrush" Value="{TemplateBinding BorderBrush}" />
65-
<Setter Property="Background" Value="{TemplateBinding Background}" />
66-
</Style>
67-
68-
<Style Selector="^:pointerover /template/ Border#Background">
69-
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultPointeroverBorderBrush}" />
70-
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
71-
</Style>
72-
73-
<Style Selector="^:pressed /template/ Border#Background">
74-
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultPressedBorderBrush}" />
75-
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
76-
</Style>
77-
78-
<Style Selector="^:disabled /template/ Border#Background">
79-
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
80-
</Style>
81-
82-
<Style Selector="^:disabled">
83-
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
84-
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
85-
</Style>
86-
<Style Selector="^ /template/ ContentPresenter#PART_OnContentPresenter">
87-
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
88-
</Style>
89-
<Style Selector="^ /template/ ContentPresenter#PART_OffContentPresenter">
90-
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
91-
</Style>
92-
</Style>
93-
94-
<Style Selector="^.Large">
95-
<Setter Property="MinHeight" Value="{DynamicResource ButtonLargeHeight}" />
96-
<Setter Property="Padding" Value="{DynamicResource ButtonLargePadding}" />
97-
</Style>
98-
<Style Selector="^.Small">
99-
<Setter Property="MinHeight" Value="{DynamicResource ButtonSmallHeight}" />
100-
<Setter Property="Padding" Value="{DynamicResource ButtonSmallPadding}" />
101-
</Style>
102-
103-
<Style Selector="^ /template/ Border#Background">
104-
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderlessBorderBrush}" />
105-
<Setter Property="Background" Value="{DynamicResource ButtonBorderlessBackground}" />
106-
</Style>
107-
<Style Selector="^:disabled /template/ Border#Background">
108-
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderlessBorderBrush}" />
109-
<Setter Property="Background" Value="{DynamicResource ButtonBorderlessBackground}" />
110-
<!-- <Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" /> -->
111-
</Style>
20+
<ControlTheme x:Key="IconBorderlessButton"
21+
BasedOn="{StaticResource BorderlessButton}"
22+
TargetType="Button">
23+
<Setter Property="Padding" Value="{StaticResource SemiThicknessTight}" />
24+
<Setter Property="Width" Value="{StaticResource SemiSpacingExtraLoose}" />
25+
<Setter Property="Height" Value="{StaticResource SemiSpacingExtraLoose}" />
26+
<Setter Property="Foreground" Value="{DynamicResource SemiColorText1}" />
27+
<Setter Property="ContentTemplate">
28+
<StaticResource ResourceKey="GeometryDataTemplate" />
29+
</Setter>
11230
</ControlTheme>
31+
32+
<DataTemplate x:Key="GeometryDataTemplate" DataType="Geometry">
33+
<PathIcon Theme="{StaticResource InnerPathIcon}" Data="{Binding}" />
34+
</DataTemplate>
11335
</ResourceDictionary>

UI/SemiUrsa/Common.Avalonia/Themes/Resources/Icon.axaml

Lines changed: 0 additions & 2 deletions
This file was deleted.

UI/SemiUrsa/Common.Avalonia/Themes/Resources/_index.axaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

UI/SemiUrsa/Directory.Packages.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<Project>
22
<PropertyGroup>
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4-
<AvaloniaVersion>11.2.3</AvaloniaVersion>
4+
<AvaloniaVersion>11.2.4</AvaloniaVersion>
55
</PropertyGroup>
66
<ItemGroup>
77
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)"/>
88
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
99
<PackageVersion Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)"/>
1010

1111
<PackageVersion Include="Avalonia.Svg" Version="11.2.0.2"/>
12-
<PackageVersion Include="Semi.Avalonia" Version="11.2.1.3"/>
13-
<PackageVersion Include="Irihi.Ursa" Version="1.7.0"/>
14-
<PackageVersion Include="Irihi.Ursa.Themes.Semi" Version="1.7.0"/>
12+
<PackageVersion Include="Semi.Avalonia" Version="11.2.1.5"/>
13+
<PackageVersion Include="Irihi.Ursa" Version="1.9.0"/>
14+
<PackageVersion Include="Irihi.Ursa.Themes.Semi" Version="1.9.0"/>
1515

1616
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0"/>
1717
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0"/>

UI/SemiUrsa/Upgrade.Avalonia/App.axaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
<Application.Resources>
1717
<ResourceDictionary>
1818
<ResourceDictionary.MergedDictionaries>
19-
<ResourceInclude Source="avares://Common.Avalonia/Themes/Resources/_index.axaml" />
2019
<ResourceInclude Source="avares://Common.Avalonia/Themes/Controls/_index.axaml" />
2120
</ResourceDictionary.MergedDictionaries>
2221
</ResourceDictionary>

UI/SemiUrsa/Upgrade.Avalonia/Views/MainView.axaml

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
x:Class="Upgrade.Avalonia.Views.MainView"
1212
x:DataType="vm:MainViewViewModel">
1313
<UserControl.Resources>
14-
<ResourceDictionary>
15-
<converters:EnumToBoolConverter x:Key="EnumToBooleanConverter" />
16-
</ResourceDictionary>
14+
<converters:EnumToBoolConverter x:Key="EnumToBooleanConverter" />
1715
</UserControl.Resources>
1816

1917
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="10" MinWidth="550">
@@ -100,54 +98,37 @@
10098
Background="{DynamicResource SemiBackground0Color}"
10199
Theme="{StaticResource CardBorder}">
102100
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="10">
103-
<Button
101+
<u:IconButton
104102
Name="StopButton"
105-
Padding="8"
106-
Theme="{StaticResource BorderlessButton}"
103+
Theme="{StaticResource BorderlessIconButton}"
107104
Classes="Danger"
108105
ToolTip.Tip="停止"
109-
Command="{Binding StopCommand}">
110-
<PathIcon
111-
Theme="{StaticResource InnerPathIcon}"
112-
Data="{StaticResource SemiIconStop}" />
113-
</Button>
106+
Icon="{StaticResource SemiIconStop}"
107+
Command="{Binding StopCommand}" />
114108
<ToggleSwitch
115109
Name="StartButton"
116-
Padding="8"
117110
IsChecked="{Binding Status,
118111
Converter={StaticResource EnumToBooleanConverter},
119112
ConverterParameter={x:Static services:DownloadStatus.Downloading},
120113
Mode=OneWay}"
121-
Theme="{StaticResource ButtonToggleSwitch}"
114+
Theme="{StaticResource IconBorderlessToggleSwitch}"
115+
OffContent="{StaticResource SemiIconPlay}"
116+
OnContent="{StaticResource SemiIconPause}"
122117
Command="{Binding StartCommand}">
123118
<ToolTip.Tip>
124119
<Panel>
125120
<TextBlock Text="下载" IsVisible="{Binding !$parent[ToggleSwitch].IsChecked}" />
126121
<TextBlock Text="暂停" IsVisible="{Binding $parent[ToggleSwitch].IsChecked}" />
127122
</Panel>
128123
</ToolTip.Tip>
129-
<ToggleSwitch.OffContent>
130-
<PathIcon
131-
Theme="{StaticResource InnerPathIcon}"
132-
Data="{StaticResource SemiIconPlay}" />
133-
</ToggleSwitch.OffContent>
134-
<ToggleSwitch.OnContent>
135-
<PathIcon
136-
Theme="{StaticResource InnerPathIcon}"
137-
Data="{StaticResource SemiIconPause}" />
138-
</ToggleSwitch.OnContent>
139124
</ToggleSwitch>
140-
<Button
125+
<u:IconButton
141126
Name="RestartButton"
142-
Padding="8"
143-
Theme="{StaticResource BorderlessButton}"
127+
Theme="{StaticResource BorderlessIconButton}"
144128
Classes="Tertiary"
145129
ToolTip.Tip="重新下载"
146-
Command="{Binding RestartCommand}">
147-
<PathIcon
148-
Theme="{StaticResource InnerPathIcon}"
149-
Data="{StaticResource SemiIconRestart}" />
150-
</Button>
130+
Icon="{StaticResource SemiIconRefresh}"
131+
Command="{Binding RestartCommand}" />
151132
</StackPanel>
152133
</Border>
153134
</StackPanel>

0 commit comments

Comments
 (0)