ShakerInfoView.xaml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <UserControl
  2. x:Class="ShakerManger.View.ShakerInfoView"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:data="clr-namespace:Shaker.Model;assembly=Shaker"
  7. xmlns:gif="https://github.com/XamlAnimatedGif/XamlAnimatedGif"
  8. xmlns:hc="https://handyorg.github.io/handycontrol"
  9. xmlns:local="clr-namespace:ShakerManger.View"
  10. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  11. xmlns:oxy="http://oxyplot.org/wpf"
  12. xmlns:oxyplot="http://oxyplot.org/skiawpf"
  13. xmlns:system="clr-namespace:System;assembly=mscorlib"
  14. xmlns:vm="clr-namespace:ShakerManger.ViewModel"
  15. d:DataContext="{d:DesignInstance {x:Type vm:ShakerControlViewModel}}"
  16. d:DesignHeight="450"
  17. d:DesignWidth="800"
  18. mc:Ignorable="d">
  19. <UserControl.Resources>
  20. <vm:BindingProxy x:Key="GridVisibility" Data="{x:Static system:Boolean.FalseString}" />
  21. </UserControl.Resources>
  22. <Viewbox Margin="4" Stretch="Fill">
  23. <Grid
  24. Grid.Row="0"
  25. Width="960"
  26. Height="460">
  27. <Grid.ColumnDefinitions>
  28. <ColumnDefinition Width="auto" />
  29. <ColumnDefinition Width="0.45*" />
  30. <ColumnDefinition Width="0.35*" />
  31. </Grid.ColumnDefinitions>
  32. <Image
  33. MaxWidth="260"
  34. gif:AnimationBehavior.AutoStart="{Binding AutoStart}"
  35. gif:AnimationBehavior.RepeatBehavior="{Binding RepeatBehavior}"
  36. gif:AnimationBehavior.SourceUri="{Binding GifPath}">
  37. <hc:Interaction.Triggers>
  38. <hc:EventTrigger EventName="Loaded">
  39. <hc:SetPropertyAction
  40. PropertyName="Image"
  41. PropertyValue="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Image}}"
  42. TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Image}, Path=DataContext}" />
  43. </hc:EventTrigger>
  44. </hc:Interaction.Triggers>
  45. </Image>
  46. <GroupBox
  47. Grid.Row="0"
  48. Grid.Column="1"
  49. hc:TitleElement.Background="{StaticResource EmbellishBrush}"
  50. hc:TitleElement.Foreground="{StaticResource MainBrush}"
  51. hc:TitleElement.MinHeight="40"
  52. Background="Transparent"
  53. BorderBrush="Gray"
  54. BorderThickness="1"
  55. FontSize="26"
  56. FontWeight="Bold"
  57. Foreground="{StaticResource MainBrush}"
  58. Header="输出"
  59. Style="{StaticResource GroupBoxTab}">
  60. <Grid TextBlock.Foreground="{StaticResource EmbellishBrush}">
  61. <Grid.ColumnDefinitions>
  62. <ColumnDefinition />
  63. <ColumnDefinition />
  64. </Grid.ColumnDefinitions>
  65. <Grid.RowDefinitions>
  66. <RowDefinition />
  67. <RowDefinition />
  68. </Grid.RowDefinitions>
  69. <Line
  70. HorizontalAlignment="Right"
  71. VerticalAlignment="Center"
  72. Stroke="Gray"
  73. StrokeThickness="1"
  74. X1="0"
  75. X2="0"
  76. Y1="0"
  77. Y2="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Grid}, Path=ActualHeight}" />
  78. <Line
  79. Grid.Row="1"
  80. HorizontalAlignment="Right"
  81. VerticalAlignment="Center"
  82. Stroke="Gray"
  83. StrokeThickness="1"
  84. X1="0"
  85. X2="0"
  86. Y1="0"
  87. Y2="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Grid}, Path=ActualHeight}" />
  88. <Line
  89. Grid.Row="0"
  90. Grid.ColumnSpan="2"
  91. VerticalAlignment="Bottom"
  92. Stroke="Gray"
  93. StrokeThickness="1"
  94. X1="0"
  95. X2="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Grid}, Path=ActualWidth}"
  96. Y1="0"
  97. Y2="0" />
  98. <StackPanel
  99. Grid.Column="0"
  100. VerticalAlignment="Center"
  101. Orientation="Vertical">
  102. <StackPanel
  103. HorizontalAlignment="Center"
  104. VerticalAlignment="Center"
  105. Orientation="Horizontal">
  106. <Viewbox
  107. Width="24"
  108. Height="24"
  109. Stretch="Fill">
  110. <Path
  111. Data="{StaticResource CurrentGeometry}"
  112. Fill="{StaticResource EmbellishBrush}"
  113. Stretch="Fill" />
  114. </Viewbox>
  115. <TextBlock
  116. Margin="4,0,0,0"
  117. HorizontalAlignment="Center"
  118. VerticalAlignment="Center"
  119. FontSize="16"
  120. FontWeight="Normal">
  121. <Run Text="{Binding AnalogNames[1]}" />
  122. <Run Text="{Binding Units[1], StringFormat=({0})}" />
  123. </TextBlock>
  124. </StackPanel>
  125. <TextBlock
  126. Margin="4,0,0,0"
  127. HorizontalAlignment="Center"
  128. VerticalAlignment="Top"
  129. FontSize="50"
  130. Foreground="Green"
  131. Text="{Binding CurrentData.OutputCurrent, StringFormat={}{0:0000}}" />
  132. </StackPanel>
  133. <StackPanel
  134. Grid.Column="1"
  135. VerticalAlignment="Center"
  136. Orientation="Vertical">
  137. <StackPanel
  138. HorizontalAlignment="Center"
  139. VerticalAlignment="Center"
  140. Orientation="Horizontal">
  141. <Viewbox
  142. Width="24"
  143. Height="24"
  144. Stretch="Fill">
  145. <Path
  146. Data="{StaticResource VoltageGeometry}"
  147. Fill="{StaticResource EmbellishBrush}"
  148. Stretch="Fill" />
  149. </Viewbox>
  150. <TextBlock
  151. Margin="4,0,0,0"
  152. HorizontalAlignment="Center"
  153. VerticalAlignment="Center"
  154. FontSize="16"
  155. FontWeight="Normal">
  156. <Run Text="{Binding AnalogNames[2]}" />
  157. <Run Text="{Binding Units[2], StringFormat=({0})}" />
  158. </TextBlock>
  159. </StackPanel>
  160. <TextBlock
  161. HorizontalAlignment="Center"
  162. VerticalAlignment="Top"
  163. FontSize="50"
  164. Foreground="Green"
  165. Text="{Binding CurrentData.OutputVoltage, StringFormat={}{0:0000}}" />
  166. </StackPanel>
  167. <StackPanel
  168. Grid.Row="1"
  169. Grid.Column="0"
  170. VerticalAlignment="Center"
  171. Orientation="Vertical">
  172. <StackPanel
  173. HorizontalAlignment="Center"
  174. VerticalAlignment="Center"
  175. Orientation="Horizontal">
  176. <Viewbox
  177. Width="24"
  178. Height="24"
  179. Stretch="Fill">
  180. <Path
  181. Data="{StaticResource CurrentGeometry}"
  182. Fill="{StaticResource EmbellishBrush}"
  183. Stretch="Fill" />
  184. </Viewbox>
  185. <TextBlock
  186. Margin="4,0,0,0"
  187. HorizontalAlignment="Center"
  188. VerticalAlignment="Center"
  189. FontSize="16"
  190. FontWeight="Normal">
  191. <Run Text="{Binding AnalogNames[3]}" />
  192. <Run Text="{Binding Units[3], StringFormat=({0})}" />
  193. </TextBlock>
  194. </StackPanel>
  195. <TextBlock
  196. Margin="4,0,0,0"
  197. HorizontalAlignment="Center"
  198. VerticalAlignment="Top"
  199. FontSize="50"
  200. Foreground="Green"
  201. Text="{Binding CurrentData.ExcitationCurrent, StringFormat={}{0:0000}}" />
  202. </StackPanel>
  203. <StackPanel
  204. Grid.Row="1"
  205. Grid.Column="1"
  206. VerticalAlignment="Center"
  207. Orientation="Vertical">
  208. <StackPanel
  209. HorizontalAlignment="Center"
  210. VerticalAlignment="Center"
  211. Orientation="Horizontal">
  212. <Viewbox
  213. Width="24"
  214. Height="24"
  215. Stretch="Fill">
  216. <Path
  217. Data="{StaticResource VoltageGeometry}"
  218. Fill="{StaticResource EmbellishBrush}"
  219. Stretch="Fill" />
  220. </Viewbox>
  221. <TextBlock
  222. Margin="4,0,0,0"
  223. HorizontalAlignment="Center"
  224. VerticalAlignment="Center"
  225. FontSize="16"
  226. FontWeight="Normal">
  227. <Run Text="{Binding AnalogNames[5]}" />
  228. <Run Text="{Binding Units[5], StringFormat=({0})}" />
  229. </TextBlock>
  230. </StackPanel>
  231. <TextBlock
  232. Margin="4,0,0,0"
  233. HorizontalAlignment="Center"
  234. VerticalAlignment="Top"
  235. FontSize="50"
  236. Foreground="Green"
  237. Text="{Binding CurrentData.ExcitationCurrent, StringFormat={}{0:0000}}" />
  238. </StackPanel>
  239. </Grid>
  240. </GroupBox>
  241. <GroupBox
  242. Grid.Row="0"
  243. Grid.RowSpan="2"
  244. Grid.Column="2"
  245. Margin="4,0,0,0"
  246. hc:TitleElement.Background="{StaticResource EmbellishBrush}"
  247. hc:TitleElement.Foreground="{StaticResource LableBrush}"
  248. hc:TitleElement.MinHeight="40"
  249. Background="Transparent"
  250. BorderBrush="Gray"
  251. BorderThickness="1"
  252. FontSize="26"
  253. FontWeight="Black"
  254. Foreground="{StaticResource MainBrush}"
  255. Style="{StaticResource GroupBoxTab}">
  256. <GroupBox.Header>
  257. <Grid Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=GroupBox}, Path=ActualWidth}">
  258. <Grid.ColumnDefinitions>
  259. <ColumnDefinition Width="*" />
  260. <ColumnDefinition Width="50" />
  261. </Grid.ColumnDefinitions>
  262. <TextBlock
  263. Grid.Column="0"
  264. Grid.ColumnSpan="2"
  265. HorizontalAlignment="Center"
  266. VerticalAlignment="Center"
  267. Text="功放控制" />
  268. </Grid>
  269. </GroupBox.Header>
  270. <Grid Margin="4,0,0,0" TextBlock.FontWeight="Normal">
  271. <Grid.RowDefinitions>
  272. <RowDefinition Height="0.3*" />
  273. <RowDefinition Height="0.3*" />
  274. <RowDefinition Height="0.4*" />
  275. </Grid.RowDefinitions>
  276. <StackPanel
  277. Grid.Row="0"
  278. HorizontalAlignment="Center"
  279. VerticalAlignment="Center"
  280. Orientation="Horizontal"
  281. TextBlock.FontSize="16">
  282. <Button
  283. Width="120"
  284. Height="48"
  285. hc:IconElement.Geometry="{StaticResource StartGeometry}"
  286. hc:IconElement.Height="20"
  287. hc:IconElement.Width="20"
  288. Content="打开增益">
  289. <Button.Style>
  290. <Style TargetType="Button" BasedOn="{StaticResource HasIconButton}">
  291. <Style.Setters>
  292. <Setter Property="IsEnabled">
  293. <Setter.Value>
  294. <MultiBinding
  295. Converter="{StaticResource MultiBoolConverter}"
  296. Mode="OneWay">
  297. <Binding Path="GainSwitchEnabled" />
  298. <Binding Converter="{StaticResource Boolean2BooleanReConverter}" Path="GainSwitch" />
  299. </MultiBinding>
  300. </Setter.Value>
  301. </Setter>
  302. </Style.Setters>
  303. </Style>
  304. </Button.Style>
  305. <hc:Interaction.Triggers>
  306. <hc:EventTrigger EventName="Click">
  307. <hc:ExInvokeCommandAction Command="{Binding GainSwitchCommand}" CommandParameter="{x:Static system:Boolean.TrueString}" />
  308. </hc:EventTrigger>
  309. </hc:Interaction.Triggers>
  310. </Button>
  311. <Button
  312. Width="120"
  313. Height="48"
  314. Margin="20,0,0,0"
  315. hc:IconElement.Geometry="{StaticResource StopGeometry}"
  316. hc:IconElement.Height="20"
  317. hc:IconElement.Width="20"
  318. Content="关闭增益">
  319. <Button.Style>
  320. <Style TargetType="Button" BasedOn="{StaticResource HasIconButton}">
  321. <Style.Setters>
  322. <Setter Property="IsEnabled">
  323. <Setter.Value>
  324. <MultiBinding
  325. Converter="{StaticResource MultiBoolConverter}"
  326. Mode="OneWay">
  327. <Binding Path="GainSwitchEnabled" />
  328. <Binding Path="GainSwitch" />
  329. </MultiBinding>
  330. </Setter.Value>
  331. </Setter>
  332. </Style.Setters>
  333. </Style>
  334. </Button.Style>
  335. <hc:Interaction.Triggers>
  336. <hc:EventTrigger EventName="Click">
  337. <hc:ExInvokeCommandAction Command="{Binding GainSwitchCommand}" CommandParameter="{x:Static system:Boolean.FalseString}" />
  338. </hc:EventTrigger>
  339. </hc:Interaction.Triggers>
  340. </Button>
  341. </StackPanel>
  342. <hc:BulletCheckBox
  343. Width="120"
  344. Height="48"
  345. BorderBrush="{StaticResource AuxiliaryBrush}"
  346. CheckedText="开"
  347. IsChecked="{Binding GainSwitch}"
  348. IsEnabled="{Binding GainSwitchEnabled, Mode=OneWay}"
  349. Text="关"
  350. Visibility="Collapsed">
  351. <hc:Interaction.Triggers>
  352. <hc:EventTrigger EventName="Click">
  353. <hc:ExInvokeCommandAction Command="{Binding GainSwitchCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=hc:BulletCheckBox}, Path=IsChecked}" />
  354. </hc:EventTrigger>
  355. </hc:Interaction.Triggers>
  356. </hc:BulletCheckBox>
  357. <Slider
  358. Grid.Row="1"
  359. Width="240"
  360. Height="48"
  361. HorizontalAlignment="Center"
  362. VerticalAlignment="Center"
  363. hc:BorderElement.CornerRadius="6,0,0,6"
  364. BorderBrush="Gray"
  365. BorderThickness="1"
  366. FontSize="{StaticResource TextFontSize}"
  367. Interval="1"
  368. IsEnabled="{Binding GainEnabled, Mode=OneWay}"
  369. IsMoveToPointEnabled="True"
  370. IsSnapToTickEnabled="True"
  371. Maximum="100"
  372. Minimum="0"
  373. Template="{DynamicResource SliderStyle}"
  374. TickFrequency="1"
  375. Value="{Binding Gain}">
  376. <Slider.Background>
  377. <LinearGradientBrush>
  378. <GradientStop Offset="1" Color="#00FA00" />
  379. <GradientStop Offset="0" Color="Green" />
  380. </LinearGradientBrush>
  381. </Slider.Background>
  382. </Slider>
  383. <UniformGrid
  384. Grid.Row="2"
  385. VerticalAlignment="Center"
  386. Columns="3">
  387. <Button
  388. Width="{StaticResource PowerAmplifierButtonSize}"
  389. Height="{StaticResource PowerAmplifierButtonSize}"
  390. Margin="0,10,0,0"
  391. Padding="0"
  392. hc:IconElement.Geometry="{StaticResource StartGeometry}"
  393. Command="{Binding StartCommand}"
  394. Cursor="Hand"
  395. IsEnabled="{Binding StartEnabled}"
  396. Tag="{StaticResource LightEmbellishBrush}"
  397. ToolTip="启动">
  398. <Button.Style>
  399. <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
  400. <Setter Property="Foreground" Value="{StaticResource EmbellishBrush}" />
  401. </Style>
  402. </Button.Style>
  403. </Button>
  404. <Button
  405. Width="{StaticResource PowerAmplifierButtonSize}"
  406. Height="{StaticResource PowerAmplifierButtonSize}"
  407. Margin="0,10,0,0"
  408. Padding="0"
  409. hc:IconElement.Geometry="{StaticResource StopGeometry}"
  410. Command="{Binding StopCommand}"
  411. Cursor="Hand"
  412. IsEnabled="{Binding StopEnabled}"
  413. Tag="{StaticResource LightEmbellishBrush}"
  414. ToolTip="停止">
  415. <Button.Style>
  416. <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
  417. <Setter Property="Foreground" Value="{StaticResource EmbellishBrush}" />
  418. </Style>
  419. </Button.Style>
  420. </Button>
  421. <Button
  422. Width="{StaticResource PowerAmplifierButtonSize}"
  423. Height="{StaticResource PowerAmplifierButtonSize}"
  424. Margin="0,10,0,0"
  425. Padding="0"
  426. hc:IconElement.Geometry="{StaticResource ResetGeometry}"
  427. Command="{Binding ResetCommand}"
  428. Cursor="Hand"
  429. IsEnabled="{Binding ResetEnabled}"
  430. Tag="{StaticResource LightEmbellishBrush}"
  431. ToolTip="报警复位">
  432. <Button.Style>
  433. <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
  434. <Setter Property="Foreground" Value="{StaticResource EmbellishBrush}" />
  435. </Style>
  436. </Button.Style>
  437. </Button>
  438. </UniformGrid>
  439. </Grid>
  440. </GroupBox>
  441. </Grid>
  442. </Viewbox>
  443. </UserControl>