tcp连接逻辑

添加登录动画
This commit is contained in:
sc committed 2026-05-03 22:11:28 +08:00
commit 9abaeaf43b
6 files changed
+209 -7

No files matched your search

+17
View File
@@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="SunlightAggregationTerminal.View.LogPage"
Title="登录">
<Grid>
<VerticalStackLayout Padding="30" Spacing="10"
VerticalOptions="Center"
HorizontalOptions="Center"
@@ -75,4 +76,20 @@
Margin="0,10,0,0"
Clicked="Log_Clicked"/>
</VerticalStackLayout>
<Grid x:Name="LoadingIndicator" BackgroundColor="Gray"
IsVisible="False">
<VerticalStackLayout Padding="30" Spacing="10"
VerticalOptions="Center"
HorizontalOptions="Center">
<ActivityIndicator IsRunning="True"
Color="Blue"
HorizontalOptions="Center"
VerticalOptions="Center" />
<Label Text="登录中..."
FontAttributes="Bold"
FontSize="24"
TextColor="Black"/>
</VerticalStackLayout>
</Grid>
</Grid>
</ContentPage>
+11 -3
View File
@@ -70,10 +70,12 @@ public partial class LogPage : ContentPage
private async void Log_Clicked(object sender, EventArgs e)//登录
{
TcpServer.Configuration(SERVERIP.Text, UsernameEntry.Text, PasswordEntry.Text,
TcpServer.Configuration(SERVERIP.Text, UsernameEntry.Text, PasswordEntry.Text,
Models.AppModels.GetAppUniqueId());
if (await AppModels.LogIn())
LoadingIndicator.IsVisible = true;
if (await AppModels.LogIn())
{
var temp_name = AppModels.Select("SELECT * FROM Users WHERE User='" + UsernameEntry.Text + "' LIMIT 1;")!.Tables[0];
if (temp_name != null)
@@ -104,8 +106,14 @@ public partial class LogPage : ContentPage
App.GlobalData.ServerID + "');";
AppModels.INSERT(sql);
}
await Navigation.PopModalAsync();
}
await Navigation.PopModalAsync();
else
{
await DisplayAlertAsync("未登录", "服务器不存在或拒绝访问", "是");
}
LoadingIndicator.IsVisible = false;
}