diff --git a/v2rayN/ServiceLib/Models/ProfileItem.cs b/v2rayN/ServiceLib/Models/ProfileItem.cs index 58e9414a..67c36d8e 100644 --- a/v2rayN/ServiceLib/Models/ProfileItem.cs +++ b/v2rayN/ServiceLib/Models/ProfileItem.cs @@ -1,9 +1,10 @@ +using ReactiveUI; using SQLite; namespace ServiceLib.Models; [Serializable] -public class ProfileItem +public class ProfileItem: ReactiveObject { public ProfileItem() { diff --git a/v2rayN/ServiceLib/Models/ProfileItemModel.cs b/v2rayN/ServiceLib/Models/ProfileItemModel.cs index a1e81ca2..40ba3f1d 100644 --- a/v2rayN/ServiceLib/Models/ProfileItemModel.cs +++ b/v2rayN/ServiceLib/Models/ProfileItemModel.cs @@ -1,3 +1,5 @@ +using ReactiveUI.Fody.Helpers; + namespace ServiceLib.Models; [Serializable] @@ -5,13 +7,28 @@ public class ProfileItemModel : ProfileItem { public bool IsActive { get; set; } public string SubRemarks { get; set; } + + [Reactive] public int Delay { get; set; } + public decimal Speed { get; set; } public int Sort { get; set; } + + [Reactive] public string DelayVal { get; set; } + + [Reactive] public string SpeedVal { get; set; } + + [Reactive] public string TodayUp { get; set; } + + [Reactive] public string TodayDown { get; set; } + + [Reactive] public string TotalUp { get; set; } + + [Reactive] public string TotalDown { get; set; } } diff --git a/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs b/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs index a955a9aa..f312b890 100644 --- a/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs @@ -304,7 +304,7 @@ public class ProfilesViewModel : MyReactiveObject { item.SpeedVal = result.Speed ?? string.Empty; } - _profileItems.Replace(item, JsonUtils.DeepCopy(item)); + //_profileItems.Replace(item, JsonUtils.DeepCopy(item)); } public void UpdateStatistics(ServerSpeedItem update) @@ -319,16 +319,16 @@ public class ProfilesViewModel : MyReactiveObject item.TotalDown = Utils.HumanFy(update.TotalDown); item.TotalUp = Utils.HumanFy(update.TotalUp); - if (SelectedProfile?.IndexId == item.IndexId) - { - var temp = JsonUtils.DeepCopy(item); - _profileItems.Replace(item, temp); - SelectedProfile = temp; - } - else - { - _profileItems.Replace(item, JsonUtils.DeepCopy(item)); - } + //if (SelectedProfile?.IndexId == item.IndexId) + //{ + // var temp = JsonUtils.DeepCopy(item); + // _profileItems.Replace(item, temp); + // SelectedProfile = temp; + //} + //else + //{ + // _profileItems.Replace(item, JsonUtils.DeepCopy(item)); + //} } } catch