Skip to content

Commit

Permalink
Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
rmbadmin committed Oct 30, 2021
1 parent 0b99164 commit ad4e715
Show file tree
Hide file tree
Showing 37 changed files with 181 additions and 124 deletions.
2 changes: 1 addition & 1 deletion references/ArchiSteamFarm
2 changes: 1 addition & 1 deletion src/ST.Client.Android/Extensions/ResIconEnumExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static class ResIconEnumExtensions
{
var resId = icon switch
{
ResIcon.AvaterDefault => Resource.Drawable.avater_default,
ResIcon.AvatarDefault => Resource.Drawable.avatar_default,
ResIcon.AccountBox => Resource.Drawable.baseline_account_box_black_24,
ResIcon.Info => Resource.Drawable.baseline_info_black_24,
ResIcon.Person => Resource.Drawable.baseline_person_black_24,
Expand Down
20 changes: 10 additions & 10 deletions src/ST.Client.Android/ST.Client.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable\text_cursor.xml">
<Link>Resources\drawable\text_cursor.xml</Link>
</AndroidResource>
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-hdpi\avater_default.png">
<Link>Resources\drawable-hdpi\avater_default.png</Link>
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-hdpi\avatar_default.png">
<Link>Resources\drawable-hdpi\avatar_default.png</Link>
</AndroidResource>
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-hdpi\baseline_account_box_black_24.png">
<Link>Resources\drawable-hdpi\baseline_account_box_black_24.png</Link>
Expand Down Expand Up @@ -465,8 +465,8 @@
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-hdpi\splash_logo.png">
<Link>Resources\drawable-hdpi\splash_logo.png</Link>
</AndroidResource>
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-mdpi\avater_default.png">
<Link>Resources\drawable-mdpi\avater_default.png</Link>
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-mdpi\avatar_default.png">
<Link>Resources\drawable-mdpi\avatar_default.png</Link>
</AndroidResource>
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-mdpi\baseline_account_box_black_24.png">
<Link>Resources\drawable-mdpi\baseline_account_box_black_24.png</Link>
Expand Down Expand Up @@ -600,8 +600,8 @@
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-mdpi\splash_logo.png">
<Link>Resources\drawable-mdpi\splash_logo.png</Link>
</AndroidResource>
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-xhdpi\avater_default.png">
<Link>Resources\drawable-xhdpi\avater_default.png</Link>
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-xhdpi\avatar_default.png">
<Link>Resources\drawable-xhdpi\avatar_default.png</Link>
</AndroidResource>
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-xhdpi\baseline_account_box_black_24.png">
<Link>Resources\drawable-xhdpi\baseline_account_box_black_24.png</Link>
Expand Down Expand Up @@ -735,8 +735,8 @@
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-xhdpi\splash_logo.png">
<Link>Resources\drawable-xhdpi\splash_logo.png</Link>
</AndroidResource>
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-xxhdpi\avater_default.png">
<Link>Resources\drawable-xxhdpi\avater_default.png</Link>
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-xxhdpi\avatar_default.png">
<Link>Resources\drawable-xxhdpi\avatar_default.png</Link>
</AndroidResource>
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-xxhdpi\baseline_account_box_black_24.png">
<Link>Resources\drawable-xxhdpi\baseline_account_box_black_24.png</Link>
Expand Down Expand Up @@ -870,8 +870,8 @@
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-xxhdpi\splash_logo.png">
<Link>Resources\drawable-xxhdpi\splash_logo.png</Link>
</AndroidResource>
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-xxxhdpi\avater_default.png">
<Link>Resources\drawable-xxxhdpi\avater_default.png</Link>
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-xxxhdpi\avatar_default.png">
<Link>Resources\drawable-xxxhdpi\avatar_default.png</Link>
</AndroidResource>
<AndroidResource Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\drawable-xxxhdpi\baseline_account_box_black_24.png">
<Link>Resources\drawable-xxxhdpi\baseline_account_box_black_24.png</Link>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using ArchiSteamFarm.Steam;
#if !__MOBILE__
using Avalonia.Data.Converters;
#else
using Xamarin.Forms;
#endif

namespace System.Application.Converters
{
public class BotStatusConverter : IValueConverter
{
public object? Convert(object? value, Type? targetType, object? parameter, CultureInfo? culture)
{
if (value is Bot bot && bot != null)
{
if (!bot.KeepRunning)
return "未启用";
if (!bot.IsConnectedAndLoggedOn)
return "离线";
if (bot.CardsFarmer.Paused ||
bot.CardsFarmer.TimeRemaining == TimeSpan.Zero)
return "在线";
if (!bot.CardsFarmer.CurrentGamesFarmingReadOnly.Any())
return "在线";
return "正在挂卡";
}
return value;
}

public object? ConvertBack(object? value, Type? targetType, object? parameter, CultureInfo? culture) => throw new NotImplementedException();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ protected override IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr l
var newSize = ncParams.rgrc[0];
newSize.top = originalTop;

if (WindowState == WindowState.Maximized ||
WindowState == WindowState.FullScreen )
if (WindowState == WindowState.Maximized ||
WindowState == WindowState.FullScreen)
{
//newSize.top += GetResizeHandleHeight();
}
Expand All @@ -121,6 +121,8 @@ protected override IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr l
newSize.left += 8;
newSize.right -= 8;
newSize.bottom -= 8;

_owner.IsNewSizeWindow = true;
}

ncParams.rgrc[0] = newSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@
Command="{Binding OpenUserMenu}">
<DockPanel
HorizontalAlignment="Stretch">
<!--<Image x:Name="avater" Source="/Application/UI/Assets/Icon.ico" Height="64" Width="64"/>
<!--<Image x:Name="avatar" Source="/Application/UI/Assets/Icon.ico" Height="64" Width="64"/>
<Label Content="{ReflectionBinding Path=Title}" Foreground="{DynamicResource HighlightForegroundBrushKey}" VerticalContentAlignment="Center" FontSize="18" Margin="8,0,0,0"/>-->
<Image x:Name="avater" Clip=""
Source="{ReflectionBinding Path=AvaterPath, Source={x:Static service:UserService.Current},Mode=OneWay,Converter={StaticResource BitmapAssetValueConverter},ConverterParameter=64}"
<Image x:Name="avatar" Clip=""
Source="{ReflectionBinding Path=AvatarPath, Source={x:Static service:UserService.Current},Mode=OneWay,Converter={StaticResource BitmapAssetValueConverter},ConverterParameter=64}"
Stretch="Uniform"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Expand Down Expand Up @@ -158,7 +158,7 @@
<ui:Button.Flyout>
<ui:MenuFlyout Placement="RightEdgeAlignedTop">
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.RefreshAvatar,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding Path=RefreshUserAvaterAsync,Source={x:Static service:UserService.Current}}"/>
Command="{ReflectionBinding Path=RefreshUserAvatarAsync,Source={x:Static service:UserService.Current}}"/>
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.UserProfile,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding Path=ShowWindow,Source={x:Static service:UserService.Current}}"
CommandParameter="UserProfile"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public MainView()
// else
// sp.Margin = new Avalonia.Thickness(0, 6, 10, 0);

var avater = this.FindControl<Image>("avater");
var avatar = this.FindControl<Image>("avatar");
var nav = this.FindControl<NavigationView>("NavigationView");
var back = this.FindControl<ExperimentalAcrylicBorder>("NavBarBackground");

Expand All @@ -49,28 +49,28 @@ public MainView()
});
}

