VerticalMenuControl.xaml
13.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<UserControl x:Class="SmartScan.SetControl.WPF.VerticalMenuControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SmartScan.SetControl.WPF"
mc:Ignorable="d"
d:DesignWidth="160" d:Height="750" Background="#191919" Loaded="UserControl_Loaded" >
<UserControl.Resources>
<!-- 菜单分组样式 -->
<Style x:Key="MenuGroupStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="#CCCCCC"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Margin" Value="10 15 15 15"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="FontFamily" Value="微软雅黑"></Setter>
</Style>
<!-- 菜单按钮样式 - 包含底部边框作为分隔线 -->
<Style x:Key="MenuButtonStyle" TargetType="Button">
<Setter Property="Background" Value="#2A2A2A"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Height" Value="46"/>
<Setter Property="Margin" Value="0,0,0,0"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Setter Property="BorderBrush" Value="#5a5a5a"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="border" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="10,0,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="24"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- 图标容器 -->
<Border Grid.Column="0">
<ContentPresenter x:Name="Icon" Width="16" Content="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"/>
</Border>
<!-- 文字容器 -->
<TextBlock Grid.Column="1" Text="{TemplateBinding Content}"
VerticalAlignment="Center" Margin="10,0,0,0"
FontSize="14" Foreground="{TemplateBinding Foreground}" FontFamily="微软雅黑"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#252525"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#2d2d2d"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 分隔线样式 -->
<Style x:Key="SeparatorStyle" TargetType="Rectangle">
<Setter Property="Height" Value="1"/>
<Setter Property="Fill" Value="#333333"/>
<Setter Property="Margin" Value="0"/>
</Style>
<!-- 状态卡片样式 -->
<Style x:Key="StatusCardStyle" TargetType="Border">
<Setter Property="Background" Value="#1e1e1e" />
<Setter Property="CornerRadius" Value="5" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="#e8e8e8" />
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect ShadowDepth="1" BlurRadius="3" Opacity="0.1" Direction="270" />
</Setter.Value>
</Setter>
</Style>
<!-- 状态指示条样式 -->
<Style x:Key="StatusIndicatorStyle" TargetType="Border">
<Setter Property="Width" Value="4" />
<Setter Property="CornerRadius" Value="2" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Margin" Value="10,0,0,0" />
</Style>
</UserControl.Resources>
<Grid>
<Border Background="#151515" Padding="0">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<StackPanel>
<!-- 主要操作 -->
<TextBlock Text="主要操作" Name="VMC_Main_operation" Style="{StaticResource MenuGroupStyle}" FontWeight="Bold"/>
<Rectangle Style="{StaticResource SeparatorStyle}"/>
<Button Content="开始" x:Name="BtnStart" Style="{StaticResource MenuButtonStyle}" Click="BtnStart_Click">
<Button.Tag>
<Path Data="M15,5H20V7H15V5M12.5,10H20V12H12.5V10M10,15H20V17H10V15M4.11,4.13C4.06,4.13 4,4.16 4,4.21V19.8C4,19.85 4.06,19.87 4.11,19.87C4.13,19.87 4.16,19.86 4.18,19.83L10,13.5V10.5L4.18,4.16C4.16,4.14 4.13,4.13 4.11,4.13Z"
Fill="White" Stretch="Uniform"/>
</Button.Tag>
</Button>
<Button Content="图片识别" Name="BtnTriggerIO" Style="{StaticResource MenuButtonStyle}" Click="BtnTriggerIO_Click">
<Button.Tag>
<Path Data="M4,4H7L9,2H15L17,4H20A2,2 0 0,1 22,6V18A2,2 0 0,1 20,20H4A2,2 0 0,1 2,18V6A2,2 0 0,1 4,4M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9Z"
Fill="#AAAAAA" Stretch="Uniform"/>
</Button.Tag>
</Button>
<Button Content="追溯" Name="BtnRetrospect" Style="{StaticResource MenuButtonStyle}" Click="BtnRetrospect_Click">
<Button.Tag>
<Path Data="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"
Fill="White" Stretch="Uniform"/>
</Button.Tag>
</Button>
<Button Content="设置" Style="{StaticResource MenuButtonStyle}" Name="BtnSet" Click="BtnSet_Click">
<Button.Tag>
<Path Data="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z"
Fill="#AAAAAA" Stretch="Uniform"/>
</Button.Tag>
</Button>
<Button Content="AI" Name="BtnAI" Style="{StaticResource MenuButtonStyle}" Visibility="Collapsed" Click="BtnAI_Click">
<Button.Tag>
<Image Source="/Resources/AI.png" Width="18" Height="18" />
</Button.Tag>
</Button>
<Button Content="关于" Name="BtnAbout" Style="{StaticResource MenuButtonStyle}" Click="BtnAbout_Click">
<Button.Tag>
<Path Data="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z"
Fill="#1E90FF" Stretch="Uniform"/>
</Button.Tag>
</Button>
<!-- 图像控制 -->
<TextBlock Text="图像控制" Name="VMC_Image_control" Visibility="Collapsed" Style="{StaticResource MenuGroupStyle}" Margin="15" FontWeight="Bold"/>
<Rectangle Style="{StaticResource SeparatorStyle}"/>
<Button Content="识别设备连接" Visibility="Collapsed" Name="LblCameraExist" Style="{StaticResource MenuButtonStyle}" Click="LblCameraExist_Click">
<Button.Tag>
<Path Data="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z"
Fill="#40A9FF" Stretch="Uniform"/>
</Button.Tag>
</Button>
<Button Content="IO模块连接" Visibility="Collapsed" Name="LblIOExist" Style="{StaticResource MenuButtonStyle}" BorderThickness="0" Click="LblIOExist_Click">
<Button.Tag>
<Path Data="M21,16.5C21,16.88 20.79,17.21 20.47,17.38L12.57,21.82C12.41,21.94 12.21,22 12,22C11.79,22 11.59,21.94 11.43,21.82L3.53,17.38C3.21,17.21 3,16.88 3,16.5V7.5C3,7.12 3.21,6.79 3.53,6.62L11.43,2.18C11.59,2.06 11.79,2 12,2C12.21,2 12.41,2.06 12.57,2.18L20.47,6.62C20.79,6.79 21,7.12 21,7.5V16.5M12,4.15L6.04,7.5L12,10.85L17.96,7.5L12,4.15Z"
Fill="#F44336" Stretch="Uniform"/>
</Button.Tag>
</Button>
</StackPanel>
</ScrollViewer>
</Border>
<Grid Margin="10 0 0 20" HorizontalAlignment="Left" VerticalAlignment="Bottom">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 标题 -->
<TextBlock Text="系统状态" FontSize="16" FontWeight="Bold" Name="VMC_System_status" Foreground="White" Margin="0,0,0,15" />
<!-- 状态卡片容器 -->
<WrapPanel Grid.Row="1" Orientation="Vertical" Margin="0,0,0,0">
<!-- 相机状态卡片 -->
<Border Style="{StaticResource StatusCardStyle}" Width="160" Height="60" Margin="0,0,15,15">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="57*"/>
<ColumnDefinition Width="101*"/>
</Grid.ColumnDefinitions>
<!-- 蓝色状态指示条 -->
<Border x:Name="CameraStatusIndicator" Style="{StaticResource StatusIndicatorStyle}" Background="Green" Height="40" Margin="10,9,0,9" />
<StackPanel Margin="24,10,0,0" Grid.ColumnSpan="2">
<TextBlock Text="相机状态" Name="Camera_status" FontSize="13" Foreground="White" FontFamily="微软雅黑" />
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
<TextBlock x:Name="CameraStatusText" Text="在线" FontSize="14" FontWeight="Medium" Foreground="White" FontFamily="微软雅黑" />
</StackPanel>
</StackPanel>
</Grid>
</Border>
<!-- IO模块状态卡片 -->
<Border Style="{StaticResource StatusCardStyle}" Width="160" Height="60" Margin="0,0,15,15">
<Grid>
<!-- 黄色状态指示条 -->
<Border x:Name="IOStatusIndicator" Style="{StaticResource StatusIndicatorStyle}" Background="red" Height="40" />
<StackPanel Margin="24,10,0,0">
<TextBlock Text="IO模块" Name="LblIOExists" FontSize="13" Foreground="White" FontFamily="微软雅黑"/>
<TextBlock x:Name="IOStatusText" Text="离线" FontSize="14" FontWeight="Medium" Foreground="White" FontFamily="微软雅黑" Margin="0,8,0,0" />
</StackPanel>
</Grid>
</Border>
</WrapPanel>
</Grid>
<TextBlock Text="等待运行" Visibility="Collapsed" FontFamily="微软雅黑" Name="ShowLog" FontSize="21" Foreground="Red" VerticalAlignment="Bottom" Margin="0 0 0 50" HorizontalAlignment="Center"/>
<TextBlock x:Name="txt_version" Text="4.1.9233.34683" FontFamily="微软雅黑" FontSize="11" Foreground="#999999" VerticalAlignment="Bottom" Margin="0 0 0 10" HorizontalAlignment="Center"/>
</Grid>
</UserControl>