WIn_RustTools/RustTools/ViewModels/ConcernViewModel.cs

95 lines
3.8 KiB
C#
Raw Normal View History

using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using Newtonsoft.Json;
using RustTools.DataList;
using RustTools.muqing;
using Windows.System;
2024-07-14 11:24:10 +00:00
namespace RustTools.ViewModels;
public partial class ConcernViewModel : ObservableRecipient
{
public ObservableCollection<CommunityList.Data> communitylist = new();
public ObservableCollection<MovingInfo.Data> MovingInfoList = new();
private readonly string json = @"
{
""code"": 0,
""message"": ""3"",
""data"": [
{
""account"": ""offical"",
""cover"": ""../user/offical/cover.png"",
""introduce"": null,
""fans"": ""64"",
""follower"": ""5"",
""praise"": ""0"",
""userName"": """",
""headIcon"": ""http://rust.coldmint.top/user/offical/icon.png"",
""email"": ""2923268971@qq.com"",
""permission"": ""2"",
""loginTime"": ""2023-10-21 22:28:18"",
""gender"": ""1"",
""enable"": ""true"",
""dynamicColor"": ""null""
},
{
""account"": ""coldmint"",
""cover"": ""http://rust.coldmint.top/user/coldmint/covers/181d019f-7cb7-9c07-389e-5a78b98eea54.png"",
""introduce"": """",
""fans"": ""141"",
""follower"": ""13"",
""praise"": ""0"",
""userName"": ""?"",
""headIcon"": ""https://rust.coldmint.top/user/coldmint/icons/4006dc55-9101-39cc-7076-34c4b32924d5.png"",
""email"": ""cold_mint@qq.com"",
""permission"": ""1"",
""loginTime"": ""2024-08-02 22:04:48"",
""gender"": ""-1"",
""enable"": ""true"",
""dynamicColor"": ""null""
},
{
""account"": ""muqing"",
""cover"": ""../user/muqing/covers/d4083a79-1e7f-d3bc-5944-ae9bce0d6714.png"",
""introduce"": ""nihao"",
""fans"": ""1"",
""follower"": ""1"",
""praise"": ""0"",
""userName"": """",
""headIcon"": ""../user/muqing/icons/cf0582bb-584c-176f-098b-a9a95af22a44.png"",
""email"": ""2583089389@qq.com"",
""permission"": ""3"",
""loginTime"": ""2024-04-18 14:08:22"",
""gender"": ""1"",
""enable"": ""true"",
""dynamicColor"": ""null""
}
]
}";
2024-07-14 11:24:10 +00:00
public ConcernViewModel()
{
var response = JsonConvert.DeserializeObject<CommunityList>(json);
var a = new CommunityList.Data
{
UserName = "全部",
HeadIcon = "/Assets/tool.png"
};
communitylist.Add(a);
foreach (var item in response.data)
{
//item.UserName
item.HeadIcon= item.HeadIcon.Replace("..", wl.api);
communitylist.Add(item);
}
MovingInfoList.Add(new MovingInfo.Data("123123"));
MovingInfoList.Add(new MovingInfo.Data("123123"));
MovingInfoList.Add(new MovingInfo.Data("123123"));
MovingInfoList.Add(new MovingInfo.Data("123123"));
MovingInfoList.Add(new MovingInfo.Data("123123"));
MovingInfoList.Add(new MovingInfo.Data("123123"));
MovingInfoList.Add(new MovingInfo.Data("123123"));
2024-07-14 11:24:10 +00:00
}
}