Skip to content

Commit

Permalink
🚧 Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
rmbadmin committed Nov 20, 2023
1 parent 93e3550 commit cda93da
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ private async Task LoginSteamWithCodeAsync()
{
if (string.IsNullOrEmpty(EmailAuthText))
{
Toast.Show(ToastIcon.Error, _steamLoginState.Requires2FA ? AppResources.Error_PleaseEnterEmailCode
: AppResources.Error_PleaseEnterCode);
return;
//Toast.Show(ToastIcon.Error, _steamLoginState.Requires2FA ? AppResources.Error_PleaseEnterCode
// : AppResources.Error_PleaseEnterEmailCode);
//return;
}
else if (_steamLoginState.Requires2FA)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,15 @@
<spp:AuthenticatorItem>
<spp:AuthenticatorItem.ContextFlyout>
<MenuFlyout>
<MenuItem
Command="{Binding CopyCode}"
Header="{Binding Path=Res.Up, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
ToolTip.Tip="{Binding Path=Res.LocalAuth_Copy, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<MenuItem.Icon>
<ui:SymbolIcon Symbol="Copy" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="-" />
<MenuItem
Command="{Binding $parent[spp:PageBase].((spp:AuthenticatorHomePageViewModel)DataContext).AuthenticatorIndexMoveUp}"
CommandParameter="{Binding}"
Expand Down
2 changes: 1 addition & 1 deletion src/BD.WTTS.Client.Plugins.SteamIdleCard/Models/IdleApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public string? Tags
{
get
{
return Strings.SteamIdle_IdleAppTags_.Format(Badge.HoursPlayed, Badge.CardsRemaining);
return Strings.SteamIdle_IdleAppTags_.Format(Badge.HoursPlayed, Badge.CardsRemaining, Badge.RegularAvgPrice.ToString("0.00"));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/BD.WTTS.Client.Plugins.SteamIdleCard/Plugins/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed class Plugin : PluginBase<Plugin>, IPlugin

public sealed override string UniqueEnglishName => moduleName;

public sealed override string Description => "Steam 游戏空闲挂卡,支持多种算法逻辑和卡片价格展示";
public sealed override string Description => "Steam 游戏快速挂卡,需要启动 Steam 并登录对应账号,支持多种算法逻辑挂卡。";

protected sealed override string? AuthorOriginalString => null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@ public IdleCardPageViewModel()
this.IdleManualRunNext = ReactiveCommand.Create(ManualRunNext);
this.LoginSteamCommand = ReactiveCommand.Create(async () =>
{
if (!IsLoaing)
if (!IsLogin)
{
IsLoaing = true;
await LoginSteam();
await SteamAppsSort();
IsLoaing = false;
if (!IsLoaing)
{
IsLoaing = true;
await LoginSteam();
await SteamAppsSort();
IsLoaing = false;
}
}
else
{

}
});
}
Expand Down Expand Up @@ -134,7 +141,7 @@ private async Task<bool> LoginSteam()
SteamLoginState.Cookies = seesion.CookieContainer.GetAllCookies();

//var success = await Ioc.Get<ISteamAccountService>().CheckAccessTokenValidation(SteamLoginState.AccessToken);
SteamLoginState.Success = true;
IsLogin = SteamLoginState.Success = true;
//SteamLoginState.SteamId = success ? steamid : 0;
}

Expand All @@ -144,9 +151,15 @@ private async Task<bool> LoginSteam()
await IWindowManager.Instance.ShowTaskDialogAsync(vm, Strings.Steam_Login,
pageContent: new IdleSteamLoginPage(), okButtonText: Strings.Confirm, isOkButton: false);

return SteamLoginState.Success;
IsLogin = SteamLoginState.Success;
}
return true;

if (SteamLoginState.Success && SteamLoginState.SteamId != (ulong?)SteamConnectService.Current.CurrentSteamUser?.SteamId64)
{
Toast.Show(ToastIcon.Error, "登录的账号必须与当前 Steam 客户端账号一致!");
}

return IsLogin;
}

