Skip to content

Commit

Permalink
🚧 Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
rmbadmin committed Nov 19, 2023
1 parent eaeb90d commit 0eff585
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 53 deletions.
30 changes: 0 additions & 30 deletions src/BD.WTTS.Client.Avalonia/Converters/StringOmitConverter.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace BD.WTTS.Converters;

public sealed class VisbleStringConverter : IMultiValueConverter
public sealed class VisibleStringConverter : IMultiValueConverter
{
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BD.WTTS.Client.Avalonia/UI/App.TrayIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void UpdateMenuItems()
new Binding { Path = "Res.CloseSteam", Source = ResourceService.Current, Mode = BindingMode.OneWay },
new Binding { Path = "Res.StartSteam", Source = ResourceService.Current, Mode = BindingMode.OneWay },
},
Converter = (VisbleStringConverter)App.Instance.FindResource("VisbleStringConverter")!,
Converter = (VisibleStringConverter)App.Instance.FindResource(nameof(VisibleStringConverter))!,
},
Command = ReactiveCommand.Create(async () =>
{
Expand Down
3 changes: 1 addition & 2 deletions src/BD.WTTS.Client.Avalonia/UI/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
<spp:EnumEqualValueConverter x:Key="EnumEqualValueConverter" />
<spp:StringEqualsConverter x:Key="StringEqualsConverter" />
<spp:EnumLocalizationNameConverter x:Key="EnumLocalizationNameConverter" />
<spp:VisbleStringConverter x:Key="VisbleStringConverter" />
<spp:StringOmitConverter x:Key="StringOmitConverter" />
<spp:VisibleStringConverter x:Key="VisibleStringConverter" />
</Application.Resources>
<Application.Styles>
<sty:FluentAvaloniaTheme PreferSystemTheme="False" PreferUserAccentColor="True" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@
<BrushTransition Property="BorderBrush" Duration="00:00:00.083" />
</Transitions>
</ui:FABorder.Transitions>
<Grid
MinHeight="{TemplateBinding MinHeight}"
ColumnDefinitions="Auto,*,Auto,Auto"
RowDefinitions="*,Auto">
<Grid MinHeight="{TemplateBinding MinHeight}" ColumnDefinitions="Auto,*,Auto,Auto">
<Viewbox
Name="IconHost"
Grid.RowSpan="2"
Width="{DynamicResource SettingsExpanderItemIconSize}"
Height="{DynamicResource SettingsExpanderItemIconSize}"
HorizontalAlignment="Left"
Expand All @@ -76,28 +74,31 @@
Margin="{DynamicResource SettingsExpanderItemContentMargin}"
HorizontalAlignment="Left"
VerticalAlignment="Center">
<TextBlock
<ContentPresenter
Name="HeaderText"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Classes="BaseTextBlockStyle"
Text="{TemplateBinding Header}"
Content="{TemplateBinding Header}"
TextTrimming="CharacterEllipsis" />

<TextBlock
<ContentPresenter
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
HorizontalContentAlignment="Stretch"
Classes="CaptionTextBlockStyle"
Content="{TemplateBinding Description}"
FontSize="12"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
IsVisible="{TemplateBinding Description,
Converter={StaticResource IsNullConverter},
ConverterParameter=invert}"
Text="{TemplateBinding Description}"
TextWrapping="Wrap" />
</StackPanel>

<ContentPresenter
Name="ActionButton"
Grid.RowSpan="2"
Grid.Column="2"
Margin="{DynamicResource SettingsExpanderItemFooterMargin}"
HorizontalAlignment="Right"
Expand All @@ -106,6 +107,7 @@

<ui:SymbolIcon
Name="Chevron"
Grid.RowSpan="2"
Grid.Column="3"
Margin="24,4,0,4"
VerticalAlignment="Center"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using Avalonia.Controls;

namespace BD.WTTS.UI.Views.Controls;

public class OptionsDisplayItem : TemplatedControl
{
public static readonly StyledProperty<string> HeaderProperty =
AvaloniaProperty.Register<OptionsDisplayItem, string>(nameof(Header));
public static readonly StyledProperty<object?> HeaderProperty =
AvaloniaProperty.Register<OptionsDisplayItem, object?>(nameof(Header));

public static readonly StyledProperty<string> DescriptionProperty =
AvaloniaProperty.Register<OptionsDisplayItem, string>(nameof(Description));
public static readonly StyledProperty<object?> DescriptionProperty =
AvaloniaProperty.Register<OptionsDisplayItem, object?>(nameof(Description));

public static readonly StyledProperty<object?> IconProperty =
AvaloniaProperty.Register<OptionsDisplayItem, object?>(nameof(Icon));
Expand All @@ -29,13 +31,13 @@ public class OptionsDisplayItem : TemplatedControl
public static readonly StyledProperty<ICommand> NavigationCommandProperty =
AvaloniaProperty.Register<OptionsDisplayItem, ICommand>(nameof(NavigationCommand));

public string Header
public object? Header
{
get => GetValue(HeaderProperty);
set => SetValue(HeaderProperty, value);
}

public string Description
public object? Description
{
get => GetValue(DescriptionProperty);
set => SetValue(DescriptionProperty, value);
Expand Down Expand Up @@ -112,7 +114,7 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang
}
else if (change.Property == DescriptionProperty)
{
PseudoClasses.Set(":desc", !string.IsNullOrEmpty(change.GetNewValue<string>()));
PseudoClasses.Set(":desc", change.GetNewValue<object?>() != null);
}
else if (change.Property == IsExpandedProperty)
PseudoClasses.Set(":expanded", change.GetNewValue<bool>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,14 @@

<spp:PageBase.PaneContent>
<StackPanel Margin="15,20" Spacing="20">
<spp:OptionsDisplayItem Description="{Binding Source={x:Static ms:ASFSettings.ArchiSteamFarmExePath}, Path=Value, Mode=OneWay, Converter={StaticResource StringOmitConverter}, ConverterParameter=15}" Header="ASF 文件路径">
<spp:OptionsDisplayItem Header="ASF 文件路径">
<spp:OptionsDisplayItem.Description>
<TextBlock
MaxWidth="120"
MaxLines="1"
Text="{Binding Source={x:Static ms:ASFSettings.ArchiSteamFarmExePath}, Path=Value, Mode=OneWay}"
TextTrimming="CharacterEllipsis" />
</spp:OptionsDisplayItem.Description>
<spp:OptionsDisplayItem.Icon>
<ui:FontIcon FontFamily="Segoe Fluent Icons" Glyph="&#xE756;" />
</spp:OptionsDisplayItem.Icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public sealed partial class IdleCardPageViewModel

public ICommand IdleManualRunNext { get; }

[Reactive]
public bool IsLogin { get; set; }

[Reactive]
public bool IsLoaing { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,45 @@
<!-- Description="{Binding CurrentIdle.AppName}" -->
<spp:OptionsDisplayItem
Grid.Column="1"
Description="Steam 已启动"
Expands="True"
Header="正在挂卡"
IsExpanded="True">
<spp:OptionsDisplayItem.Header>
<TextBlock Foreground="Green">
<TextBlock.Text>
<MultiBinding Converter="{StaticResource VisibleStringConverter}">
<CompiledBinding Mode="OneWay" Path="RunState" />
<CompiledBinding
Mode="OneWay"
Path="Res.SteamRuning"
Source="{x:Static s:ResourceService.Current}" />
<CompiledBinding
Mode="OneWay"
Path="Res.SteamNoRuning"
Source="{x:Static s:ResourceService.Current}" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</spp:OptionsDisplayItem.Header>
<spp:OptionsDisplayItem.Description>
<TextBlock Foreground="Green">
<TextBlock.Text>
<MultiBinding Converter="{StaticResource VisibleStringConverter}">
<CompiledBinding
Mode="OneWay"
Path="IsConnectToSteam"
Source="{x:Static s:SteamConnectService.Current}" />
<CompiledBinding
Mode="OneWay"
Path="Res.SteamRuning"
Source="{x:Static s:ResourceService.Current}" />
<CompiledBinding
Mode="OneWay"
Path="Res.SteamNoRuning"
Source="{x:Static s:ResourceService.Current}" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</spp:OptionsDisplayItem.Description>
<spp:OptionsDisplayItem.Icon>
<ui:SymbolIcon Symbol="Page" />
</spp:OptionsDisplayItem.Icon>
Expand Down Expand Up @@ -294,7 +329,7 @@
ItemsJustification="Start"
ItemsStretch="Uniform"
MinColumnSpacing="5"
MinItemHeight="150"
MinItemHeight="160"
MinItemWidth="280"
MinRowSpacing="5" />
</ItemsRepeater.Layout>
Expand Down
18 changes: 18 additions & 0 deletions src/BD.WTTS.Client/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/BD.WTTS.Client/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2849,5 +2849,11 @@
<data name="SteamIdle_IdleAppTags_" xml:space="preserve">
<value>已游玩 {0} 小时
{1} 张剩余卡牌掉落</value>
</data>
<data name="SteamRuning" xml:space="preserve">
<value>Steam 已启动</value>
</data>
<data name="SteamNoRuning" xml:space="preserve">
<value>Steam 未启动</value>
</data>
</root>

0 comments on commit 0eff585

Please sign in to comment.