在 `EditorWin.xaml.cs` 中: - 添加了 `System.Text.Encodings.Web` 和 `System.Text.Json` 的引用。 - 在 `TreeView_AddTabItem` 方法中,添加了对 `title` 为空的检查。 - 将 `UpdateUI` 事件替换为 `SavePointLeft` 事件。 - 将 `KeyDown` 事件替换为 `PreviewKeyDown` 事件。 - 添加了对 `Ctrl + Alt + L` 快捷键的处理,用于格式化 JSON 文本。 在 `RustTools.csproj` 中: - 更新了多个包的版本,包括 `CommunityToolkit.Mvvm`、`Microsoft.Extensions.Hosting`、`Microsoft.WindowsAppSDK`、`System.Management` 和 `WinUIEx`。 - 移除了 `Microsoft.Windows.CsWinRT` 包的引用。 - 添加了 `CommunityToolkit.WinUI.Controls.Sizers` 包的引用。 在 `ButtonViewModel.cs` 中: - 移除了 `ButtonViewModel` 类及其内容。 在 `RankingViewModel.cs` 中: - 在 `RankingList` 为空时,添加了对 `modData` 和 `modData.Data` 为空的检查。 - 更新了 `item.Icon` 的替换逻辑。 在 `UserPage.xaml.cs` 中: - 在用户登录逻辑中,添加了对 `userSpaceInfo` 为空的检查。
38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using System.Collections.ObjectModel;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using Newtonsoft.Json;
|
|
using RustTools.muqing;
|
|
|
|
namespace RustTools.ViewModels;
|
|
|
|
public partial class RankingViewModel : ObservableRecipient
|
|
{
|
|
public ObservableCollection<ModListResponse.ModData>? RankingList { get; set; } = new();
|
|
public RankingViewModel()
|
|
{
|
|
Init();
|
|
}
|
|
private void Init()
|
|
{
|
|
ListTab("downloadNumber");
|
|
}
|
|
|
|
public async void ListTab(string tab)
|
|
{
|
|
RankingList?.Clear();
|
|
//List必须小于10才能重新加载
|
|
var StringList = await ApiFox.mod.list(tab, "10", string.Empty);
|
|
var modData = JsonConvert.DeserializeObject<ModListResponse>(StringList);
|
|
if (modData != null && modData.Data != null)
|
|
{
|
|
foreach (var item in modData.Data)
|
|
{
|
|
item.Icon = item.Icon.Equals("") ? "/Assets/image/image.svg" : item.Icon.Replace("..", wl.api);
|
|
RankingList?.Add(item);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|