2026-01-23 15:46:13 +08:00

90 lines
3.6 KiB
XML

<?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="NFCLockDemoV2.MainPage"
xmlns:viewModels="clr-namespace:NFCLockDemoV2.ViewModels"
xmlns:converter="clr-namespace:NFCLockDemoV2.Converters"
Shell.TabBarIsVisible="False"
Shell.NavBarIsVisible="False">
<!--<ContentPage.BindingContext>
<viewModels:MainViewModel></viewModels:MainViewModel>
</ContentPage.BindingContext>-->
<ContentPage.Resources>
<converter:PercentageConverter x:Key="PercentageConverter"></converter:PercentageConverter>
<converter:OperationColorConverter x:Key="OperationColorConverter"></converter:OperationColorConverter>
</ContentPage.Resources>
<VerticalStackLayout
Padding="16"
Spacing="16">
<!-- 圆形进度指示器和状态 -->
<Grid RowDefinitions="Auto,Auto"
HorizontalOptions="Center"
Margin="0,200,0,0"
>
<ProgressBar
Progress="{Binding ArcProgress, Converter={StaticResource PercentageConverter}}"
WidthRequest="200"
ProgressColor="#00BCD4"
HorizontalOptions="Center"
VerticalOptions="Center" />
<Label Grid.Row="1"
Text="{Binding DeviceStatus}"
FontSize="18"
FontAttributes="Bold"
HorizontalOptions="Center"
VerticalOptions="Center"
HorizontalTextAlignment="Center" />
</Grid>
<!-- 设备信息 -->
<Label
Text="{Binding DeviceId, StringFormat='设备 ID: {0}'}"
FontSize="16"
HorizontalOptions="Center" />
<Label
Text="{Binding DeviceRssi, StringFormat='RSSI: {0}'}"
FontSize="16"
HorizontalOptions="Center" />
<!-- 密码输入框 -->
<Entry
Text="{Binding Password}"
Placeholder="输入密码"
Keyboard="Numeric"
MaxLength="6"
HorizontalOptions="Fill" />
<!-- 开锁按钮 -->
<Button
Text="开锁"
Command="{Binding ControlCommand}"
CommandParameter="Unlock"
BackgroundColor="{Binding Operation, Converter={StaticResource OperationColorConverter}, ConverterParameter=UNLOCK}"
TextColor="Black"
Clicked="UnlockClicked"
HorizontalOptions="Fill" />
<!-- 关锁按钮 -->
<Button
Text="关锁"
Command="{Binding ControlCommand}"
CommandParameter="Lock"
BackgroundColor="{Binding Operation, Converter={StaticResource OperationColorConverter}, ConverterParameter=LOCK}"
TextColor="Black"
Clicked="LockClicked"
HorizontalOptions="Fill" />
<!--~1~ 设置密码按钮 @1@
<Button
Text="设置密码"
Command=""
BackgroundColor="{Binding Operation, Converter={StaticResource OperationColorConverter}, ConverterParameter=SET_PASSWORD}"
TextColor="Black"
HorizontalOptions="Fill" />-->
</VerticalStackLayout>
</ContentPage>