添加项目文件。
This commit is contained in:
1 parent
6c0af56ea9
commit
54eaa8a836
64 files changed
+3176
No files matched your search
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SunlightAggregationTerminal.NotificationView.MessagePage"
|
||||
Title="信息">
|
||||
<CollectionView x:Name="CardCollectionView"
|
||||
ItemsSource="{Binding MessageItems}"
|
||||
RemainingItemsThreshold="5"
|
||||
RemainingItemsThresholdReached="CardCollectionView_RemainingItemsThresholdReached">
|
||||
<!-- 保持滚动条 -->
|
||||
<CollectionView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<!-- 这里定义单个卡片的 UI 结构 -->
|
||||
<Border BackgroundColor="White"
|
||||
Stroke="#CCCCCC"
|
||||
StrokeThickness="1"
|
||||
Margin="10,0,10,10"
|
||||
StrokeShape="RoundRectangle 10">
|
||||
<Grid Padding="15">
|
||||
<VerticalStackLayout>
|
||||
<Label Text="{Binding Title}"
|
||||
FontAttributes="Bold"
|
||||
FontSize="22"
|
||||
TextColor="Black"/>
|
||||
<Label Text="{Binding Time}"
|
||||
FontSize="14"
|
||||
TextColor="Black"
|
||||
LineBreakMode="WordWrap"/>
|
||||
<Label Text="{Binding Content}"
|
||||
FontSize="16"
|
||||
TextColor="Gray"
|
||||
LineBreakMode="WordWrap"/>
|
||||
</VerticalStackLayout>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
</ContentPage>
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SunlightAggregationTerminal.NotificationView.NoticePage"
|
||||
Title="通知">
|
||||
<CollectionView x:Name="CardCollectionView"
|
||||
ItemsSource="{Binding NoticeItems}"
|
||||
RemainingItemsThreshold="5"
|
||||
RemainingItemsThresholdReached="CardCollectionView_RemainingItemsThresholdReached">
|
||||
<!-- 保持滚动条 -->
|
||||
<CollectionView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<!-- 这里定义单个卡片的 UI 结构 -->
|
||||
<Border BackgroundColor="White"
|
||||
Stroke="#CCCCCC"
|
||||
StrokeThickness="1"
|
||||
Margin="10,0,10,10"
|
||||
StrokeShape="RoundRectangle 10">
|
||||
<Grid Padding="15">
|
||||
<VerticalStackLayout>
|
||||
<Label Text="{Binding Title}"
|
||||
FontAttributes="Bold"
|
||||
FontSize="22"
|
||||
TextColor="Black"/>
|
||||
<Label Text="{Binding Time}"
|
||||
FontSize="14"
|
||||
TextColor="Black"
|
||||
LineBreakMode="WordWrap"/>
|
||||
<Label Text="{Binding Content}"
|
||||
FontSize="16"
|
||||
TextColor="Gray"
|
||||
LineBreakMode="WordWrap"/>
|
||||
</VerticalStackLayout>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
</ContentPage>
|
||||
@@ -0,0 +1,43 @@
|
||||
using Microsoft.Maui.Controls.Shapes;
|
||||
using SunlightAggregationTerminal.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Data;
|
||||
|
||||
namespace SunlightAggregationTerminal.NotificationView;
|
||||
|
||||
public partial class NoticePage : ContentPage
|
||||
{
|
||||
public ObservableCollection<NotificationItem> NoticeItems { get; set; } = new();
|
||||
public NoticePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.BindingContext = this;
|
||||
LoadData(); // 加载数据
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
// 假设这是你获取数据的地方
|
||||
var allData = DataService._NotificationData;
|
||||
if (allData != null)
|
||||
{
|
||||
// 清空旧数据
|
||||
NoticeItems.Clear();
|
||||
|
||||
// 按时间倒序,并只取最新的 N 条(例如 50 条)
|
||||
var itemsToShow = allData.OrderByDescending(x => x.Time).Take(50).Where(x => x.Type == MsgType.Notice);
|
||||
|
||||
// 将数据添加到集合中,UI 会自动更新
|
||||
foreach (var item in itemsToShow)
|
||||
{
|
||||
NoticeItems.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CardCollectionView_RemainingItemsThresholdReached(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SunlightAggregationTerminal.NotificationView.SystemPage"
|
||||
Title="系统信息">
|
||||
<CollectionView x:Name="CardCollectionView"
|
||||
ItemsSource="{Binding SystemItems}"
|
||||
RemainingItemsThreshold="5"
|
||||
RemainingItemsThresholdReached="CardCollectionView_RemainingItemsThresholdReached">
|
||||
<!-- 保持滚动条 -->
|
||||
<CollectionView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<!-- 这里定义单个卡片的 UI 结构 -->
|
||||
<Border BackgroundColor="White"
|
||||
Stroke="#CCCCCC"
|
||||
StrokeThickness="1"
|
||||
Margin="10,0,10,10"
|
||||
StrokeShape="RoundRectangle 10">
|
||||
<Grid Padding="15">
|
||||
<VerticalStackLayout>
|
||||
<Label Text="{Binding Title}"
|
||||
FontAttributes="Bold"
|
||||
FontSize="22"
|
||||
TextColor="Black"/>
|
||||
<Label Text="{Binding Time}"
|
||||
FontSize="14"
|
||||
TextColor="Black"
|
||||
LineBreakMode="WordWrap"/>
|
||||
<Label Text="{Binding Content}"
|
||||
FontSize="16"
|
||||
TextColor="Gray"
|
||||
LineBreakMode="WordWrap"/>
|
||||
</VerticalStackLayout>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
</ContentPage>
|
||||
@@ -0,0 +1,42 @@
|
||||
using Microsoft.Maui.Controls.Shapes;
|
||||
using SunlightAggregationTerminal.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace SunlightAggregationTerminal.NotificationView;
|
||||
|
||||
public partial class SystemPage : ContentPage
|
||||
{
|
||||
public ObservableCollection<NotificationItem> SystemItems { get; set; } = new();
|
||||
public SystemPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.BindingContext = this;
|
||||
LoadData(); // 加载数据
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
// 假设这是你获取数据的地方
|
||||
var allData = DataService._NotificationData;
|
||||
if (allData != null)
|
||||
{
|
||||
// 清空旧数据
|
||||
SystemItems.Clear();
|
||||
|
||||
// 按时间倒序,并只取最新的 N 条(例如 50 条)
|
||||
var itemsToShow = allData.OrderByDescending(x => x.Time).Take(50).Where(x => x.Type == MsgType.System);
|
||||
|
||||
// 将数据添加到集合中,UI 会自动更新
|
||||
foreach (var item in itemsToShow)
|
||||
{
|
||||
SystemItems.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CardCollectionView_RemainingItemsThresholdReached(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user