private void ChangeRunTxt()
Expand Down Expand Up @@ -199,6 +212,7 @@ private async Task SteamAppsSort()
catch (Exception ex)
{
Toast.LogAndShowT(ex);
IsLogin = false;
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,43 @@
</ui:FAMenuFlyout>
</spp:PageBase.Resources>
<spp:PageBase.ActionContent>
<StackPanel>
<!--<Button Command="{Binding IdleRunStartOrStop}" Content="挂卡设置" />-->
<StackPanel Orientation="Horizontal" Spacing="8">
<Button
Padding="8,4"
VerticalAlignment="Center"
Command="{Binding IdleRunStartOrStop}"
Theme="{StaticResource TransparentButton}">
<Button.Content>
<WrapPanel>
<ui:SymbolIcon Margin="0,0,5,0" Symbol="Play" />
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource VisibleStringConverter}">
<CompiledBinding Mode="OneWay" Path="RunState" />
<CompiledBinding
Mode="OneWay"
Path="Res.Stop"
Source="{x:Static s:ResourceService.Current}" />
<CompiledBinding
Mode="OneWay"
Path="Res.Launch"
Source="{x:Static s:ResourceService.Current}" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</WrapPanel>
</Button.Content>
</Button>

<Separator
Height="18"
Margin="5,0"
VerticalAlignment="Center"
Background="{DynamicResource ButtonBorderBrush}"
Classes="Vertical"
DockPanel.Dock="Right"
IsHitTestVisible="False" />

<ToggleButton
Padding="8,4"
DockPanel.Dock="Right"
Expand Down Expand Up @@ -134,7 +169,7 @@

