20230724_MBJC_upperpc/MainWindow.xaml
2024-03-14 17:27:41 +08:00

408 lines
18 KiB
XML

<Window
x:Class="_20230724_MBJC_upperpc.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:_20230724_MBJC_upperpc.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_20230724_MBJC_upperpc"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="clr-namespace:_20230724_MBJC_upperpc.Views"
Name="Window"
Title="锚点移位和姿态监测系统"
Width="1600"
Height="900"
MinWidth="1600"
MinHeight="900"
Background="Transparent"
FontFamily="Microsoft YaHei"
FontSize="12"
FontWeight="ExtraLight"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<WindowChrome.WindowChrome>
<WindowChrome GlassFrameThickness="-1" />
</WindowChrome.WindowChrome>
<!-- 资源 -->
<Window.Resources>
<!-- 资源字典 -->
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- 统一的按钮样式 -->
<!--<ResourceDictionary Source="../Assets/Styles/DefaultStyle.xaml"/>-->
<ResourceDictionary>
<!-- 复选框按钮样式 -->
<Style x:Key="NavButtonStyle" TargetType="RadioButton">
<Setter Property="Foreground" Value="White" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Border
Name="back"
Background="Transparent"
CornerRadius="8">
<ContentControl
Margin="20,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="20" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="back" Property="Background" Value="#44FFFFFF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="StationChangeStyle" TargetType="RadioButton">
<Setter Property="Width" Value="50" />
<Setter Property="Height" Value="22" />
<Setter Property="Foreground" Value="#888" />
<Setter Property="Background" Value="#DDD" />
<Setter Property="FontSize" Value="11" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Border Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" Value="Orange" />
<Setter Property="Foreground" Value="White" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="DataGridStyle" TargetType="{x:Type DataGrid}">
<Setter Property="AutoGenerateColumns" Value="False" />
<Setter Property="CanUserAddRows" Value="False" />
<Setter Property="CanUserDeleteRows" Value="False" />
<Setter Property="CanUserReorderColumns" Value="False" />
<Setter Property="CanUserResizeColumns" Value="True" />
<Setter Property="CanUserResizeRows" Value="False" />
<Setter Property="CanUserSortColumns" Value="True" />
<Setter Property="GridLinesVisibility" Value="All" />
<Setter Property="HeadersVisibility" Value="All" />
<Setter Property="IsReadOnly" Value="True" />
<Setter Property="MinRowHeight" Value="40" />
<Setter Property="Background" Value="#FF285173" />
<Setter Property="Foreground" Value="White" />
</Style>
<Style x:Key="ColumnHeaderStyle" TargetType="DataGridColumnHeader">
<Setter Property="Height" Value="30" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="12" />
<Setter Property="Background" Value="#FF285173" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
<converters:ConnectColorConvert x:Key="ConnectColorConvert" />
<converters:ConnectTextConvert x:Key="ConnectTextConvert" />
</ResourceDictionary>
</Window.Resources>
<Grid>
<!-- 背景颜色 -->
<Grid.Background>
<RadialGradientBrush>
<GradientStop Offset="0" Color="#FF285173" />
<GradientStop Offset="0.3" Color="#FF244967" />
<GradientStop Offset="1" Color="#FF14273A" />
</RadialGradientBrush>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition Height="38" />
<RowDefinition Height="45" />
<RowDefinition />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<!-- 标题栏部分 -->
<Border BorderBrush="#5518AABD" BorderThickness="0,0,0,1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="78" />
<ColumnDefinition Width="auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Image Source="Assets/Images/logo.png" />
<TextBlock
Grid.Column="1"
Margin="10,0,0,0"
VerticalAlignment="Center"
FontSize="30"
Foreground="White"
Text="锚点移位和姿态监测系统" />
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="13" />
</Grid.RowDefinitions>
<!-- 顶栏 设置鼠标左键按下事件(可以拖动窗口) -->
<Border
Height="132"
VerticalAlignment="Top"
CornerRadius="10,10,0,0"
MouseLeftButtonDown="Border_MouseLeftButtonDown" />
<Border
Width="200"
HorizontalAlignment="Right"
Background="Transparent"
WindowChrome.IsHitTestVisibleInChrome="True">
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
Click="MinButton_Click"
Content="&#xe624;"
Style="{StaticResource ControlButtonStyle}" />
<Button
Click="MaxButton_Click"
Content="&#xe60f;"
Style="{StaticResource ControlButtonStyle}" />
<Button
Background="DarkRed"
Click="Button_Click"
Content="&#xe661;"
Style="{StaticResource ControlButtonStyle}" />
</StackPanel>
</Border>
<Border
Grid.Row="1"
BorderBrush="#5518AABD"
BorderThickness="0,1,0,0" />
<Border Grid.Row="1" Margin="0,3,0,2">
<Border.Background>
<VisualBrush
TileMode="Tile"
Viewport="0,0,7,7"
ViewportUnits="Absolute">
<VisualBrush.Visual>
<Grid Width="20" Height="20">
<Line
Stroke="Gray"
StrokeThickness="1"
X1="0"
X2="10"
Y1="10"
Y2="0" />
</Grid>
</VisualBrush.Visual>
</VisualBrush>
</Border.Background>
</Border>
</Grid>
</Grid>
</Border>
<!-- 系统状态连接信息 -->
<StackPanel
Grid.Row="1"
Margin="40,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
VerticalAlignment="Center"
FontFamily="../Assets/Fonts/#iconfont"
FontSize="20"
Foreground="#55FFFFFF"
Text="&#xe67b;" />
<TextBlock
Margin="10,0"
VerticalAlignment="Center"
FontSize="13"
Foreground="#99FFFFFF"
Text="系统状态信息" />
<!-- 基阵通信 -->
<TextBlock
Margin="20,0,0,0"
VerticalAlignment="Center"
Foreground="#99FFFFFF"
Text="基站上位机软件通信状态:" />
<TextBlock
VerticalAlignment="Center"
Foreground="{Binding Client.IsConnected, Converter={StaticResource ResourceKey=ConnectColorConvert}}"
Text="{Binding Client.IsConnected, Converter={StaticResource ResourceKey=ConnectTextConvert}}">
<TextBlock.ToolTip>
<ToolTip
Name="BeidouCommunication"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{Binding EM.ComConMessage}"
Style="{DynamicResource MyToolTipStyle}" />
</TextBlock.ToolTip>
</TextBlock>
<ToggleButton
Margin="10,0,0,0"
Command="{Binding ConnectCommand}"
CommandParameter="{Binding IsChecked, RelativeSource={RelativeSource Self}}"
IsChecked="{Binding Client.IsConnected}"
Style="{StaticResource MaterialDesignSwitchToggleButton}"
ToolTip="MaterialDesignSwitchToggleButton with Content and ToggleButtonAssist.OnContent">
<materialDesign:PackIcon Kind="NetworkOffOutline" RenderTransformOrigin=".5,.5" />
<materialDesign:ToggleButtonAssist.OnContent>
<materialDesign:PackIcon Kind="NetworkOutline" />
</materialDesign:ToggleButtonAssist.OnContent>
<materialDesign:ToggleButtonAssist.SwitchTrackOffBackground>
<SolidColorBrush Color="White" />
</materialDesign:ToggleButtonAssist.SwitchTrackOffBackground>
<materialDesign:ToggleButtonAssist.SwitchTrackOnBackground>
<SolidColorBrush Color="Green" />
</materialDesign:ToggleButtonAssist.SwitchTrackOnBackground>
</ToggleButton>
</StackPanel>
<!-- 时间日期状态信息 -->
<StackPanel
Grid.Row="1"
Margin="30,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
x:Name="Datatime"
VerticalAlignment="Center"
FontFamily="../Assets/Fonts/#Digital Display"
FontSize="25"
Foreground="White" />
<StackPanel
Margin="15,0,0,0"
TextBlock.FontSize="10"
TextBlock.Foreground="White">
<TextBlock x:Name="Date" />
<TextBlock x:Name="week" HorizontalAlignment="Right" />
</StackPanel>
</StackPanel>
<!-- 菜单栏部分 -->
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel
Grid.Column="1"
Margin="20,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal">
<!-- 平台信息 -->
<RadioButton
Command="{Binding NavChangedCommand}"
CommandParameter="BuoyPlatformView"
Content="平台信息"
IsChecked="True"
Style="{DynamicResource NavButtonStyle}" />
<!-- 浮标传感器数据 -->
<RadioButton
Command="{Binding NavChangedCommand}"
CommandParameter="FirstPageView"
Content="综合界面"
Style="{DynamicResource NavButtonStyle}" />
<!-- 锚点信息 -->
<RadioButton
Command="{Binding NavChangedCommand}"
CommandParameter="Point1"
Content="北锚1"
Style="{DynamicResource NavButtonStyle}" />
<!-- 锚点2 -->
<RadioButton
Command="{Binding NavChangedCommand}"
CommandParameter="Point2"
Content="北锚2"
Style="{DynamicResource NavButtonStyle}" />
<!-- 锚点3 -->
<RadioButton
Command="{Binding NavChangedCommand}"
CommandParameter="Point3"
Content="西锚1"
Style="{DynamicResource NavButtonStyle}" />
<!-- 锚点4 -->
<RadioButton
Command="{Binding NavChangedCommand}"
CommandParameter="Point4"
Content="西锚2"
Style="{DynamicResource NavButtonStyle}" />
<!-- 锚点5 -->
<RadioButton
Command="{Binding NavChangedCommand}"
CommandParameter="Point5"
Content="东锚1"
Style="{DynamicResource NavButtonStyle}" />
<!-- 锚点6 -->
<RadioButton
Command="{Binding NavChangedCommand}"
CommandParameter="Point6"
Content="东锚2"
Style="{DynamicResource NavButtonStyle}" />
<!-- 基准点1 -->
<RadioButton
Command="{Binding NavChangedCommand}"
CommandParameter="Benchmark1"
Content="基准点1"
Style="{DynamicResource NavButtonStyle}" />
<!-- 基准点2 -->
<RadioButton
Command="{Binding NavChangedCommand}"
CommandParameter="Benchmark2"
Content="基准点2"
Style="{DynamicResource NavButtonStyle}" />
</StackPanel>
</Grid>
<!-- 内容部分 -->
<ContentControl Grid.Row="3" Content="{Binding PageContent}" />
<!--<views:ProgressView Grid.Row="3" Visibility="Visible" />-->
<!-- 底部状态栏部分 -->
<Border
Grid.Row="4"
BorderBrush="#5518AABD"
BorderThickness="0,1,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Border Margin="0,5">
<Border.Background>
<VisualBrush
TileMode="Tile"
Viewport="0,0,7,7"
ViewportUnits="Absolute">
<VisualBrush.Visual>
<Grid Width="20" Height="20">
<Line
Stroke="Gray"
StrokeThickness="1"
X1="0"
X2="10"
Y1="10"
Y2="0" />
</Grid>
</VisualBrush.Visual>
</VisualBrush>
</Border.Background>
</Border>
<!--<TextBlock Grid.Column="1" Text="2022-07-30" Foreground="DarkRed" VerticalAlignment="Center" FontSize="11" Margin="10,1" FontWeight="Bold"/>-->
</Grid>
</Border>
</Grid>
</Window>