添加添加数据库服务器表
修改扫码连接修复扫码闪退问题
This commit is contained in:
1 parent
6c0af56ea9
commit
0801e4875c
64 files changed
+3265
No files matched your search
@@ -0,0 +1,42 @@
|
||||
using Microsoft.Maui.Controls.Shapes;
|
||||
using SunlightAggregationTerminal.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace SunlightAggregationTerminal.NotificationView;
|
||||
|
||||
public partial class MessagePage : ContentPage
|
||||
{
|
||||
public ObservableCollection<NotificationItem> MessageItems { get; set; } = new();
|
||||
|
||||
public MessagePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.BindingContext = this;
|
||||
LoadData(); // 加载数据
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
// 假设这是你获取数据的地方
|
||||
var allData = DataService._NotificationData;
|
||||
if (allData != null)
|
||||
{
|
||||
// 清空旧数据
|
||||
MessageItems.Clear();
|
||||
|
||||
// 按时间倒序,并只取最新的 N 条(例如 50 条)
|
||||
var itemsToShow = allData.OrderByDescending(x => x.Time).Take(50).Where(x => x.Type == MsgType.Message);
|
||||
|
||||
// 将数据添加到集合中,UI 会自动更新
|
||||
foreach (var item in itemsToShow)
|
||||
{
|
||||
MessageItems.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CardCollectionView_RemainingItemsThresholdReached(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user