Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion UI/SemiUrsa/Client.Avalonia/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Common.Avalonia/Themes/Resources/_index.axaml" />
<ResourceInclude Source="avares://Common.Avalonia/Themes/Controls/_index.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Expand Down
39 changes: 10 additions & 29 deletions UI/SemiUrsa/Client.Avalonia/Views/MainView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
x:Class="Client.Avalonia.Views.MainView"
x:DataType="vm:MainViewViewModel">
<UserControl.Resources>
<ResourceDictionary>
<converters:EnumToBoolConverter x:Key="EnumToBooleanConverter" />
</ResourceDictionary>
<converters:EnumToBoolConverter x:Key="EnumToBooleanConverter" />
</UserControl.Resources>

<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="10" MinWidth="550">
Expand Down Expand Up @@ -92,52 +90,35 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="10">
<Button
Name="StopButton"
Padding="8"
Theme="{StaticResource BorderlessButton}"
Theme="{StaticResource IconBorderlessButton}"
Classes="Danger"
ToolTip.Tip="停止"
Command="{Binding StopCommand}">
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource SemiIconStop}" />
</Button>
Content="{StaticResource SemiIconStop}"
Command="{Binding StopCommand}" />
<ToggleSwitch
Name="StartButton"
Padding="8"
IsChecked="{Binding Status,
Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static services:DownloadStatus.Downloading},
Mode=OneWay}"
Theme="{StaticResource ButtonToggleSwitch}"
Theme="{StaticResource IconBorderlessToggleSwitch}"
OffContent="{StaticResource SemiIconPlay}"
OnContent="{StaticResource SemiIconPause}"
Command="{Binding StartCommand}">
<ToolTip.Tip>
<Panel>
<TextBlock Text="下载" IsVisible="{Binding !$parent[ToggleSwitch].IsChecked}" />
<TextBlock Text="暂停" IsVisible="{Binding $parent[ToggleSwitch].IsChecked}" />
</Panel>
</ToolTip.Tip>
<ToggleSwitch.OffContent>
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource SemiIconPlay}" />
</ToggleSwitch.OffContent>
<ToggleSwitch.OnContent>
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource SemiIconPause}" />
</ToggleSwitch.OnContent>
</ToggleSwitch>
<Button
Name="RestartButton"
Padding="8"
Theme="{StaticResource BorderlessButton}"
Theme="{StaticResource IconBorderlessButton}"
Classes="Tertiary"
ToolTip.Tip="重新下载"
Command="{Binding RestartCommand}">
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource SemiIconRestart}" />
</Button>
Content="{StaticResource SemiIconRefresh}"
Command="{Binding RestartCommand}" />
</StackPanel>
</Border>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public MockDownloadService()
{
CurrentStatistics = new DownloadStatistics
{
Version = "11.2.3",
Version = "11.2.6",
Speed = 0,
Remaining = TimeSpan.Zero,
TotalBytesToReceive = 1024 * 1024 * 10,
Expand Down
138 changes: 30 additions & 108 deletions UI/SemiUrsa/Common.Avalonia/Themes/Controls/ToggleSwitch.axaml
Original file line number Diff line number Diff line change
@@ -1,113 +1,35 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="ButtonToggleSwitch" TargetType="ToggleSwitch">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="{DynamicResource ButtonDefaultPadding}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BackgroundSizing" Value="OuterBorderEdge" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ButtonBorderThickness}" />
<Setter Property="CornerRadius" Value="{DynamicResource ButtonCornerRadius}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="OnContent" Value="{x:Null}" />
<Setter Property="OffContent" Value="{x:Null}" />
<Setter Property="Content" Value="{x:Null}" />
<Setter Property="MinHeight" Value="{DynamicResource ButtonDefaultHeight}" />
<Setter Property="FontSize" Value="{DynamicResource ButtonDefaultFontSize}" />
<Setter Property="FontWeight" Value="{DynamicResource ButtonDefaultFontWeight}" />
<Setter Property="Template">
<ControlTemplate TargetType="ToggleSwitch">
<Border
Name="Background"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Panel>
<Panel Name="PART_SwitchKnob" />
<Panel Name="PART_MovingKnobs" />
<ContentPresenter
Name="PART_OnContentPresenter"
IsVisible="{TemplateBinding IsChecked}"
Content="{TemplateBinding OnContent}"
ContentTemplate="{TemplateBinding OnContentTemplate}" />
<ContentPresenter
Name="PART_OffContentPresenter"
IsVisible="{TemplateBinding IsChecked, Converter={x:Static BoolConverters.Not}}"
Content="{TemplateBinding OffContent}"
ContentTemplate="{TemplateBinding OffContentTemplate}" />
<ContentPresenter
Name="PART_ContentPresenter"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}">
<ContentPresenter.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<TemplateBinding Property="Content" Converter="{x:Static ObjectConverters.IsNotNull}" />
<TemplateBinding Property="OnContent" Converter="{x:Static ObjectConverters.IsNull}" />
<TemplateBinding Property="OffContent" Converter="{x:Static ObjectConverters.IsNull}" />
</MultiBinding>
</ContentPresenter.IsVisible>
</ContentPresenter>
</Panel>
</Border>
</ControlTemplate>
<ControlTheme x:Key="IconBorderlessToggleSwitch"
BasedOn="{StaticResource ButtonToggleSwitch}"
TargetType="ToggleSwitch">
<Setter Property="Padding" Value="{StaticResource SemiThicknessTight}" />
<Setter Property="Width" Value="{StaticResource SemiSpacingExtraLoose}" />
<Setter Property="Height" Value="{StaticResource SemiSpacingExtraLoose}" />
<Setter Property="Foreground" Value="{DynamicResource SemiColorText1}" />
<Setter Property="OnContentTemplate">
<StaticResource ResourceKey="GeometryDataTemplate" />
</Setter>
<Setter Property="OffContentTemplate">
<StaticResource ResourceKey="GeometryDataTemplate" />
</Setter>
<Setter Property="ContentTemplate">
<StaticResource ResourceKey="GeometryDataTemplate" />
</Setter>
</ControlTheme>

