🐛 加速选中保存失效问题修复

This commit is contained in:
RMBGAME
2023-07-16 21:12:00 +08:00
parent fa927f4767
commit fc03223bb4
18 changed files with 182 additions and 103 deletions
@@ -40,7 +40,7 @@ public sealed class StringFormatConverter : IValueConverter, IMultiValueConverte
var res = Strings.ResourceManager.GetString(para, Strings.Culture);
if (!string.IsNullOrEmpty(res))
return res.Format(str);
return para.Format(str);
return str.Format(para);
}
else
{
@@ -123,10 +123,10 @@
BorderBrush="{DynamicResource ControlFillColorDefaultBrush}"
ClipToBounds="True"
CornerRadius="{StaticResource ControlCornerRadius}">
<TextBlock
VerticalAlignment="Top"
<ContentPresenter
Content="{TemplateBinding Status}"
FontSize="12"
Text="{TemplateBinding Status}"
TextWrapping="Wrap" />
</Border>
</WrapPanel>
@@ -270,7 +270,12 @@
Converter={StaticResource IsNullConverter},
ConverterParameter=invert}">
<DockPanel>
<WrapPanel DockPanel.Dock="Left" Orientation="Horizontal">
<WrapPanel
DockPanel.Dock="Left"
IsVisible="{TemplateBinding Status,
Converter={StaticResource IsNullConverter},
ConverterParameter=invert}"
Orientation="Horizontal">
<Border
Margin="0,5"
Padding="8,5"
@@ -278,10 +283,10 @@
BorderBrush="{DynamicResource ControlFillColorDefaultBrush}"
ClipToBounds="True"
CornerRadius="{StaticResource ControlCornerRadius}">
<TextBlock
<ContentPresenter
VerticalAlignment="Top"
Content="{TemplateBinding Status}"
FontSize="12"
Text="{TemplateBinding Status}"
TextWrapping="Wrap" />
</Border>
</WrapPanel>
@@ -216,7 +216,8 @@
<SplitView
DisplayMode="Overlay"
IsPaneOpen="{TemplateBinding IsPaneOpen}"
IsPaneOpen="{TemplateBinding IsPaneOpen,
Mode=TwoWay}"
OpenPaneLength="{TemplateBinding OpenPaneLength}"
PaneBackground="Transparent"
PanePlacement="Right">
@@ -12,8 +12,8 @@ public class AppItem : TemplatedControl
public static readonly StyledProperty<string> DescriptionProperty =
AvaloniaProperty.Register<AppItem, string>(nameof(Description));
public static readonly StyledProperty<string> StatusProperty =
AvaloniaProperty.Register<AppItem, string>(nameof(Status));
public static readonly StyledProperty<object?> StatusProperty =
ContentControl.ContentProperty.AddOwner<AppItem>();
public static readonly StyledProperty<Control> ImageProperty =
AvaloniaProperty.Register<AppItem, Control>(nameof(Image));
@@ -45,7 +45,7 @@ public class AppItem : TemplatedControl
set => SetValue(DescriptionProperty, value);
}
public string Status
public object? Status
{
get => GetValue(StatusProperty);
set => SetValue(StatusProperty, value);
@@ -95,7 +95,7 @@ public class SnackbarManager : TemplatedControl, IManagedNotificationManager
var infoBarControl = new Snackbar
{
MaxWidth = 450,
MaxWidth = 500,
IsOpen = true,
IsClosable = true,
Severity = InfoBarSeverity.Informational,
@@ -14,7 +14,12 @@
mc:Ignorable="d">
<StackPanel Margin="{StaticResource PageMargin}" Spacing="{StaticResource SettingsSpacing}">
<TextBlock Margin="0,0,0,5" Text="{ReflectionBinding Path=Res.About, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<TextBlock
Margin="0,0,0,5"
Text="{ReflectionBinding Path=Res.About,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
Theme="{StaticResource SubtitleTextBlockStyle}" />
<spp:OptionsDisplayItem
Description="{Binding Copyright}"
@@ -184,12 +184,19 @@
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Theme="{DynamicResource TransparentButton}">
<Viewbox
Width="20"
Height="20"
VerticalAlignment="Center">
<ui:SymbolIcon Symbol="Alert" />
</Viewbox>
<Panel>
<ui:InfoBadge
Margin="0,-3,-3,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Classes="Attention Dot" />
<Viewbox
Width="22"
Height="22"
VerticalAlignment="Center">
<ui:SymbolIcon Symbol="Alert" />
</Viewbox>
</Panel>
</Button>
<DropDownButton Padding="4" Theme="{DynamicResource TransparentButton}">
@@ -206,32 +213,91 @@
<MenuItem IsHitTestVisible="False">
<MenuItem.Header>
<DockPanel>
<Border
Width="64"
Height="64"
Margin="0,0,8,0"
ClipToBounds="True"
CornerRadius="64"
DockPanel.Dock="Left">
<Image RenderOptions.BitmapInterpolationMode="HighQuality" Source="/UI/Assets/Icons/avatar.ico" />
</Border>
<Panel>
<TextBlock
VerticalAlignment="Center"
IsVisible="{ReflectionBinding Path=User,
<DockPanel DockPanel.Dock="Top">
<Border
Width="64"
Height="64"
Margin="0,0,8,0"
ClipToBounds="True"
CornerRadius="64"
DockPanel.Dock="Left">
<Image RenderOptions.BitmapInterpolationMode="HighQuality" Source="/UI/Assets/Icons/avatar.ico" />
</Border>
<Panel>
<TextBlock
VerticalAlignment="Center"
IsVisible="{ReflectionBinding Path=User,
Mode=OneWay,
Source={x:Static s:UserService.Current},
Converter={StaticResource IsNullConverter}}"
Text="{ReflectionBinding Path=Res.User_UnLogin,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
<StackPanel VerticalAlignment="Center" IsVisible="{ReflectionBinding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}">
<TextBlock Text="{ReflectionBinding Path=User.NickName, Mode=OneWay, Source={x:Static s:UserService.Current}}" />
<Border VerticalAlignment="Center" IsVisible="{ReflectionBinding Path=User.UserType, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource EnumEqualValueConverter}, ConverterParameter={x:Static enum:UserType.Sponsor}}">
<TextBlock FontSize="10" Text="{ReflectionBinding Path=Res.User_Sponsor, Mode=OneWay, Source={x:Static s:ResourceService.Current}, StringFormat={}❤️{0}}" />
</Border>
</StackPanel>
</Panel>
</DockPanel>
<!--<WrapPanel HorizontalAlignment="Center" IsVisible="{ReflectionBinding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}">
-->
<!--<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Classes="h8"
Text="{ReflectionBinding Path=User.LevelStr,
Mode=OneWay,
Source={x:Static service:UserService.Current}}" />-->
<!--
<Button Margin="5,0" FontSize="10">
<ToolTip.Tip>
<MultiBinding StringFormat="{}{0} : {1} / {2}">
<Binding Path="Res.User_Experience" Source="{x:Static s:ResourceService.Current}" />
<Binding Path="User.Experience" Source="{x:Static s:UserService.Current}" />
<Binding Path="User.NextExperience" Source="{x:Static s:UserService.Current}" />
</MultiBinding>
</ToolTip.Tip>
<Button.Content>
<MultiBinding StringFormat="{}{0} : Lv.{1}">
<Binding Path="Res.User_Level" Source="{x:Static s:ResourceService.Current}" />
<Binding Path="User.Level" Source="{x:Static s:UserService.Current}" />
</MultiBinding>
</Button.Content>
</Button>
<Button
Margin="5,0"
Command="{ReflectionBinding Path=SignIn,
Mode=OneWay,
Source={x:Static s:UserService.Current}}"
Content="{ReflectionBinding Path=Res.Sign,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
FontSize="10"
IsVisible="{ReflectionBinding Path=!User.IsSignIn,
Mode=OneWay,
Source={x:Static s:UserService.Current},
Converter={StaticResource IsNullConverter}}"
Text="{ReflectionBinding Path=Res.User_UnLogin,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
<StackPanel VerticalAlignment="Center" IsVisible="{ReflectionBinding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}">
<TextBlock Text="{ReflectionBinding Path=User.NickName, Mode=OneWay, Source={x:Static s:UserService.Current}}" />
<Border VerticalAlignment="Center" IsVisible="{ReflectionBinding Path=User.UserType, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource EnumEqualValueConverter}, ConverterParameter={x:Static enum:UserType.Sponsor}}">
<TextBlock FontSize="10" Text="{ReflectionBinding Path=Res.User_Sponsor, Mode=OneWay, Source={x:Static s:ResourceService.Current}, StringFormat={}{0}}" />
</Border>
</StackPanel>
</Panel>
Source={x:Static s:UserService.Current}}" />
<Button
Margin="5,0"
FontSize="10"
IsVisible="{ReflectionBinding Path=User.IsSignIn,
Mode=OneWay,
Source={x:Static s:UserService.Current}}"
ToolTip.Tip="{ReflectionBinding Path=Res.Signed,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<Button.Content>
<MultiBinding StringFormat="{}{0} : {1}">
<Binding Path="Res.User_EngineOil" Source="{x:Static s:ResourceService.Current}" />
<Binding Path="User.Balance" Source="{x:Static s:UserService.Current}" />
</MultiBinding>
</Button.Content>
</Button>
</WrapPanel>-->
</DockPanel>
</MenuItem.Header>
</MenuItem>
@@ -260,19 +260,17 @@ partial class ProxyService
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool OnStartedShowToastReturnProxyStatus()
{
string? text;
bool proxyStatus;
if (string.IsNullOrWhiteSpace(Error))
{
text = Strings.CommunityFix_StartProxySuccess;
Toast.Show(ToastIcon.Success, Strings.CommunityFix_StartProxySuccess);
proxyStatus = true;
}
else
{
text = Error;
Toast.Show(ToastIcon.Error, Error);
proxyStatus = false;
}
Toast.Show(text);
return proxyStatus;
}
@@ -282,7 +280,7 @@ partial class ProxyService
bool proxyStatus = default;
if (!string.IsNullOrWhiteSpace(Error))
{
Toast.Show(Error);
Toast.Show(ToastIcon.Error, Error);
proxyStatus = true;
}
return proxyStatus;
@@ -239,7 +239,7 @@ public sealed partial class ProxyService
{
if (ProxySettings.SupportProxyServicesStatus.Value.Contains(item.Id.ToString()))
{
item.Checked = true;
item.ThreeStateEnable = true;
}
}
}
@@ -249,13 +249,13 @@ public sealed partial class ProxyService
LoadOrSaveLocalAccelerate();
if (IsLoadImage && ProxyDomains.Items.Any_Nullable())
{
foreach (var item in ProxyDomains.Items)
{
//item.ImageStream = ImageChannelType.AccelerateGroup.GetImageAsync(ImageUrlHelper.GetImageApiUrlById(item.ImageId));
}
}
//if (IsLoadImage && ProxyDomains.Items.Any_Nullable())
//{
// foreach (var item in ProxyDomains.Items)
// {
// item.ImageStream = ImageChannelType.AccelerateGroup.GetImageAsync(ImageUrlHelper.GetImageApiUrlById(item.ImageId));
// }
//}
this.WhenAnyValue(v => v.ProxyDomainsList)
.Subscribe(domain => domain?
@@ -281,7 +281,7 @@
<ItemsControl ItemsSource="{ReflectionBinding Source={x:Static s:ProxyService.Current}, Path=ProxyDomainsList, Mode=OneWay}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" Spacing="10" />
<StackPanel Orientation="Vertical" Spacing="{StaticResource SettingsSpacing}" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
@@ -4,7 +4,7 @@ namespace BD.WTTS.UI.ViewModels;
public sealed partial class GameAccountPageViewModel : TabItemViewModel
{
readonly Uri PlatformsPath = new("avares://BD.WTTS.Client.Plugins.GameAccount/UI/Assets/Platforms.json");
readonly static Uri PlatformsPath = new("avares://BD.WTTS.Client.Plugins.GameAccount/UI/Assets/Platforms.json");
public override string Name => Strings.Welcome;
@@ -35,7 +35,9 @@
MaxWidth="128"
Classes="Vertical"
Description="{Binding LastLoginTime}"
Status="最近登录">
Status="{ReflectionBinding Path=Res.UserChange_RecentLogin,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<spp:AppItem.ContextFlyout>
<ui:FAMenuFlyout>
<ui:MenuFlyoutItem
@@ -74,7 +76,7 @@
<ui:MenuFlyoutItem Text="Achievement Stats" />
<ui:MenuFlyoutItem Text="Backpack.tf" />
</ui:MenuFlyoutSubItem>
<ui:MenuFlyoutItem Text="修改头像图片" />
<ui:MenuFlyoutItem IsVisible="{ReflectionBinding !#u.DataContext.IsSteamPlatform}" Text="修改头像图片" />
<ui:MenuFlyoutSeparator />
<ui:MenuFlyoutItem Text="创建桌面快捷方式" />
<ui:MenuFlyoutItem IsVisible="{ReflectionBinding #u.DataContext.IsSteamPlatform}" Text="打开 userdata 文件夹" />
@@ -92,7 +92,7 @@
Width="16"
Height="16"
HorizontalAlignment="Left">
<ui:SymbolIcon Symbol="Save" />
<ui:SymbolIcon Symbol="ShareAndroid" />
</Viewbox>
<TextBlock
Margin="28,4,0,4"
@@ -125,7 +125,7 @@
</Panel>
</Button>
<DropDownButton
Padding="8,4"
Padding="8"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{StaticResource More}"
@@ -31,7 +31,7 @@ public partial class GameAccountPage : PageBase<GameAccountPageViewModel>
var cancel = !File.Exists(ViewModel.SelectedPlatform.PlatformSetting?.PlatformPath);
if (cancel)
{
Toast.Show($"{ViewModel.SelectedPlatform.FullName} 平台路径没有正确选择");
Toast.Show(ToastIcon.Error, $"{ViewModel.SelectedPlatform.FullName} 平台路径没有正确选择");
}
return cancel;
});
@@ -56,14 +56,14 @@ public partial class GameAccountPage : PageBase<GameAccountPageViewModel>
var cancel = !File.Exists(platform.PlatformSetting?.PlatformPath);
if (cancel)
{
Toast.Show($"{platform.FullName} 平台路径没有正确选择");
Toast.Show(ToastIcon.Error, $"{platform.FullName} 平台路径没有正确选择");
}
return cancel;
}))
{
if (!File.Exists(platform.PlatformSetting?.PlatformPath))
{
Toast.Show($"路径没有正确选择,{platform.FullName} 平台账号切换功能无法使用");
Toast.Show(ToastIcon.Error, $"路径没有正确选择,{platform.FullName} 平台账号切换功能无法使用");
}
}
}
@@ -158,7 +158,7 @@
<TextBlock
Grid.Row="2"
VerticalAlignment="Center"
Text="{Binding SteamApps.Count, Converter={StaticResource StringFormatConverter}, ConverterParameter='已找到 {0} 个应用'}"
Text="{Binding SteamApps.Count, Converter={StaticResource StringFormatConverter}, ConverterParameter=GameList_FindAppsText}"
Theme="{StaticResource CaptionTextBlockStyle}" />
<AutoCompleteBox
+9
View File
@@ -2318,6 +2318,15 @@ namespace BD.WTTS.Client.Resources {
}
}
/// <summary>
/// 查找类似 已找到 {0} 个应用 的本地化字符串。
/// </summary>
public static string GameList_FindAppsText {
get {
return ResourceManager.GetString("GameList_FindAppsText", resourceCulture);
}
}
/// <summary>
/// 查找类似 全部选中 的本地化字符串。
/// </summary>
@@ -2448,5 +2448,8 @@ AAAAA-BBBBB-CCCC3</value>
</data>
<data name="Plugin_Store" xml:space="preserve">
<value>插件商店</value>
</data>
<data name="GameList_FindAppsText" xml:space="preserve">
<value>已找到 {0} 个应用</value>
</data>
</root>
@@ -15,6 +15,32 @@ public sealed class UserService : ReactiveObject
readonly ISteamworksWebApiService steamworksWebApiService = ISteamworksWebApiService.Instance;
readonly IWindowManager windowManager = IWindowManager.Instance;
[Reactive]
public IdentityUserInfoDTO? User { get; set; }
/// <summary>
/// 指示当前用户是否已通过身份验证(已登录)
/// </summary>
public bool IsAuthenticated => User != null;
[Reactive]
public SteamUser? CurrentSteamUser { get; set; }
[Reactive]
public object? AvatarPath { get; set; }
/// <summary>
/// 当前登录用户是否有手机号码
/// </summary>
[Reactive]
public bool HasPhoneNumber { get; set; }
/// <summary>
/// 用于 UI 显示的当前登录用户的手机号码(隐藏中间四位)
/// </summary>
[Reactive]
public string PhoneNumber { get; set; } = string.Empty;
public async void ShowWindow()
{
var cUser = await userManager.GetCurrentUserAsync();
@@ -102,25 +128,6 @@ public sealed class UserService : ReactiveObject
await userManager.SignOutAsync();
}
[Reactive]
public IdentityUserInfoDTO? User { get; set; }
/// <summary>
/// 指示当前用户是否已通过身份验证(已登录)
/// </summary>
public bool IsAuthenticated => User != null;
[Reactive]
public SteamUser? CurrentSteamUser { get; set; }
object? _AvatarPath;
public object? AvatarPath
{
get => _AvatarPath;
set => this.RaiseAndSetIfChanged(ref _AvatarPath, value);
}
private UserService()
{
mCurrent = this;
@@ -143,23 +150,6 @@ public sealed class UserService : ReactiveObject
await RefreshUserAsync();
}
[Reactive]
/// <summary>
/// 当前登录用户是否有手机号码
/// </summary>
public bool HasPhoneNumber { get; set; }
string _PhoneNumber = string.Empty;
/// <summary>
/// 用于 UI 显示的当前登录用户的手机号码(隐藏中间四位)
/// </summary>
public string PhoneNumber
{
get => _PhoneNumber;
set => this.RaiseAndSetIfChanged(ref _PhoneNumber, value);
}
static string GetCurrentUserPhoneNumber(CurrentUser? user, bool notHideMiddleFour = false)
{
var phone_number = user?.PhoneNumber;