if (avater != null && nav != null)
if (avatar != null && nav != null)
{
nav.GetObservable(NavigationView.IsPaneOpenProperty)
.Subscribe(x =>
{
if (!x)
{
avater.Width = 26;
avater.Height = 26;
avater.Margin = new Thickness(-4, 0, 10, 0);
avatar.Width = 26;
avatar.Height = 26;
avatar.Margin = new Thickness(-4, 0, 10, 0);
}
else
{
avater.Width = 64;
avater.Height = 64;
avater.Margin = new Thickness(10, 0);
avatar.Width = 64;
avatar.Height = 64;
avatar.Margin = new Thickness(10, 0);
}


if (avater.Clip is EllipseGeometry ellipse)
if (avatar.Clip is EllipseGeometry ellipse)
{
ellipse.Rect = new Rect(0, 0, avater.Width, avater.Height);
ellipse.Rect = new Rect(0, 0, avatar.Width, avatar.Height);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
xmlns:vm="using:System.Application.UI.ViewModels"
xmlns:controls="clr-namespace:System.Application.UI.Views.Controls"
xmlns:resx="using:System.Application.UI.Resx"
xmlns:converters="using:System.Application.Converters"
xmlns:service="using:System.Application.Services"
xmlns:ccl_service="using:System.Application.Services"
xmlns:gif="using:AvaloniaGif"
Expand All @@ -17,14 +18,17 @@
x:DataType="vm:ArchiSteamFarmPlusPageViewModel"
x:CompileBindings="True"
x:Class="System.Application.UI.Views.Pages.ASF_BotPage">
<UserControl.Resources>
<converters:BotStatusConverter x:Key="BotStatusConverter"/>
</UserControl.Resources>
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
Padding="0 0 0 10">
<ItemsRepeater Items="{CompiledBinding SteamBots}">
<ItemsRepeater.Layout>
<!--<UniformGridLayout ItemsJustification="SpaceEvenly" MinRowSpacing="20" Orientation="Horizontal"
MaximumRowsOrColumns="6" />-->
<StackLayout Orientation="Vertical" Spacing="20"></StackLayout>
<StackLayout Orientation="Vertical" Spacing="10"></StackLayout>
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate>
Expand Down Expand Up @@ -57,12 +61,18 @@
Source="{Binding AvatarUrl,Converter={StaticResource BitmapAssetValueConverter}}">
</Image>
<!--<Image Width="184" Stretch="Uniform" IsVisible="{Binding AvatarStream^,Converter={StaticResource IsNullConverter}}"
Source="avares://System.Application.SteamTools.Client.Avalonia/Application/UI/Assets/AppResources/avater.jpg">
Source="avares://System.Application.SteamTools.Client.Avalonia/Application/UI/Assets/AppResources/avatar.jpg">
</Image>-->
</Panel>
<Panel Grid.Column="1" Margin="10 5">
<StackPanel Spacing="8">
<DockPanel>
<DockPanel.Styles>
<Style Selector="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="24"/>
</Style>
</DockPanel.Styles>
<WrapPanel DockPanel.Dock="Left">
<Ellipse
x:Name="circle"
Expand All @@ -82,29 +92,32 @@
</ia:DataTriggerBehavior>
</i:Interaction.Behaviors>
</Ellipse>
<controls:ScrollingTextBlock x:Name="nickname" Text="{Binding BotName}" FontSize="24" Foreground="{DynamicResource HighlightForegroundBrushKey}" Cursor="Hand" ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_BtnTootlip,Mode=OneWay,Source={x:Static resx:R.Current}}">
<i:Interaction.Behaviors>
<controls:ScrollingTextBlock x:Name="nickname"
Text="{Binding BotName}"
FontSize="24"
Foreground="{DynamicResource HighlightForegroundBrushKey}"
VerticalAlignment="Center"
Cursor="Hand"
ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_BtnTootlip,Mode=OneWay,Source={x:Static resx:R.Current}}">
<!--<i:Interaction.Behaviors>
<ia:EventTriggerBehavior EventName="Tapped" SourceObject="{ReflectionBinding #nickname}">
<ia:InvokeCommandAction Command="{ReflectionBinding #u.DataContext.SteamId_Click}" CommandParameter="{Binding}"/>
</ia:EventTriggerBehavior>
</i:Interaction.Behaviors>
</i:Interaction.Behaviors>-->
</controls:ScrollingTextBlock>
<!--<WrapPanel VerticalAlignment="Center" IsVisible="{Binding Remark,Converter={StaticResource IsNullConverter},ConverterParameter=invert}">-->
<WrapPanel VerticalAlignment="Center"
IsVisible="{Binding Nickname,Converter={StaticResource IsNullConverter},ConverterParameter=invert}">
<WrapPanel IsVisible="{Binding Nickname,Converter={StaticResource IsNullConverter},ConverterParameter=invert}">
<TextBlock Text="("></TextBlock>
<controls:ScrollingTextBlock Text="{Binding Nickname}">
</controls:ScrollingTextBlock>
<controls:ScrollingTextBlock Text="{Binding Nickname}"
FontSize="24"/>
<TextBlock Text=")"></TextBlock>
</WrapPanel>


</WrapPanel>

<WrapPanel DockPanel.Dock="Right">
<TextBlock IsVisible="{Binding !CardsFarmer.Paused}"
Text="正在挂卡"
FontSize="16"/>
<TextBlock Text="-"
Margin="5 0"/>
<TextBlock VerticalAlignment="Center"
Text="{Binding Converter={StaticResource BotStatusConverter}}"/>
</WrapPanel>
</DockPanel>

Expand Down Expand Up @@ -161,7 +174,8 @@
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<Border>
<Border Classes="paper"
ClipToBounds="True">
<Panel>
<Image Source="{Binding ImageUrl,Converter={StaticResource BitmapAssetValueConverter}}"
Width="184"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</ui:CommandBarButton>

<ui:CommandBarButton
Command="{ReflectionBinding ShowAddBotWindow}"
Command="{ReflectionBinding Source={x:Static service:ASFService.Current},Path=RefreshBots,Mode=OneWay}"
ToolTip.Tip="{ReflectionBinding Path=Res.Refresh,Mode=OneWay,Source={x:Static resx:R.Current}}"
Label="刷新">
<ui:CommandBarButton.Icon>
Expand All @@ -77,7 +77,7 @@
</ui:CommandBarButton.Icon>
</ui:CommandBarButton>
</ui:CommandBar.PrimaryCommands>

<ui:CommandBar.SecondaryCommands>
<ui:CommandBarButton Command="{ReflectionBinding OpenBrowser}"
CommandParameter="Wiki"
Expand Down Expand Up @@ -108,7 +108,7 @@
<!--<TabItem Header="ASF 运行状态">
</TabItem>-->

<TabItem Header="ASF 控制台">
<controls:ConsoleShell x:Name="ConsoleLog"
LogText="{ReflectionBinding Source={x:Static service:ASFService.Current},Path=ConsoleLogText,Mode=TwoWay}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@
<StackPanel Spacing="5">
<Border DockPanel.Dock="Top"
Cursor="Hand"
x:Name="AppAvater"
x:Name="AppAvatar"
Classes="paper"
Width="{ReflectionBinding Value,Source={x:Static ms:UISettings.AppGridSize},Mode=OneWay}">
<FlyoutBase.AttachedFlyout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private void App_PointerPressed(object? sender, Avalonia.Input.PointerPressedEve
{
if (e.Source is Control c)
{
var border = c.FindParentControl<Border>("AppAvater");
var border = c.FindParentControl<Border>("AppAvatar");
if (border is not null)
{
var flyout = FlyoutBase.GetAttachedFlyout(border);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<Image Width="184"
Stretch="Uniform"
IsVisible="{Binding AvatarStream^,Converter={StaticResource IsNullConverter}}"
Source="avares://System.Application.SteamTools.Client.Avalonia/Application/UI/Assets/AppResources/avater.jpg">
Source="avares://System.Application.SteamTools.Client.Avalonia/Application/UI/Assets/AppResources/avatar.jpg">
</Image>
<!--<gif:Image2 Width="184" Height="184"
AutoStart="true"
Expand Down
Loading

0 comments on commit ad4e715

Please sign in to comment.