new settings

This commit is contained in:
rmbgame
2021-04-27 23:38:35 +08:00
parent 2eb6cfe2e5
commit c20ab74a87
16 changed files with 148 additions and 35 deletions
@@ -133,6 +133,12 @@ namespace System.Application.UI
windowService.Init();
SettingsHost.Load();
if (GeneralSettings.IsStartupAppMinimized.Value)
{
Program.IsMinimize = true;
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
desktop.MainWindow = null;
}
Theme = (AppTheme)UISettings.Theme.Value;
UISettings.Theme.Subscribe(x => Theme = (AppTheme)x);
UISettings.Language.Subscribe(x => R.ChangeLanguage(x));
@@ -150,7 +156,9 @@ namespace System.Application.UI
#region 主窗口启动时加载的资源
compositeDisposable.Add(SettingsHost.Save);
compositeDisposable.Add(ProxyService.Current.Dispose);
compositeDisposable.Add(AuthService.Current.SaveEditNameAuthenticators);
compositeDisposable.Add(SteamConnectService.Current.Dispose);
#endregion
MainWindow = new MainWindow
{
@@ -52,7 +52,7 @@ namespace System.Application
});
rootCommand.AddCommand(devtools);
// -clt c
// -clt c -silence
var common = new Command("c", "common");
common.AddOption(new Option<bool>("-silence", "静默启动(不弹窗口)"));
common.Handler = CommandHandler.Create((bool silence) =>
@@ -1,5 +1,6 @@
using NLog;
using NLog.Config;
using System.Application.Models.Settings;
using System.Application.Services;
using System.IO;
using System.Linq;
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

@@ -5,6 +5,7 @@
xmlns:controls="clr-namespace:System.Application.UI.Views.Controls;assembly=System.Application.SteamTools.Client.Desktop.Avalonia"
xmlns:vm="clr-namespace:System.Application.UI.ViewModels;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:resx="clr-namespace:System.Application.UI.Resx;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:gif="clr-namespace:AvaloniaGif;assembly=AvaloniaGif"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="vm:AboutPageViewModel"
x:CompileBindings="True"
@@ -97,17 +98,17 @@
Text="Development: "
VerticalAlignment="Center"/>
<Button Classes="plain" Command="{Binding OpenBrowserCommand}"
CommandParameter="{x:Static vm:AboutPageViewModel.SourceCodeLink}">
CommandParameter="{x:Static vm:AboutPageViewModel.RmbadminLink}">
<TextBlock Text="@软妹币玩家" Classes="Hyperlink" />
</Button>
<TextBlock Classes="LinkSeparatorPadding" Text="-" />
<Button Classes="plain" Command="{Binding OpenBrowserCommand}"
CommandParameter="{x:Static vm:AboutPageViewModel.SourceCodeLink}">
CommandParameter="{x:Static vm:AboutPageViewModel.AigioLLink}">
<TextBlock Text="@AigioL" Classes="Hyperlink" />
</Button>
<TextBlock Classes="LinkSeparatorPadding" Text="-" />
<Button Classes="plain" Command="{Binding OpenBrowserCommand}"
CommandParameter="{x:Static vm:AboutPageViewModel.SourceCodeLink}">
CommandParameter="{x:Static vm:AboutPageViewModel.MossimosLink}">
<TextBlock Text="@Mossimos" Classes="Hyperlink" />
</Button>
</StackPanel>
@@ -116,7 +117,7 @@
Text="Business And Art: "
VerticalAlignment="Center"/>
<Button Classes="plain" Command="{Binding OpenBrowserCommand}"
CommandParameter="{x:Static vm:AboutPageViewModel.SourceCodeLink}">
CommandParameter="{x:Static vm:AboutPageViewModel.CliencerLink}">
<TextBlock Text="@Cliencer克总" Classes="Hyperlink" />
</Button>
</StackPanel>
@@ -134,10 +135,13 @@
</StackPanel>
</WrapPanel>
<WrapPanel>
<gif:Image2 Width="500" Height="300" Stretch="UniformToFill" Source="avares://System.Application.SteamTools.Client.Desktop.Avalonia/Application/UI/Assets/AppResources/gg.gif"></gif:Image2>
</WrapPanel>
</StackPanel>
<DockPanel VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0 0 0 20">
<StackPanel Spacing="10"
<StackPanel Spacing="10"
DockPanel.Dock="Bottom" HorizontalAlignment="Center" Orientation="Vertical">
<WrapPanel Margin="0 0 0 10" HorizontalAlignment="Center">
<StackPanel Orientation="Horizontal" Spacing="5" Margin="2">
@@ -150,7 +154,7 @@
<StackPanel Orientation="Horizontal" Spacing="5" Margin="2">
<Button Classes="plain"
Command="{Binding OpenBrowserCommand}"
CommandParameter="{x:Static vm:AboutPageViewModel.ClearnetLink}">
CommandParameter="{x:Static vm:AboutPageViewModel.OfficialLink}">
<TextBlock Text="Website" Classes="Hyperlink" />
</Button>
</StackPanel>
@@ -179,17 +183,17 @@
</WrapPanel>
<StackPanel Orientation="Horizontal" Spacing="5" HorizontalAlignment="Center">
<Button Classes="plain" Command="{Binding OpenBrowserCommand}"
CommandParameter="{x:Static vm:AboutPageViewModel.SourceCodeLink}">
CommandParameter="{x:Static vm:AboutPageViewModel.PrivacyLink}">
<TextBlock Text="用户协议" Classes="Hyperlink" />
</Button>
<TextBlock Classes="LinkSeparatorPadding" Text="-" />
<Button Classes="plain" Command="{Binding OpenBrowserCommand}"
CommandParameter="{x:Static vm:AboutPageViewModel.SourceCodeLink}">
CommandParameter="{x:Static vm:AboutPageViewModel.AgreementLink}">
<TextBlock Text="隐私政策" Classes="Hyperlink" />
</Button>
</StackPanel>
<WrapPanel HorizontalAlignment="Center">
<TextBlock Classes="Header light"
<TextBlock Classes="h7 light"
Text="长沙次元超越科技有限公司 - 2021© All Rights Reserved."
VerticalAlignment="Center"/>
</WrapPanel>
@@ -218,10 +218,10 @@
<PathIcon Data="{StaticResource DownloadDrawing}" Width="14"></PathIcon>
</MenuItem.Icon>
</MenuItem>
<MenuItem
<!--<MenuItem
Header="{ReflectionBinding Path=Res.Edit,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding #u.DataContext.OfflineModeButton_Click}"
CommandParameter="{Binding}" />
CommandParameter="{Binding}" />-->
<MenuItem
Header="{ReflectionBinding Path=Res.Achievement_Manage,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding #u.DataContext.UnlockAchievement_Click}"
@@ -230,14 +230,14 @@
<PathIcon Data="{StaticResource TrophyDrawing}" Width="16"></PathIcon>
</MenuItem.Icon>
</MenuItem>
<MenuItem
<!--<MenuItem
Header="{ReflectionBinding Path=Res.GameList_HideTheGame,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding #u.DataContext.DeleteUserButton_Click}"
CommandParameter="{Binding}" />
<MenuItem
Header="{ReflectionBinding Path=Res.GameList_SetCustomImage,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding #u.DataContext.DeleteUserButton_Click}"
CommandParameter="{Binding}" />
CommandParameter="{Binding}" />-->
<MenuItem
Header="{ReflectionBinding Path=Res.GameList_OpenStoreUrl,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding #u.DataContext.OpenAppStoreUrl}"
@@ -77,24 +77,29 @@
<StackPanel Orientation="Horizontal" Spacing="5">
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.ShowAuthCode}" CommandParameter="{Binding}" ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_DeleteUser,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.ShowAuthCode}" CommandParameter="{Binding}"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_ShowAuthCode,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<PathIcon Data="{DynamicResource SearchDrawing}" Width="20"></PathIcon>
</Button>
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.ShowSteamAuthTrade}" CommandParameter="{Binding}" ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_DeleteUser,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.ShowSteamAuthTrade}" CommandParameter="{Binding}"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_AuthTrade,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<PathIcon Data="{DynamicResource TradeDrawing}" Width="20"></PathIcon>
</Button>
<Button Cursor="Hand" Classes="flatbutton" ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_DeleteUser,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<!--<Button Cursor="Hand" Classes="flatbutton"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_CloudSync,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<PathIcon Data="{DynamicResource CloudDrawing}" Width="20"></PathIcon>
</Button>
</Button>-->
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.ShowSteamAuthData}" CommandParameter="{Binding}" ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_DeleteUser,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.ShowSteamAuthData}" CommandParameter="{Binding}"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_ShowAuthInfo,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<PathIcon Data="{DynamicResource SlideSearchDrawing}" Width="20"></PathIcon>
</Button>
</StackPanel>
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.CopyCodeCilp}" CommandParameter="{Binding}" HorizontalAlignment="Right" ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_DeleteUser,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.CopyCodeCilp}" CommandParameter="{Binding}" HorizontalAlignment="Right"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_Copy,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<PathIcon Data="{DynamicResource CopyDrawing}" Width="20"></PathIcon>
</Button>
</DockPanel>
@@ -19,6 +19,10 @@
<AvaloniaResource Include="Application\UI\Assets\**" />
</ItemGroup>
<ItemGroup>
<None Remove="Application\UI\Assets\AppResources\gg.gif" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Common.CoreLib\Properties\AssemblyInfo.cs">
<Link>Properties\AssemblyInfo.cs</Link>
@@ -105,7 +105,7 @@ namespace System.Application.Services.Implementation
td.Settings.StopIfGoingOnBatteries = false;
td.Settings.DisallowStartIfOnBatteries = false;
td.Triggers.Add(new LogonTrigger());
td.Actions.Add(new ExecAction(AppHelper.ProgramName, "-minimized", Path.GetDirectoryName(Assembly.GetCallingAssembly().Location)));
td.Actions.Add(new ExecAction(AppHelper.ProgramName, "-clt c -silence", Path.GetDirectoryName(Assembly.GetCallingAssembly().Location)));
if (IsAdministrator)
td.Principal.RunLevel = TaskRunLevel.Highest;
TaskService.Instance.RootFolder.RegisterTaskDefinition(name, td);
@@ -12,9 +12,10 @@ namespace System.Application.Models
{
}
public MyAuthenticator(IGAPAuthenticatorDTO data)
public MyAuthenticator(IGAPAuthenticatorDTO data) : this()
{
AuthenticatorData = data;
OriginName = AuthenticatorData.Name;
}
public IGAPAuthenticatorDTO AuthenticatorData { get; set; }
@@ -32,6 +33,7 @@ namespace System.Application.Models
}
}
public string OriginName;
public string Name
{
get
@@ -45,6 +47,7 @@ namespace System.Application.Models
}
}
public int Index
{
get
@@ -194,6 +197,7 @@ namespace System.Application.Models
{
case "name":
Name = reader.ReadElementContentAsString();
OriginName = Name;
break;
case "created":
@@ -18,15 +18,17 @@ namespace System.Application.Models.Settings
private static void IsRunSteamNoCheckUpdate_ValueChanged(object sender, ValueChangedEventArgs<bool> e)
{
if (e.NewValue)
SteamStratParameter.Value += "";
SteamStratParameter.Value += " -noverifyfiles";
else
SteamStratParameter.Value = SteamStratParameter.Value.Replace("-silent", "").Trim();
}
private static void IsRunSteamMinimized_ValueChanged(object sender, ValueChangedEventArgs<bool> e)
{
if (e.NewValue)
SteamStratParameter.Value += "";
SteamStratParameter.Value += " -silent";
else
SteamStratParameter.Value = SteamStratParameter.Value.Replace("-silent", "").Trim();
}
/// <summary>
@@ -483,5 +483,18 @@ namespace System.Application.Services
await repository.DeleteAsync(auth.AuthenticatorData.Id);
Current.Authenticators.Remove(auth);
}
public void SaveEditNameAuthenticators()
{
Task.Run(() =>
{
var auths = Authenticators.Items.Where(x => x.Name != x.OriginName);
foreach (var auth in auths)
AddOrUpdateSaveAuthenticators(auth);
});
}
}
}
+45
View File
@@ -1088,6 +1088,15 @@ namespace System.Application.UI.Resx {
}
}
/// <summary>
/// 查找类似 确认交易 的本地化字符串。
/// </summary>
public static string LocalAuth_AuthTrade {
get {
return ResourceManager.GetString("LocalAuth_AuthTrade", resourceCulture);
}
}
/// <summary>
/// 查找类似 取消交易 的本地化字符串。
/// </summary>
@@ -1242,6 +1251,24 @@ namespace System.Application.UI.Resx {
}
}
/// <summary>
/// 查找类似 令牌云同步 的本地化字符串。
/// </summary>
public static string LocalAuth_CloudSync {
get {
return ResourceManager.GetString("LocalAuth_CloudSync", resourceCulture);
}
}
/// <summary>
/// 查找类似 复制令牌 的本地化字符串。
/// </summary>
public static string LocalAuth_Copy {
get {
return ResourceManager.GetString("LocalAuth_Copy", resourceCulture);
}
}
/// <summary>
/// 查找类似 已复制令牌 的本地化字符串。
/// </summary>
@@ -1350,6 +1377,24 @@ namespace System.Application.UI.Resx {
}
}
/// <summary>
/// 查找类似 查看令牌 的本地化字符串。
/// </summary>
public static string LocalAuth_ShowAuthCode {
get {
return ResourceManager.GetString("LocalAuth_ShowAuthCode", resourceCulture);
}
}
/// <summary>
/// 查找类似 查看令牌详细数据 的本地化字符串。
/// </summary>
public static string LocalAuth_ShowAuthInfo {
get {
return ResourceManager.GetString("LocalAuth_ShowAuthInfo", resourceCulture);
}
}
/// <summary>
/// 查找类似 Steam身份验证器的完整数据,可在导入不同软件时使用: 的本地化字符串。
/// </summary>
@@ -462,6 +462,9 @@
<data name="LocalAuth_AuthName" xml:space="preserve">
<value>令牌自定义名称</value>
</data>
<data name="LocalAuth_AuthTrade" xml:space="preserve">
<value>确认交易</value>
</data>
<data name="LocalAuth_AuthTrade_Cancel" xml:space="preserve">
<value>取消交易</value>
</data>
@@ -516,6 +519,12 @@
<data name="LocalAuth_AuthTrade_TradeError" xml:space="preserve">
<value>无效的交易</value>
</data>
<data name="LocalAuth_CloudSync" xml:space="preserve">
<value>令牌云同步</value>
</data>
<data name="LocalAuth_Copy" xml:space="preserve">
<value>复制令牌</value>
</data>
<data name="LocalAuth_CopyAuthTip" xml:space="preserve">
<value>已复制令牌 </value>
</data>
@@ -552,6 +561,12 @@
<data name="LocalAuth_SDATip" xml:space="preserve">
<value>Steam的移动身份验证器应用程序的桌面实现。导入方法:选择SDA目录下maFiles文件夹的maFile文件进行导入。(不支持导入加密文件,请先移除密码在导入)</value>
</data>
<data name="LocalAuth_ShowAuthCode" xml:space="preserve">
<value>查看令牌</value>
</data>
<data name="LocalAuth_ShowAuthInfo" xml:space="preserve">
<value>查看令牌详细数据</value>
</data>
<data name="LocalAuth_ShowSteamAuthTip1" xml:space="preserve">
<value>Steam身份验证器的完整数据,可在导入不同软件时使用:</value>
</data>
@@ -35,7 +35,21 @@ namespace System.Application.UI.ViewModels
public Version ClientVersion => ThisAssembly.ClientVersion;
public static string ClearnetLink => "https://steampp.net/";
public static string RmbadminSteamLink => SteamApiUrls.MY_PROFILE_URL;
public static string RmbadminLink => "https://github.com/rmbadmin";
public static string AigioLLink => "https://github.com/AigioL";
public static string MossimosLink => "https://github.com/Mossimos";
public static string CliencerLink => "https://space.bilibili.com/30031316";
public static string PrivacyLink => "https://steampp.net/privacy";
public static string AgreementLink => "https://steampp.net/agreement";
public static string OfficialLink => "https://steampp.net/";
public static string SourceCodeLink => "https://github.com/rmbadmin/SteamTools";
@@ -45,8 +59,6 @@ namespace System.Application.UI.ViewModels
public static string FAQLink => "https://steampp.net/faq";
public static string DocsLink => "https://docs.wasabiwallet.io/";
public static string LicenseLink => "https://github.com/rmbadmin/SteamTools/blob/develop/LICENSE";
}
}
@@ -31,15 +31,15 @@ namespace System.Application.UI.ViewModels
// {
new MenuItemViewModel(nameof(AppResources.Add)) { IconKey="AddDrawing",
Command= AddAuthCommand },
new MenuItemViewModel(nameof(AppResources.Edit)) { IconKey="EditDrawing" },
new MenuItemViewModel(nameof(AppResources.Export)) { IconKey="ExportDrawing",
Command= RefreshAuthCommand },
//new MenuItemViewModel(nameof(AppResources.Edit)) { IconKey="EditDrawing" },
//new MenuItemViewModel(nameof(AppResources.Export)) { IconKey="ExportDrawing",
// Command= RefreshAuthCommand },
new MenuItemViewModel(),
new MenuItemViewModel(nameof(AppResources.Refresh)) {IconKey="RefreshDrawing",
Command= RefreshAuthCommand },
new MenuItemViewModel(),
new MenuItemViewModel(nameof(AppResources.Encrypt)) {IconKey="LockDrawing" },
new MenuItemViewModel(nameof(AppResources.CloudSync)) {IconKey="CloudDrawing" },
//new MenuItemViewModel(),
//new MenuItemViewModel(nameof(AppResources.Encrypt)) {IconKey="LockDrawing" },
//new MenuItemViewModel(nameof(AppResources.CloudSync)) {IconKey="CloudDrawing" },
// }
//},
};