This commit is contained in:
Administrator committed 2026-05-09 02:07:19 +08:00
commit 0a1f94e644
8 files changed
+50 -48

No files matched your search

+10 -5
View File
@@ -22,17 +22,22 @@ namespace SunlightAggregationTerminal
await Navigation.PushModalAsync(new NavigationPage(logpage));
}
else
{
//发送登录请求
TcpServer.Configuration(App.GlobalData.ServerID,
App.GlobalData.User, App.GlobalData.UserPassword,
Models.AppModels.GetAppUniqueId());
{
var loading = new View.Loading();
await Navigation.PushModalAsync(loading);
if (await AppModels.LogIn())
{//拒绝登陆时打开登录页面
await loading.Navigation.PopModalAsync();
}
else
{
await loading.Navigation.PopModalAsync();
var logpage = new View.LogPage();
await Navigation.PushModalAsync(logpage);
}
}
}
}
+6 -3
View File
@@ -40,7 +40,7 @@ namespace SunlightAggregationTerminal.Models
App.GlobalData.DarkMode = Convert.ToBoolean(dat.Field<object>("DarkMode"));
App.GlobalData.MessageNotificationMode = Convert.ToBoolean(dat.Field<object>("MessageNotificationMode"));
TcpServer.Configuration(App.GlobalData.ServerID, App.GlobalData.User, App.GlobalData.UserPassword, dat.Field<string>("GUID") ?? "Not");
// TcpServer.Configuration(App.GlobalData.ServerID, App.GlobalData.User, App.GlobalData.UserPassword, dat.Field<string>("GUID") ?? "Not");
}
//启动tcp
// TcpServer.CreateCustomService();
@@ -76,7 +76,10 @@ namespace SunlightAggregationTerminal.Models
{
App.GlobalData.LogNo = false;
//发生登录请求
//发送登录请求
TcpServer.Configuration(App.GlobalData.ServerID,
App.GlobalData.User, App.GlobalData.UserPassword,
Models.AppModels.GetAppUniqueId());
// 创建一个 15 秒的延时任务
Task delayTask = Task.Delay(15000);
@@ -86,7 +89,7 @@ namespace SunlightAggregationTerminal.Models
while (!App.GlobalData.LogNo)
{
// 每隔 100 毫秒检查一次,避免 CPU 占用过高
await Task.Delay(100);
await Task.Delay(1000);
}
});
// 使用 Task.WhenAny 等待任意一个任务完成
+2 -2
View File
@@ -116,10 +116,10 @@
<MauiXaml Update="ScanPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="View\LogPage.xaml">
<MauiXaml Update="View\Loading.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="View\LogWindow.xaml">
<MauiXaml Update="View\LogPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>
+21
View File
@@ -0,0 +1,21 @@
<?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.View.Loading"
Title="Loading">
<Grid x:Name="LoadingIndicator" BackgroundColor="Gray"
IsVisible="True" Opacity="0.9">
<VerticalStackLayout Padding="30" Spacing="10"
VerticalOptions="Center"
HorizontalOptions="Center">
<ActivityIndicator IsRunning="True"
Color="#512BD4"
HorizontalOptions="Center"
VerticalOptions="Center" />
<Label Text="等待中..."
FontAttributes="Bold"
FontSize="24"
TextColor="Black"/>
</VerticalStackLayout>
</Grid>
</ContentPage>
+9
View File
@@ -0,0 +1,9 @@
namespace SunlightAggregationTerminal.View;
public partial class Loading : ContentPage
{
public Loading()
{
InitializeComponent();
}
}
+2 -2
View File
@@ -74,8 +74,8 @@ public partial class LogPage : ContentPage
private async void Log_Clicked(object sender, EventArgs e)//登录
{
TcpServer.Configuration(SERVERIP.Text, UsernameEntry.Text, PasswordEntry.Text,
Models.AppModels.GetAppUniqueId());
//TcpServer.Configuration(SERVERIP.Text, UsernameEntry.Text, PasswordEntry.Text,
// Models.AppModels.GetAppUniqueId());
LoadingIndicator.IsVisible = true;
-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Window xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="SunlightAggregationTerminal.View.LogWindow"
Title="LogWindow">
<ContentPage>
<!-- 登录按钮 -->
<Button Text="登 录"
BackgroundColor="#512BD4"
TextColor="White"
HeightRequest="50"
WidthRequest="100"
CornerRadius="10"
Margin="0,10,0,0"/>
</ContentPage>
</Window>
-19
View File
@@ -1,19 +0,0 @@
namespace SunlightAggregationTerminal.View;
public partial class LogWindow : Window
{
public LogWindow()
{
InitializeComponent();
Page = new ContentPage()
{
Content = new VerticalStackLayout
{
Children = {
new Label { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Text = "Welcome to .NET MAUI!"
}
}
}
};
}
}