<spp:ContentLoader IsLoading="{Binding IsLoaing}">
<!-- IsVisible="{Binding !IsLoaing}" -->
<Grid ColumnDefinitions="*,Auto" RowDefinitions="Auto,Auto,*">
<Grid ColumnDefinitions="*,240" RowDefinitions="Auto,Auto,*">
<spp:OptionsDisplayItem
Expands="True"
Header="{Binding Source={x:Static s:SteamConnectService.Current}, Path=CurrentSteamUser.SteamNickName, Mode=OneWay}"
Expand Down Expand Up @@ -165,10 +200,26 @@
</spp:Image2>
</spp:OptionsDisplayItem.Icon>
<spp:OptionsDisplayItem.ActionButton>
<Button
VerticalAlignment="Center"
Command="{Binding LoginSteamCommand}"
Content="登录" />
<Button VerticalAlignment="Center" Command="{Binding LoginSteamCommand}">
<WrapPanel>
<ui:SymbolIcon Margin="0,0,5,0" Symbol="AddFriend" />
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource VisibleStringConverter}">
<CompiledBinding Mode="OneWay" Path="IsLogin" />
<CompiledBinding
Mode="OneWay"
Path="Res.Logout"
Source="{x:Static s:ResourceService.Current}" />
<CompiledBinding
Mode="OneWay"
Path="Res.User_Login"
Source="{x:Static s:ResourceService.Current}" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</WrapPanel>
</Button>
</spp:OptionsDisplayItem.ActionButton>
<spp:OptionsDisplayItem.Content>
<StackPanel
Expand Down Expand Up @@ -221,31 +272,6 @@
Expands="True"
IsExpanded="True">
<spp:OptionsDisplayItem.Header>
<!--<Ellipse
Width="6"
Height="6"
Margin="0,0,5,0">
<i:Interaction.Behaviors>
<ia:DataTriggerBehavior
Binding="{Binding RunState}"
ComparisonCondition="Equal"
Value="True">
<ia:ChangePropertyAction
PropertyName="Fill"
TargetObject="ChangePropertyRectangle"
Value="#47A42B" />
</ia:DataTriggerBehavior>
<ia:DataTriggerBehavior
Binding="{Binding RunState}"
ComparisonCondition="NotEqual"
Value="True">
<ia:ChangePropertyAction
PropertyName="Fill"
TargetObject="ChangePropertyRectangle"
Value="#FF4F58" />
</ia:DataTriggerBehavior>
</i:Interaction.Behaviors>
</Ellipse>-->
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource VisibleStringConverter}">
Expand All @@ -263,7 +289,27 @@
</TextBlock>
</spp:OptionsDisplayItem.Header>
<spp:OptionsDisplayItem.Description>
<TextBlock Foreground="{DynamicResource SystemFillColorSuccessBrush}">
<TextBlock Name="Description">
<i:Interaction.Behaviors>
<ia:DataTriggerBehavior
Binding="{Binding IsConnectToSteam, Source={x:Static s:SteamConnectService.Current}}"
ComparisonCondition="Equal"
Value="True">
<ia:ChangePropertyAction
PropertyName="Foreground"
TargetObject="Description"
Value="{DynamicResource SystemFillColorSuccessBrush}" />
</ia:DataTriggerBehavior>
<ia:DataTriggerBehavior
Binding="{Binding IsConnectToSteam, Source={x:Static s:SteamConnectService.Current}}"
ComparisonCondition="NotEqual"
Value="True">
<ia:ChangePropertyAction
PropertyName="Foreground"
TargetObject="Description"
Value="{DynamicResource SystemFillColorCriticalBrush}" />
</ia:DataTriggerBehavior>
</i:Interaction.Behaviors>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource VisibleStringConverter}">
<CompiledBinding
Expand All @@ -285,6 +331,7 @@
<spp:OptionsDisplayItem.Icon>
<!--<ui:SymbolIcon Symbol="Page" />-->
<Ellipse
Name="EllipseC"
Width="6"
Height="6"
Margin="5,0,5,0">
Expand All @@ -295,7 +342,7 @@
Value="True">
<ia:ChangePropertyAction
PropertyName="Fill"
TargetObject="ChangePropertyRectangle"
TargetObject="EllipseC"
Value="#47A42B" />
</ia:DataTriggerBehavior>
<ia:DataTriggerBehavior
Expand All @@ -304,32 +351,36 @@
Value="True">
<ia:ChangePropertyAction
PropertyName="Fill"
TargetObject="ChangePropertyRectangle"
TargetObject="EllipseC"
Value="#FF4F58" />
</ia:DataTriggerBehavior>
</i:Interaction.Behaviors>
</Ellipse>
</spp:OptionsDisplayItem.Icon>
<spp:OptionsDisplayItem.ActionButton>
<Button
VerticalAlignment="Center"
Command="{Binding IdleRunStartOrStop}"
Content="启动">
<!--<spp:OptionsDisplayItem.ActionButton>
<Button VerticalAlignment="Center" Command="{Binding IdleRunStartOrStop}">
<Button.Content>
<MultiBinding Converter="{StaticResource VisibleStringConverter}">
<CompiledBinding Mode="OneWay" Path="RunState" />
<CompiledBinding
Mode="OneWay"
Path="Res.SteamIdle_IdleRuning"
Source="{x:Static s:ResourceService.Current}" />
<CompiledBinding
Mode="OneWay"
Path="Res.SteamIdle_IdleNotRuning"
Source="{x:Static s:ResourceService.Current}" />
</MultiBinding>
<WrapPanel>
<ui:SymbolIcon Margin="0,0,5,0" Symbol="Play" />
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource VisibleStringConverter}">
<CompiledBinding Mode="OneWay" Path="RunState" />
<CompiledBinding
Mode="OneWay"
Path="Res.Stop"
Source="{x:Static s:ResourceService.Current}" />
<CompiledBinding
Mode="OneWay"
Path="Res.Launch"
Source="{x:Static s:ResourceService.Current}" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</WrapPanel>
</Button.Content>
</Button>
</spp:OptionsDisplayItem.ActionButton>
</spp:OptionsDisplayItem.ActionButton>-->
<spp:OptionsDisplayItem.Content>
<StackPanel
Margin="24,0"
Expand Down
21 changes: 20 additions & 1 deletion 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.

9 changes: 8 additions & 1 deletion src/BD.WTTS.Client/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2842,7 +2842,8 @@
</data>
<data name="SteamIdle_IdleAppTags_" xml:space="preserve">
<value>已游玩 {0} 小时
{1} 张剩余卡牌掉落</value>
{1} 张剩余卡牌掉落
卡牌均价 ¥{2}</value>
</data>
<data name="SteamRuning" xml:space="preserve">
<value>Steam 已启动</value>
Expand All @@ -2855,5 +2856,11 @@
</data>
<data name="SteamIdle_IdleNotRuning" xml:space="preserve">
<value>未启动挂卡</value>
</data>
<data name="Launch" xml:space="preserve">
<value>启动</value>
</data>
<data name="Stop" xml:space="preserve">
<value>停止</value>
</data>
</root>

0 comments on commit cda93da

Please sign in to comment.