diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/SteamAccountPage.axaml b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/SteamAccountPage.axaml index 38111d931..2e9ea3cad 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/SteamAccountPage.axaml +++ b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/SteamAccountPage.axaml @@ -108,11 +108,11 @@ - @@ -120,23 +120,24 @@ - - - - - + + + diff --git a/src/ST.Client.Desktop/Models/Settings2/SteamAccountSettings.cs b/src/ST.Client.Desktop/Models/Settings2/SteamAccountSettings.cs index c626c12fd..819a475f8 100644 --- a/src/ST.Client.Desktop/Models/Settings2/SteamAccountSettings.cs +++ b/src/ST.Client.Desktop/Models/Settings2/SteamAccountSettings.cs @@ -1,4 +1,5 @@ using System.Application.Serialization; +using System.Collections.Concurrent; using System.Collections.Generic; using Compat = System.Application.Models.Settings.GameLibrarySettings; @@ -9,8 +10,8 @@ namespace System.Application.Models.Settings /// /// Steam账号备注字典 /// - public static SerializableProperty> AccountRemarks { get; } - = Compat.GetProperty(defaultValue: (IReadOnlyDictionary?)null, autoSave: false); + public static SerializableProperty> AccountRemarks { get; } + = Compat.GetProperty(defaultValue: new ConcurrentDictionary(), autoSave: false); // ----- AccountRemarks ClassName 之前用的 GameLibrarySettings 需要兼容已发行的版本,将错就错,之后新增的还是使用 GetProperty 而不是 Compat.GetProperty ----- } diff --git a/src/ST.Client.Desktop/UI/Resx/AppResources.Designer.cs b/src/ST.Client.Desktop/UI/Resx/AppResources.Designer.cs index 71882959a..ec73e4948 100644 --- a/src/ST.Client.Desktop/UI/Resx/AppResources.Designer.cs +++ b/src/ST.Client.Desktop/UI/Resx/AppResources.Designer.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // 此代码由工具生成。 // 运行时版本:4.0.30319.42000 @@ -4169,7 +4169,7 @@ namespace System.Application.UI.Resx { } /// - /// 查找类似 点此修改备注 的本地化字符串。 + /// 查找类似 修改账号备注 的本地化字符串。 /// public static string UserChange_EditRemark { get { diff --git a/src/ST.Client.Desktop/UI/Resx/AppResources.resx b/src/ST.Client.Desktop/UI/Resx/AppResources.resx index 194cf61cf..4d22289c7 100644 --- a/src/ST.Client.Desktop/UI/Resx/AppResources.resx +++ b/src/ST.Client.Desktop/UI/Resx/AppResources.resx @@ -1254,7 +1254,7 @@ 确定要删除这条本地记录帐户吗? - 点此修改备注 + 修改账号备注 登录新 Steam 账号 diff --git a/src/ST.Client.Desktop/UI/ViewModels/Pages/SteamAccountPageViewModel.cs b/src/ST.Client.Desktop/UI/ViewModels/Pages/SteamAccountPageViewModel.cs index 983c25611..913bb7700 100644 --- a/src/ST.Client.Desktop/UI/ViewModels/Pages/SteamAccountPageViewModel.cs +++ b/src/ST.Client.Desktop/UI/ViewModels/Pages/SteamAccountPageViewModel.cs @@ -137,15 +137,15 @@ namespace System.Application.UI.ViewModels _SteamUsersSourceList.Refresh(); - this.WhenAnyValue(x => x.SteamUsers) - .Subscribe(items => items? - .ToObservableChangeSet() - .AutoRefresh(x => x.Remark) - .WhenValueChanged(x => x.Remark, false) - .Subscribe(_ => - { - SteamAccountSettings.AccountRemarks.Value = items?.Where(x => !string.IsNullOrEmpty(x.Remark)).ToDictionary(k => k.SteamId64, v => v.Remark); - })); + //this.WhenAnyValue(x => x.SteamUsers) + // .Subscribe(items => items? + // .ToObservableChangeSet() + // .AutoRefresh(x => x.Remark) + // .WhenValueChanged(x => x.Remark, false) + // .Subscribe(_ => + // { + // SteamAccountSettings.AccountRemarks.Value = items?.Where(x => !string.IsNullOrEmpty(x.Remark)).ToDictionary(k => k.SteamId64, v => v.Remark); + // })); } public void SteamId_Click(SteamUser user) @@ -215,5 +215,20 @@ namespace System.Application.UI.ViewModels } }); } + + public async void EditRemarkAsync(SteamUser user) + { + var value = await TextBoxWindowViewModel.ShowDialogAsync(new() + { + Value = user.Remark, + Title = AppResources.UserChange_EditRemark, + }); + if (value == null) + return; + user.Remark = value; + + SteamAccountSettings.AccountRemarks.Value!.AddOrUpdate(user.SteamId64, user.Remark, (oldkey, oldvalue) => user.Remark); + SteamAccountSettings.AccountRemarks.RaiseValueChanged(); + } } } \ No newline at end of file diff --git a/src/ST.Client.Mobile.iOS.App/ST.Client.Mobile.iOS.App.csproj b/src/ST.Client.Mobile.iOS.App/ST.Client.Mobile.iOS.App.csproj index 433b31a21..5259a6689 100644 --- a/src/ST.Client.Mobile.iOS.App/ST.Client.Mobile.iOS.App.csproj +++ b/src/ST.Client.Mobile.iOS.App/ST.Client.Mobile.iOS.App.csproj @@ -1,4 +1,4 @@ - + Debug @@ -115,4 +115,4 @@ - + \ No newline at end of file