<Style Selector="^:pressed">
<Setter Property="RenderTransform" Value="scale(0.98)" />
</Style>

<Style Selector="^ /template/ Border#Background">
<Setter Property="BorderBrush" Value="{TemplateBinding BorderBrush}" />
<Setter Property="Background" Value="{TemplateBinding Background}" />
</Style>

<Style Selector="^:pointerover /template/ Border#Background">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultPointeroverBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
</Style>

<Style Selector="^:pressed /template/ Border#Background">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultPressedBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
</Style>

<Style Selector="^:disabled /template/ Border#Background">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
</Style>

<Style Selector="^:disabled">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_OnContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_OffContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
</Style>

<Style Selector="^.Large">
<Setter Property="MinHeight" Value="{DynamicResource ButtonLargeHeight}" />
<Setter Property="Padding" Value="{DynamicResource ButtonLargePadding}" />
</Style>
<Style Selector="^.Small">
<Setter Property="MinHeight" Value="{DynamicResource ButtonSmallHeight}" />
<Setter Property="Padding" Value="{DynamicResource ButtonSmallPadding}" />
</Style>

<Style Selector="^ /template/ Border#Background">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderlessBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonBorderlessBackground}" />
</Style>
<Style Selector="^:disabled /template/ Border#Background">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderlessBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonBorderlessBackground}" />
<!-- <Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" /> -->
</Style>
<ControlTheme x:Key="IconBorderlessButton"
BasedOn="{StaticResource BorderlessButton}"
TargetType="Button">
<Setter Property="Padding" Value="{StaticResource SemiThicknessTight}" />
<Setter Property="Width" Value="{StaticResource SemiSpacingExtraLoose}" />
<Setter Property="Height" Value="{StaticResource SemiSpacingExtraLoose}" />
<Setter Property="Foreground" Value="{DynamicResource SemiColorText1}" />
<Setter Property="ContentTemplate">
<StaticResource ResourceKey="GeometryDataTemplate" />
</Setter>
</ControlTheme>

