2024-12-06 01:26:57 +00:00
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
using System.Diagnostics;
|
2024-08-03 11:49:28 +00:00
|
|
|
|
using Microsoft.UI.Xaml;
|
|
|
|
|
using Microsoft.UI.Xaml.Controls;
|
2024-12-06 01:26:57 +00:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using RustTools.DataList;
|
2024-08-03 11:49:28 +00:00
|
|
|
|
using RustTools.muqing;
|
|
|
|
|
using RustTools.ViewModels;
|
|
|
|
|
|
|
|
|
|
// To learn more about WinUI, the WinUI project structure,
|
|
|
|
|
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
|
|
|
|
|
|
|
|
|
namespace RustTools.Views;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed partial class ConcernPage : Page
|
|
|
|
|
{
|
2024-08-15 01:40:33 +00:00
|
|
|
|
public ConcernViewModel ViewModels
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
2025-01-19 09:30:46 +00:00
|
|
|
|
public ObservableCollection<CommunityList.Data> communitylist = [];
|
|
|
|
|
public ObservableCollection<MovingInfo.DynamicRecord> MovingInfoList = [];
|
2024-12-06 01:26:57 +00:00
|
|
|
|
private bool IsLogin = false;
|
2024-08-03 11:49:28 +00:00
|
|
|
|
public ConcernPage()
|
|
|
|
|
{
|
|
|
|
|
ViewModels = App.GetService<ConcernViewModel>();
|
|
|
|
|
InitializeComponent();
|
2024-08-13 14:00:12 +00:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>½
|
2024-12-06 01:26:57 +00:00
|
|
|
|
|
|
|
|
|
Init();
|
|
|
|
|
if (IsLogin)
|
2024-08-13 14:00:12 +00:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2024-08-03 11:49:28 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-12-06 01:26:57 +00:00
|
|
|
|
private async void Init()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var ini = new IniHelper();
|
|
|
|
|
ini.Load(IniHelper.FILE.User);
|
|
|
|
|
var account = ini.GetValue(IniHelper.CODE.User, IniHelper.KEY.account);
|
|
|
|
|
var value = await ApiFox.community.getList(account, true, 0);
|
|
|
|
|
//Debug.WriteLine(value);
|
|
|
|
|
if (value == string.Empty) return;
|
|
|
|
|
var response = JsonConvert.DeserializeObject<CommunityList>(value);
|
|
|
|
|
var a = new CommunityList.Data
|
|
|
|
|
{
|
|
|
|
|
UserName = "ȫ<><C8AB>",
|
2025-01-19 09:30:46 +00:00
|
|
|
|
HeadIcon = "/Assets/tool.png",
|
|
|
|
|
Account = account
|
2024-12-06 01:26:57 +00:00
|
|
|
|
};
|
|
|
|
|
communitylist.Add(a);
|
|
|
|
|
foreach (var item in response.data)
|
|
|
|
|
{
|
|
|
|
|
//item.UserName
|
|
|
|
|
item.HeadIcon = item.HeadIcon.Replace("..", wl.api);
|
|
|
|
|
communitylist.Add(item);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-06 01:29:28 +00:00
|
|
|
|
if (ListViewA.Items.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
ListViewA.SelectedIndex = 0;
|
|
|
|
|
}
|
2024-12-06 01:26:57 +00:00
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Debug.WriteLine(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ÿ<><C3BF><EFBFBD><EFBFBD>ע<EFBFBD>Ķ<EFBFBD>̬<EFBFBD><CCAC>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
2025-01-19 09:30:46 +00:00
|
|
|
|
private void dongtaixiaoxi(string account, bool ALL)
|
2024-12-06 01:26:57 +00:00
|
|
|
|
{
|
|
|
|
|
MovingInfoList.Clear();
|
2025-01-19 09:30:46 +00:00
|
|
|
|
if (account == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
};
|
|
|
|
|
if (ALL)
|
|
|
|
|
{
|
|
|
|
|
ApiFox.Dynamic.GetAllDynamic(account).ContinueWith((task) =>
|
|
|
|
|
{
|
|
|
|
|
var value = task.Result;
|
|
|
|
|
if (string.IsNullOrEmpty(value)) return;
|
|
|
|
|
|
|
|
|
|
// ʹ<><CAB9> Newtonsoft.Json <20><><EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD>л<EFBFBD>
|
|
|
|
|
var response = JsonConvert.DeserializeObject<MovingInfo>(value);
|
|
|
|
|
|
|
|
|
|
if (response != null && response.Code == 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in response.Data)
|
|
|
|
|
{
|
|
|
|
|
// <20>滻ͷ<E6BBBB><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
|
|
|
|
item.HeadIcon = item.HeadIcon.Replace("..", wl.api);
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ӵ<EFBFBD> ObservableCollection <20><>
|
|
|
|
|
MovingInfoList.Add(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (response != null)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine($"Error: {response.Message}");
|
|
|
|
|
}
|
|
|
|
|
}, TaskScheduler.FromCurrentSynchronizationContext()); // ȷ<><C8B7>UI<55≯߳<DFB3><CCB8><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ApiFox.Dynamic.Getlist(account).ContinueWith((task) =>
|
|
|
|
|
{
|
|
|
|
|
var value = task.Result;
|
|
|
|
|
if (value == string.Empty) return;
|
|
|
|
|
var response = JsonConvert.DeserializeObject<MovingInfo>(value);
|
|
|
|
|
foreach (var item in response.Data)
|
|
|
|
|
{
|
|
|
|
|
item.HeadIcon = item.HeadIcon.Replace("..", wl.api);
|
|
|
|
|
MovingInfoList.Add(item);
|
|
|
|
|
}
|
|
|
|
|
},TaskScheduler.FromCurrentSynchronizationContext());
|
|
|
|
|
|
|
|
|
|
}
|
2024-12-06 01:26:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-08-03 11:49:28 +00:00
|
|
|
|
|
2024-08-05 11:38:55 +00:00
|
|
|
|
|
2024-08-03 11:49:28 +00:00
|
|
|
|
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var height = ActualHeight; // ȷ<><C8B7>ʹ<EFBFBD><CAB9>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD>ʵ<EFBFBD>ʸ߶<CAB8>
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
if (!double.IsNaN(height) && !double.IsInfinity(height) && height > 16)
|
|
|
|
|
{
|
2024-08-05 11:38:55 +00:00
|
|
|
|
ListViewA.Height = height - 36;
|
2024-08-03 11:49:28 +00:00
|
|
|
|
ListViewB.Height = height - 16;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ListViewA.Height = 500; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
|
|
|
|
|
ListViewB.Height = 500; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-05 11:38:55 +00:00
|
|
|
|
|
|
|
|
|
private void ItemsView_ItemInvoked(ItemsView sender, ItemsViewItemInvokedEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
gj.sc("You invoked ");
|
|
|
|
|
}
|
|
|
|
|
private void ListViewA_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// <20><>ȡ<EFBFBD><C8A1>ǰѡ<C7B0>е<EFBFBD><D0B5><EFBFBD>Ŀ
|
|
|
|
|
var selectedItem = ListViewA.SelectedItem;
|
2025-01-19 09:30:46 +00:00
|
|
|
|
var data = selectedItem as CommunityList.Data;
|
|
|
|
|
gj.sc(data?.Account);
|
|
|
|
|
dongtaixiaoxi(data?.Account, data.UserName.Equals("ȫ<><C8AB>"));
|
2024-08-05 11:38:55 +00:00
|
|
|
|
}
|
2024-08-03 11:49:28 +00:00
|
|
|
|
}
|