Files
Ayay/SHH.CameraDashboard/MainWindow.xaml

362 lines
17 KiB
Plaintext
Raw Normal View History

2025-12-30 10:53:02 +08:00
<Window
x:Class="SHH.CameraDashboard.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
2026-01-01 22:40:32 +08:00
xmlns:local="clr-namespace:SHH.CameraDashboard"
2025-12-30 10:53:02 +08:00
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
2026-01-01 22:40:32 +08:00
Width="1900"
Height="1030"
2025-12-30 10:53:02 +08:00
Background="{DynamicResource Brush.Bg.Window}"
FontFamily="{StaticResource Font.Normal}"
Foreground="{DynamicResource Brush.Text.Primary}"
2026-01-01 22:40:32 +08:00
Topmost="{Binding IsTopMost}"
2025-12-30 10:53:02 +08:00
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<WindowChrome.WindowChrome>
<WindowChrome
CaptionHeight="0"
CornerRadius="0"
GlassFrameThickness="0"
ResizeBorderThickness="5" />
</WindowChrome.WindowChrome>
2026-01-01 22:40:32 +08:00
<Window.DataContext>
<local:MainWindowViewModel />
</Window.DataContext>
<Border
Background="{DynamicResource Brush.Bg.Window}"
BorderBrush="{DynamicResource Brush.Border}"
BorderThickness="1">
<Grid>
2025-12-30 10:53:02 +08:00
<Grid.RowDefinitions>
2026-01-01 22:40:32 +08:00
<RowDefinition Height="Auto" />
2025-12-30 10:53:02 +08:00
<RowDefinition Height="*" />
2026-01-01 22:40:32 +08:00
<RowDefinition Height="5" />
2025-12-30 10:53:02 +08:00
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border
2026-01-01 22:40:32 +08:00
x:Name="TitleBar"
2025-12-30 10:53:02 +08:00
Grid.Row="0"
2026-01-01 22:40:32 +08:00
Height="32"
2025-12-30 10:53:02 +08:00
Background="{DynamicResource Brush.Bg.Panel}"
BorderBrush="{DynamicResource Brush.Border}"
BorderThickness="0,0,0,1"
2026-01-01 22:40:32 +08:00
MouseLeftButtonDown="TitleBar_MouseDown">
2025-12-30 10:53:02 +08:00
<Grid>
<StackPanel
2026-01-01 22:40:32 +08:00
Margin="12,0"
VerticalAlignment="Center"
2025-12-30 10:53:02 +08:00
Orientation="Horizontal">
2026-01-01 22:40:32 +08:00
<TextBlock
Margin="0,0,8,0"
VerticalAlignment="Center"
Text="📷" />
<TextBlock
VerticalAlignment="Center"
FontSize="12"
2025-12-30 10:53:02 +08:00
FontWeight="Bold"
2026-01-01 22:40:32 +08:00
Text="SHH 视频网关 - 中控台" />
2025-12-30 10:53:02 +08:00
</StackPanel>
2026-01-01 22:40:32 +08:00
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
Command="{Binding OpenWizardCommand}"
Style="{StaticResource Btn.TitleBar}"
ToolTip="向导">
<Path
Width="18"
Height="18"
Data="{StaticResource Icon.Wizard}"
Fill="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"
Stretch="Uniform" />
</Button>
2025-12-30 10:53:02 +08:00
<Button
Width="40"
2026-01-01 22:40:32 +08:00
Height="30"
Click="BtnTheme_Click"
Style="{StaticResource Btn.TitleBar}"
ToolTip="切换皮肤">
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
<Path
Width="14"
Height="14"
Data="{StaticResource Icon.Theme}"
Fill="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"
Stretch="Uniform" />
<Path
Width="8"
Height="8"
Margin="4,2,0,0"
VerticalAlignment="Center"
Data="M7,10L12,15L17,10H7Z"
Fill="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"
Stretch="Uniform" />
</StackPanel>
<Button.ContextMenu>
<ContextMenu Placement="Bottom">
<MenuItem Command="{Binding SwitchThemeCommand}" CommandParameter="Dark">
<MenuItem.Header>
<TextBlock
Margin="0,1,0,0"
VerticalAlignment="Center"
FontSize="13"
Text="🌚 深色模式 (Dark)" />
</MenuItem.Header>
</MenuItem>
<MenuItem Command="{Binding SwitchThemeCommand}" CommandParameter="Light">
<MenuItem.Header>
<TextBlock
Margin="0,1,0,0"
VerticalAlignment="Center"
FontSize="13"
Text="☀️ 浅色模式 (Light)" />
</MenuItem.Header>
</MenuItem>
</ContextMenu>
</Button.ContextMenu>
</Button>
2025-12-30 10:53:02 +08:00
<Button
2026-01-01 22:40:32 +08:00
Command="{Binding ToggleTopMostCommand}"
Style="{StaticResource Btn.TitleBar}"
ToolTip="{Binding TopMostTooltip}">
<Path
Width="16"
Height="16"
Fill="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"
Stretch="Uniform">
<Path.Style>
<Style TargetType="Path">
<Setter Property="Data" Value="{StaticResource Icon.Pin.Outline}" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsTopMost}" Value="True">
<Setter Property="Data" Value="{StaticResource Icon.Pin.Fixed}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
</Button>
<Rectangle Width="10" Fill="Transparent" />
2025-12-30 10:53:02 +08:00
<Button
2026-01-01 22:40:32 +08:00
Command="{Binding MinimizeCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
2025-12-30 10:53:02 +08:00
Content="—"
2026-01-01 22:40:32 +08:00
Style="{StaticResource Btn.TitleBar}" />
2025-12-30 10:53:02 +08:00
<Button
2026-01-01 22:40:32 +08:00
Command="{Binding ToggleMaximizeCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
Content="{Binding MaxButtonContent}"
Style="{StaticResource Btn.TitleBar}" />
<Button
Command="{Binding CloseCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
2025-12-30 10:53:02 +08:00
Content="✕"
2026-01-01 22:40:32 +08:00
Style="{StaticResource Btn.TitleBar.Close}" />
2025-12-30 10:53:02 +08:00
</StackPanel>
</Grid>
</Border>
2026-01-01 22:40:32 +08:00
<DockPanel Grid.Row="1">
<!-- 左侧摄像头列表 -->
2025-12-30 10:53:02 +08:00
<Border
2026-01-01 22:40:32 +08:00
Width="320"
BorderBrush="{DynamicResource Brush.Border}"
BorderThickness="0,0,1,0"
DockPanel.Dock="Left">
<local:CameraList x:Name="CameraList" />
</Border>
2025-12-30 10:53:02 +08:00
2026-01-01 22:40:32 +08:00
<!-- 右侧面板 -->
<Border
Width="500"
2025-12-30 10:53:02 +08:00
Background="{DynamicResource Brush.Bg.Window}"
2026-01-01 22:40:32 +08:00
BorderBrush="{DynamicResource Brush.Border}"
BorderThickness="1,0,0,0"
DockPanel.Dock="Right"
Visibility="{Binding IsRightPanelVisible, Converter={StaticResource BooleanToVisibilityConverter}}">
<Border.Resources>
<DataTemplate DataType="{x:Type local:CameraEditViewModel}">
<local:CameraEdit />
</DataTemplate>
<DataTemplate DataType="{x:Type local:CameraPtzViewModel}">
<local:CameraPtz />
</DataTemplate>
<DataTemplate DataType="{x:Type local:CameraImgProcViewModel}">
<local:CameraImgProc />
</DataTemplate>
2025-12-30 10:53:02 +08:00
2026-01-01 22:40:32 +08:00
<DataTemplate DataType="{x:Type local:CameraImageSubscriptionViewModels}">
<local:CameraImageSubscription />
</DataTemplate>
</Border.Resources>
<ContentControl Content="{Binding CurrentRightPanelViewModel}" />
</Border>
<DockPanel>
<local:CameraItemTop DataSource="{Binding ElementName=CameraList, Path=DataContext.SelectedCamera}" DockPanel.Dock="Top" />
<Grid />
</DockPanel>
</DockPanel>
<GridSplitter
Grid.Row="2"
Height="5"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Background="Transparent"
ResizeBehavior="PreviousAndNext"
ResizeDirection="Rows"
ShowsPreview="True" />
<Border
x:Name="BottomLogPanel"
Grid.Row="3"
Background="{DynamicResource Brush.Bg.Panel}"
BorderBrush="{DynamicResource Brush.Border}"
BorderThickness="0,1,0,0">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Height" Value="250" />
<Setter Property="MinHeight" Value="100" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsLogPanelExpanded}" Value="False">
<Setter Property="Height" Value="35" />
<Setter Property="MinHeight" Value="35" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<Grid>
<TabControl
Padding="0"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Background="Transparent"
BorderThickness="0"
ItemContainerStyle="{DynamicResource Style.TabItem.Modern}">
<TabItem Header="WebAPI 诊断">
<local:ServiceNodesDiagnostic DataContext="{Binding DiagnosticVM}" />
</TabItem>
</TabControl>
<StackPanel
Margin="0,2,5,0"
2025-12-30 10:53:02 +08:00
HorizontalAlignment="Right"
2026-01-01 22:40:32 +08:00
VerticalAlignment="Top"
Panel.ZIndex="1"
Orientation="Horizontal">
<Button
Width="30"
Height="30"
Command="{Binding DiagnosticVM.ClearCommand}"
Style="{StaticResource Btn.TitleBar}"
ToolTip="清空日志">
<Path
Width="14"
Height="14"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="{StaticResource Icon.Trash}"
Fill="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"
Stretch="Uniform" />
</Button>
2025-12-30 10:53:02 +08:00
2026-01-01 22:40:32 +08:00
<Button
Width="30"
Height="30"
Command="{Binding ToggleLogPanelCommand}"
Style="{StaticResource Btn.TitleBar}"
ToolTip="展开/收起面板">
<Path
Width="12"
Height="12"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"
Stretch="Uniform">
<Path.Style>
<Style TargetType="Path">
<Setter Property="Data" Value="{StaticResource Icon.ChevronDown}" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsLogPanelExpanded}" Value="False">
<Setter Property="Data" Value="{StaticResource Icon.ChevronUp}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
</Button>
</StackPanel>
2025-12-30 10:53:02 +08:00
</Grid>
2026-01-01 22:40:32 +08:00
</Border>
2025-12-30 10:53:02 +08:00
2026-01-01 22:40:32 +08:00
<Grid
x:Name="GlobalMask"
Grid.Row="1"
Grid.RowSpan="3"
Background="#CC000000"
Visibility="{Binding IsOverlayVisible, Converter={StaticResource BooleanToVisibilityConverter}}">
<ContentControl
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{Binding OverlayContent}">
<ContentControl.Style>
<Style TargetType="ContentControl">
<Style.Triggers>
<DataTrigger Binding="{Binding IsOverlayVisible}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
From="0"
To="1"
Duration="0:0:0.2" />
<DoubleAnimation
Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)"
From="0.9"
To="1"
Duration="0:0:0.2" />
<DoubleAnimation
Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)"
From="0.9"
To="1"
Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
<Setter Property="RenderTransform">
<Setter.Value>
<ScaleTransform CenterX="0.5" CenterY="0.5" />
</Setter.Value>
</Setter>
</Style>
</ContentControl.Style>
</ContentControl>
</Grid>
2025-12-30 10:53:02 +08:00
</Grid>
2026-01-01 22:40:32 +08:00
</Border>
2025-12-30 10:53:02 +08:00
</Window>