Optimization and Improvement,DataGrid list only updates some attribute values
Some checks failed
release Linux / build (Release) (push) Has been cancelled
release macOS / build (Release) (push) Has been cancelled
release Windows desktop (Avalonia UI) / build (Release) (push) Has been cancelled
release Windows / build (Release) (push) Has been cancelled

https://github.com/2dust/v2rayN/issues/7489
This commit is contained in:
2dust 2025-06-26 14:23:30 +08:00
parent 3df57f74ba
commit 3e71965cd4
3 changed files with 30 additions and 12 deletions

View file

@ -1,9 +1,10 @@
using ReactiveUI;
using SQLite;
namespace ServiceLib.Models;
[Serializable]
public class ProfileItem
public class ProfileItem: ReactiveObject
{
public ProfileItem()
{

View file

@ -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; }
}

View file

@ -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