Dispenser/DispenserUI/Views/MainView.axaml

63 lines
3.4 KiB
XML

<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="1080"
Width="1920"
xmlns:converter="clr-namespace:DispenserUI.ViewModels.Converter"
xmlns:login="clr-namespace:DispenserUI.Views.Login"
xmlns:viewModels="clr-namespace:DispenserUI.ViewModels"
xmlns:controls="clr-namespace:DispenserUI.Views.Controls"
xmlns:views="clr-namespace:DispenserUI.Views"
x:DataType="viewModels:MainVM"
x:Class="DispenserUI.Views.MainView">
<Design.DataContext>
<!-- This only sets the DataContext for the previewer in an IDE,
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
<viewModels:MainVM />
</Design.DataContext>
<UserControl.Resources>
<converter:UserRoleConverter x:Key="UserRoleConverter" />
</UserControl.Resources>
<Grid>
<Grid RowDefinitions="80,*">
<!-- 上部分内容 -->
<Border Grid.Row="0" BorderBrush="LightGray" BorderThickness="0,0,0,1">
<Grid ColumnDefinitions="300,*,300" VerticalAlignment="Center">
<Image Grid.Column="0" Source="/Assets/UI/logo@2x.png" Width="202" Height="36" />
<TextBlock Grid.Column="1" Text="{Binding Now}" FontFamily="Song" FontSize="16"
TextAlignment="Center"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontWeight="500" Foreground="#0D0D12" />
<StackPanel Grid.Column="2" Orientation="Horizontal">
<TextBlock Text="{Binding Who.NickName}"
TextAlignment="Center"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontWeight="500" Foreground="#0D0D12" />
<Border IsVisible="{Binding Logged}" Width="52" Height="24" BorderBrush="#184E44"
BorderThickness="1" CornerRadius="4"
Margin="10,0,20,0" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="{Binding Who.Role,Converter={StaticResource UserRoleConverter}}"
Foreground="#184E44" TextAlignment="Center" VerticalAlignment="Center" />
</Border>
<Button IsVisible="{Binding Logged}" Content="退出登录" Command="{Binding ToLogout}"
Background="White"
VerticalContentAlignment="Center" CornerRadius="20"
Height="40" Width="100" HorizontalContentAlignment="Center" BorderBrush="#DFE1E7"
BorderThickness="1" />
</StackPanel>
</Grid>
</Border>
<!-- 下部分内容 -->
<Border Grid.Row="1" Background="#DFE1E7">
<Grid>
<views:ContainerView />
<login:LoginView />
</Grid>
</Border>
</Grid>
<controls:LockedView x:Name="LockedView" IsVisible="{Binding Locked}" />
</Grid>
</UserControl>