添加添加数据库服务器表

修改扫码连接修复扫码闪退问题
This commit is contained in:
sc authored and sc committed 2026-05-02 12:47:17 +08:00
1 parent 6c0af56ea9
commit 0801e4875c
64 files changed
+3265

No files matched your search

+39
View File
@@ -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>
+42
View File
@@ -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)
{
}
}
+39
View File
@@ -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>
+43
View File
@@ -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)
{
}
}
+39
View File
@@ -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>
+42
View File
@@ -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)
{
}
}