增加摄像头中控台项目
This commit is contained in:
247
SHH.CameraDashboard/Controls/CameraListControl.xaml
Normal file
247
SHH.CameraDashboard/Controls/CameraListControl.xaml
Normal file
@@ -0,0 +1,247 @@
|
||||
<UserControl
|
||||
x:Class="SHH.CameraDashboard.CameraListControl"
|
||||
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"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:models="clr-namespace:SHH.CameraDashboard"
|
||||
d:DesignHeight="600"
|
||||
d:DesignWidth="250"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
|
||||
<Style x:Key="Style.OnlineLed" TargetType="Ellipse">
|
||||
<Setter Property="Width" Value="8" />
|
||||
<Setter Property="Height" Value="8" />
|
||||
<Setter Property="Fill" Value="#666666" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsPhysicalOnline}" Value="True">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.Status.Success}" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsPhysicalOnline}" Value="False">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.Status.Danger}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Style.RunningStatusBox" TargetType="Border">
|
||||
<Setter Property="Width" Value="14" />
|
||||
<Setter Property="Height" Value="14" />
|
||||
<Setter Property="CornerRadius" Value="2" />
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Status.Warning}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsRunning}" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Accent}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Border
|
||||
Background="{DynamicResource Brush.Bg.Panel}"
|
||||
BorderBrush="{DynamicResource Brush.Border}"
|
||||
BorderThickness="0,0,1,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Margin="10,10,10,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="📡" />
|
||||
<ComboBox
|
||||
x:Name="ServerCombo"
|
||||
Grid.Column="1"
|
||||
Height="30"
|
||||
DisplayMemberPath="DisplayText"
|
||||
SelectionChanged="ServerCombo_SelectionChanged"
|
||||
Style="{StaticResource {x:Type ComboBox}}" />
|
||||
</Grid>
|
||||
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Margin="10,5,10,10"
|
||||
Background="{DynamicResource Brush.Bg.Input}"
|
||||
BorderBrush="{DynamicResource Brush.Border}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="{StaticResource Radius.Small}">
|
||||
<Grid>
|
||||
<TextBox
|
||||
x:Name="SearchBox"
|
||||
Height="28"
|
||||
Padding="8,0"
|
||||
VerticalContentAlignment="Center"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Foreground="{DynamicResource Brush.Text.Primary}"
|
||||
TextChanged="SearchBox_TextChanged" />
|
||||
<TextBlock
|
||||
Margin="10,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource Brush.Text.Secondary}"
|
||||
IsHitTestVisible="False"
|
||||
Text="🔍 搜索摄像头...">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<ListView
|
||||
x:Name="CameraList"
|
||||
Grid.Row="2"
|
||||
Padding="0,0,0,10"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
SelectionChanged="CameraList_SelectionChanged">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type models:CameraInfo}">
|
||||
<Grid>
|
||||
<Grid Margin="0,6" Background="#01FFFFFF">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="22" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Ellipse
|
||||
Margin="0,5,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Style="{StaticResource Style.OnlineLed}" />
|
||||
|
||||
<StackPanel Grid.Column="1">
|
||||
<StackPanel Margin="0,0,0,4" Orientation="Horizontal">
|
||||
|
||||
<TextBlock
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource Brush.Text.Primary}"
|
||||
Text="{Binding DisplayName}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</StackPanel>
|
||||
|
||||
<DockPanel LastChildFill="False">
|
||||
<TextBlock
|
||||
FontFamily="Consolas"
|
||||
FontSize="11"
|
||||
Foreground="{DynamicResource Brush.Text.Secondary}"
|
||||
Text="{Binding Name}" />
|
||||
|
||||
<Border DockPanel.Dock="Right" Style="{StaticResource Style.RunningStatusBox}">
|
||||
<Path
|
||||
x:Name="PlayIcon"
|
||||
Margin="3,2"
|
||||
Data="M3,2.5 L9,6 L3,9.5 Z"
|
||||
Fill="White"
|
||||
Stretch="Fill">
|
||||
<Path.Style>
|
||||
<Style TargetType="Path">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsRunning}" Value="True">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Path.Style>
|
||||
</Path>
|
||||
</Border>
|
||||
</DockPanel>
|
||||
|
||||
<TextBlock
|
||||
Margin="0,4,0,0"
|
||||
HorizontalAlignment="Right"
|
||||
FontSize="10"
|
||||
Foreground="{DynamicResource Brush.Text.Secondary}"
|
||||
Text="{Binding MediaDetail}"
|
||||
Visibility="{Binding IsRunning, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Border
|
||||
Margin="0,0,0,0"
|
||||
Padding="3,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Background="{DynamicResource Brush.Bg.L4}"
|
||||
CornerRadius="2">
|
||||
<TextBlock
|
||||
FontSize="9"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource Brush.Text.Secondary}"
|
||||
Text="{Binding Brand}" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListViewItem">
|
||||
<Border
|
||||
x:Name="Bd"
|
||||
Margin="5,1"
|
||||
Padding="8,4"
|
||||
CornerRadius="4">
|
||||
<ContentPresenter />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource Brush.Bg.Hover}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource Brush.Bg.L4}" />
|
||||
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||
<Setter TargetName="Bd" Property="BorderThickness" Value="0.5" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
</ListView>
|
||||
|
||||
<Grid
|
||||
x:Name="LoadingMask"
|
||||
Grid.Row="2"
|
||||
Background="{DynamicResource Brush.Bg.Panel}"
|
||||
Opacity="0.8"
|
||||
Visibility="Collapsed">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource Brush.Accent}"
|
||||
Text="加载中..." />
|
||||
</Grid>
|
||||
<TextBlock
|
||||
x:Name="EmptyText"
|
||||
Grid.Row="2"
|
||||
Margin="0,50,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Foreground="{DynamicResource Brush.Text.Secondary}"
|
||||
Text="暂无数据"
|
||||
Visibility="Collapsed" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user