<DataTemplate x:Key="GeometryDataTemplate" DataType="Geometry">
<PathIcon Theme="{StaticResource InnerPathIcon}" Data="{Binding}" />
</DataTemplate>
</ResourceDictionary>
2 changes: 0 additions & 2 deletions UI/SemiUrsa/Common.Avalonia/Themes/Resources/Icon.axaml

This file was deleted.

5 changes: 0 additions & 5 deletions UI/SemiUrsa/Common.Avalonia/Themes/Resources/_index.axaml

This file was deleted.

8 changes: 4 additions & 4 deletions UI/SemiUrsa/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<AvaloniaVersion>11.2.3</AvaloniaVersion>
<AvaloniaVersion>11.2.6</AvaloniaVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)"/>

<PackageVersion Include="Avalonia.Svg" Version="11.2.0.2"/>
<PackageVersion Include="Semi.Avalonia" Version="11.2.1.3"/>
<PackageVersion Include="Irihi.Ursa" Version="1.7.0"/>
<PackageVersion Include="Irihi.Ursa.Themes.Semi" Version="1.7.0"/>
<PackageVersion Include="Semi.Avalonia" Version="11.2.1.6"/>
<PackageVersion Include="Irihi.Ursa" Version="1.10.0"/>
<PackageVersion Include="Irihi.Ursa.Themes.Semi" Version="1.10.0"/>

<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0"/>
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0"/>
Expand Down
1 change: 0 additions & 1 deletion UI/SemiUrsa/Upgrade.Avalonia/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Common.Avalonia/Themes/Resources/_index.axaml" />
<ResourceInclude Source="avares://Common.Avalonia/Themes/Controls/_index.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Expand Down
43 changes: 12 additions & 31 deletions UI/SemiUrsa/Upgrade.Avalonia/Views/MainView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
x:Class="Upgrade.Avalonia.Views.MainView"
x:DataType="vm:MainViewViewModel">
<UserControl.Resources>
<ResourceDictionary>
<converters:EnumToBoolConverter x:Key="EnumToBooleanConverter" />
</ResourceDictionary>
<converters:EnumToBoolConverter x:Key="EnumToBooleanConverter" />
</UserControl.Resources>

<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="10" MinWidth="550">
Expand Down Expand Up @@ -100,54 +98,37 @@
Background="{DynamicResource SemiBackground0Color}"
Theme="{StaticResource CardBorder}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="10">
<Button
<u:IconButton
Name="StopButton"
Padding="8"
Theme="{StaticResource BorderlessButton}"
Theme="{StaticResource BorderlessIconButton}"
Classes="Danger"
ToolTip.Tip="停止"
Command="{Binding StopCommand}">
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource SemiIconStop}" />
</Button>
Icon="{StaticResource SemiIconStop}"
Command="{Binding StopCommand}" />
<ToggleSwitch
Name="StartButton"
Padding="8"
IsChecked="{Binding Status,
Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static services:DownloadStatus.Downloading},
Mode=OneWay}"
Theme="{StaticResource ButtonToggleSwitch}"
Theme="{StaticResource IconBorderlessToggleSwitch}"
OffContent="{StaticResource SemiIconPlay}"
OnContent="{StaticResource SemiIconPause}"
Command="{Binding StartCommand}">
<ToolTip.Tip>
<Panel>
<TextBlock Text="下载" IsVisible="{Binding !$parent[ToggleSwitch].IsChecked}" />
<TextBlock Text="暂停" IsVisible="{Binding $parent[ToggleSwitch].IsChecked}" />
</Panel>
</ToolTip.Tip>
<ToggleSwitch.OffContent>
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource SemiIconPlay}" />
</ToggleSwitch.OffContent>
<ToggleSwitch.OnContent>
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource SemiIconPause}" />
</ToggleSwitch.OnContent>
</ToggleSwitch>
<Button
<u:IconButton
Name="RestartButton"
Padding="8"
Theme="{StaticResource BorderlessButton}"
Theme="{StaticResource BorderlessIconButton}"
Classes="Tertiary"
ToolTip.Tip="重新下载"
Command="{Binding RestartCommand}">
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource SemiIconRestart}" />
</Button>
Icon="{StaticResource SemiIconRefresh}"
Command="{Binding RestartCommand}" />
</StackPanel>
</Border>
</StackPanel>
Expand Down