ShakerView.xaml 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. <UserControl
  2. x:Class="ShakerManger.View.ShakerView"
  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:hc="https://handyorg.github.io/handycontrol"
  8. xmlns:local="clr-namespace:ShakerManger.View"
  9. xmlns:mangerdata="clr-namespace:ShakerManger.Data"
  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. <hc:Interaction.Triggers>
  20. <hc:EventTrigger EventName="MouseUp">
  21. <hc:ExInvokeCommandAction Command="{Binding MenuShowCommand}" />
  22. </hc:EventTrigger>
  23. </hc:Interaction.Triggers>
  24. <UserControl.Resources>
  25. <SolidColorBrush x:Key="forecolor" Color="White" />
  26. </UserControl.Resources>
  27. <Border
  28. BorderBrush="Gray"
  29. BorderThickness="1"
  30. CornerRadius="6,6,0,0">
  31. <Grid>
  32. <Grid.RowDefinitions>
  33. <RowDefinition Height="32" />
  34. <RowDefinition Height="*" />
  35. </Grid.RowDefinitions>
  36. <Border
  37. Grid.Row="0"
  38. Margin="-1"
  39. Background="{StaticResource EmbellishBrush}"
  40. CornerRadius="6,6,0,0">
  41. <Grid>
  42. <Grid.Resources>
  43. <system:Double x:Key="buttonwidth">32</system:Double>
  44. <system:Double x:Key="buttonheight">32</system:Double>
  45. </Grid.Resources>
  46. <Grid.ColumnDefinitions>
  47. <ColumnDefinition Width="auto" />
  48. <ColumnDefinition Width="*" />
  49. <ColumnDefinition Width="auto" />
  50. <ColumnDefinition Width="auto" />
  51. <ColumnDefinition Width="auto" />
  52. <ColumnDefinition Width="auto" />
  53. <ColumnDefinition Width="auto" />
  54. <ColumnDefinition Width="auto" />
  55. </Grid.ColumnDefinitions>
  56. <StackPanel Grid.Row="0" Orientation="Horizontal">
  57. <Viewbox Height="18" Margin="4,0,0,0">
  58. <Path>
  59. <Path.Style>
  60. <Style TargetType="Path">
  61. <Style.Triggers>
  62. <DataTrigger Binding="{Binding Path=IsOnline}" Value="True">
  63. <Setter Property="Data" Value="{StaticResource OnlineGeometry}" />
  64. <Setter Property="Fill" Value="{StaticResource SuccessBrush}" />
  65. <Setter Property="ToolTip" Value="控制终端在线" />
  66. </DataTrigger>
  67. <DataTrigger Binding="{Binding Path=IsOnline}" Value="False">
  68. <Setter Property="Data" Value="{StaticResource OfflineGeometry}" />
  69. <Setter Property="Fill" Value="{StaticResource ErrorBrush}" />
  70. <Setter Property="ToolTip" Value="控制终端已离线" />
  71. </DataTrigger>
  72. </Style.Triggers>
  73. </Style>
  74. </Path.Style>
  75. </Path>
  76. </Viewbox>
  77. <Viewbox
  78. Height="18"
  79. Margin="4,0,0,0"
  80. Visibility="{Binding IsOnline, Converter={StaticResource Boolean2VisibilityConverter}}">
  81. <Path Fill="White">
  82. <Path.Style>
  83. <Style TargetType="Path">
  84. <Style.Triggers>
  85. <DataTrigger Binding="{Binding Path=IsRemoteControl}" Value="True">
  86. <Setter Property="Data" Value="{StaticResource RemoteControl}" />
  87. <Setter Property="ToolTip" Value="远程控制" />
  88. </DataTrigger>
  89. <DataTrigger Binding="{Binding Path=IsRemoteControl}" Value="False">
  90. <Setter Property="Data" Value="{StaticResource LocalControl}" />
  91. <Setter Property="ToolTip" Value="本地控制" />
  92. </DataTrigger>
  93. </Style.Triggers>
  94. </Style>
  95. </Path.Style>
  96. </Path>
  97. </Viewbox>
  98. <TextBlock
  99. Margin="4,0,0,0"
  100. HorizontalAlignment="Center"
  101. VerticalAlignment="Center"
  102. FontSize="16"
  103. Foreground="White"
  104. Text="{Binding Title}" />
  105. <StackPanel
  106. Margin="20,0,0,0"
  107. HorizontalAlignment="Center"
  108. VerticalAlignment="Center"
  109. Orientation="Horizontal"
  110. Visibility="{Binding IsOnline, Converter={StaticResource Boolean2VisibilityConverter}}">
  111. <TextBlock
  112. HorizontalAlignment="Center"
  113. VerticalAlignment="Center"
  114. FontSize="14"
  115. FontWeight="Normal"
  116. Text="功放状态:">
  117. <TextBlock.Style>
  118. <Style TargetType="TextBlock">
  119. <Style.Triggers>
  120. <DataTrigger Binding="{Binding CurrentData.OperatingStatus}" Value="{x:Static data:OperatingStatus.Run}">
  121. <Setter Property="Foreground" Value="Green" />
  122. </DataTrigger>
  123. <DataTrigger Binding="{Binding CurrentData.OperatingStatus}" Value="{x:Static data:OperatingStatus.Warn}">
  124. <Setter Property="Foreground" Value="Red" />
  125. </DataTrigger>
  126. <DataTrigger Binding="{Binding CurrentData.OperatingStatus}" Value="{x:Static data:OperatingStatus.Wait}">
  127. <Setter Property="Foreground" Value="Yellow" />
  128. </DataTrigger>
  129. </Style.Triggers>
  130. </Style>
  131. </TextBlock.Style>
  132. </TextBlock>
  133. <Grid
  134. Width="30"
  135. Height="30"
  136. Margin="4,0,0,0">
  137. <Ellipse
  138. Width="30"
  139. Height="30"
  140. HorizontalAlignment="Center"
  141. VerticalAlignment="Center"
  142. Stroke="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=StackPanel}, Path=Children[0].Foreground}"
  143. StrokeThickness="1" />
  144. <Viewbox
  145. Margin="2"
  146. HorizontalAlignment="Center"
  147. VerticalAlignment="Center">
  148. <Ellipse
  149. Width="20"
  150. Height="{Binding RelativeSource={RelativeSource Mode=Self}, Path=ActualWidth}"
  151. HorizontalAlignment="Center"
  152. VerticalAlignment="Center"
  153. Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=StackPanel}, Path=Children[0].Foreground}" />
  154. </Viewbox>
  155. </Grid>
  156. <TextBlock
  157. Margin="4,0,0,0"
  158. VerticalAlignment="Center"
  159. FontSize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=StackPanel}, Path=Children[0].FontSize}"
  160. Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=StackPanel}, Path=Children[0].Foreground}"
  161. Text="{Binding CurrentData.OperatingStatus, Converter={StaticResource EnumToDescription}}" />
  162. <TextBlock
  163. Margin="20,0,0,0"
  164. HorizontalAlignment="Center"
  165. VerticalAlignment="Center"
  166. FontSize="14"
  167. FontWeight="Normal"
  168. Text="冷却单元状态:"
  169. Visibility="Collapsed">
  170. <TextBlock.Style>
  171. <Style TargetType="TextBlock">
  172. <Style.Triggers>
  173. <DataTrigger Binding="{Binding CurrentData.CoolingWaterStatus}" Value="{x:Static data:CoolingWaterOperatingStatus.Run}">
  174. <Setter Property="Foreground" Value="Green" />
  175. </DataTrigger>
  176. <DataTrigger Binding="{Binding CurrentData.CoolingWaterStatus}" Value="{x:Static data:CoolingWaterOperatingStatus.Warn}">
  177. <Setter Property="Foreground" Value="Red" />
  178. </DataTrigger>
  179. <DataTrigger Binding="{Binding CurrentData.CoolingWaterStatus}" Value="{x:Static data:CoolingWaterOperatingStatus.Wait}">
  180. <Setter Property="Foreground" Value="Yellow" />
  181. </DataTrigger>
  182. </Style.Triggers>
  183. </Style>
  184. </TextBlock.Style>
  185. </TextBlock>
  186. <Ellipse
  187. Width="30"
  188. Height="30"
  189. Margin="4,0,0,0"
  190. Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=StackPanel}, Path=Children[2].Foreground}"
  191. Visibility="Collapsed" />
  192. </StackPanel>
  193. </StackPanel>
  194. <Button
  195. Grid.Column="2"
  196. Width="{StaticResource buttonwidth}"
  197. hc:IconElement.Geometry="{StaticResource RequestPermissions}"
  198. hc:IconElement.Width="{StaticResource buttonwidth}"
  199. Command="{Binding RequestPermissionsCommand}"
  200. Cursor="Hand"
  201. RenderTransformOrigin="0.5,0.5"
  202. ToolTip="申请控制权限"
  203. Visibility="{Binding RelativeSource={RelativeSource Mode=Self}, Path=IsEnabled, Converter={StaticResource Boolean2VisibilityConverter}}">
  204. <Button.Style>
  205. <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
  206. <Setter Property="Foreground" Value="{StaticResource MainBrush}" />
  207. <Setter Property="IsEnabled">
  208. <Setter.Value>
  209. <MultiBinding Converter="{StaticResource MultiBoolConverter}">
  210. <Binding Path="IsOnline" />
  211. <Binding
  212. Converter="{StaticResource Boolean2BooleanReConverter}"
  213. Path="Data.IsAnonymous"
  214. Source="{StaticResource Login}" />
  215. <Binding Converter="{StaticResource Boolean2BooleanReConverter}" Path="IsRemoteControl" />
  216. </MultiBinding>
  217. </Setter.Value>
  218. </Setter>
  219. </Style>
  220. </Button.Style>
  221. </Button>
  222. <Button
  223. Grid.Column="3"
  224. Width="{StaticResource buttonwidth}"
  225. Margin="20,0,0,0"
  226. hc:IconElement.Geometry="M672 192v64h-512A96 96 0 0 0 64 352v129.6c0 52.992 43.008 96 96.32 96l511.552-1.728 0.256 64-512.128 1.728a160 160 0 0 1-160-160V352A160 160 0 0 1 160 192h512zM640 448V384h480A160 160 0 0 1 1280 544v128a160 160 0 0 1-160 160H640v-64h480a96 96 0 0 0 96-96v-128A96 96 0 0 0 1120 448H640z m128-448h64v192h-64V0zM448 832h64v192H448v-192z m-160-77.248l45.248 45.248L160 973.248l-45.248-45.248L288 754.752z m768-704l45.248 45.248L928 269.248l-45.248-45.248L1056 50.752z"
  227. hc:IconElement.Width="{StaticResource buttonwidth}"
  228. Command="{Binding DisConnectCommand}"
  229. Cursor="Hand"
  230. RenderTransformOrigin="0.5,0.5"
  231. ToolTip="断开连接"
  232. Visibility="{Binding RelativeSource={RelativeSource Mode=Self}, Path=IsEnabled, Converter={StaticResource Boolean2VisibilityConverter}}">
  233. <Button.Style>
  234. <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
  235. <Setter Property="Foreground" Value="{StaticResource MainBrush}" />
  236. <Setter Property="IsEnabled">
  237. <Setter.Value>
  238. <MultiBinding Converter="{StaticResource MultiBoolConverter}">
  239. <Binding Path="IsRemoteControl" />
  240. <Binding
  241. Converter="{StaticResource Boolean2BooleanReConverter}"
  242. Path="Data.IsAnonymous"
  243. Source="{StaticResource Login}" />
  244. <Binding Path="IsConnected" />
  245. </MultiBinding>
  246. </Setter.Value>
  247. </Setter>
  248. </Style>
  249. </Button.Style>
  250. </Button>
  251. <Button
  252. Grid.Column="4"
  253. Width="{StaticResource buttonwidth}"
  254. Margin="20,0,0,0"
  255. hc:IconElement.Geometry="{StaticResource PlotConfigGeometry}"
  256. hc:IconElement.Width="{StaticResource buttonwidth}"
  257. Cursor="Hand">
  258. <Button.Style>
  259. <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
  260. <Setter Property="Foreground" Value="{StaticResource MainBrush}" />
  261. <Style.Triggers>
  262. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.None}">
  263. <Setter Property="Visibility" Value="Collapsed" />
  264. </DataTrigger>
  265. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.ShakerControl}">
  266. <Setter Property="Visibility" Value="Collapsed" />
  267. </DataTrigger>
  268. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.Plot}">
  269. <Setter Property="Visibility" Value="Visible" />
  270. </DataTrigger>
  271. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.CoolingWater}">
  272. <Setter Property="Visibility" Value="Collapsed" />
  273. </DataTrigger>
  274. </Style.Triggers>
  275. </Style>
  276. </Button.Style>
  277. <hc:Interaction.Triggers>
  278. <hc:EventTrigger EventName="Click">
  279. <hc:SetPropertyAction
  280. PropertyName="SetPlotConfigIsOpen"
  281. PropertyValue="True"
  282. TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}, Path=DataContext}" />
  283. </hc:EventTrigger>
  284. </hc:Interaction.Triggers>
  285. </Button>
  286. <Button
  287. Grid.Column="5"
  288. Width="{StaticResource buttonwidth}"
  289. Margin="20,0,0,0"
  290. hc:IconElement.Geometry="m840.336,401.168c-12.736,-12.736 -33.408,-12.736 -46.144,0l-346.176,346.176l-346.176,-346.176c-12.736,-12.736 -33.408,-12.736 -46.144,0l-46.144,46.144c-12.736,12.736 -12.736,33.408 0,46.144l415.36,415.36c12.736,12.736 33.408,12.736 46.144,0l415.36,-415.36c12.736,-12.736 12.736,-33.408 0,-46.144l-46.08,-46.144zm-415.424,116.096c12.736,12.736 33.408,12.736 46.144,0l415.36,-415.36c12.736,-12.736 12.736,-33.408 0,-46.144l-46.08,-46.208c-12.736,-12.736 -33.408,-12.736 -46.144,0l-346.176,346.176l-346.176,-346.176c-12.736,-12.736 -33.408,-12.736 -46.144,0l-46.144,46.144c-12.736,12.736 -12.736,33.408 0,46.144l415.36,415.424z"
  291. hc:IconElement.Width="{StaticResource buttonwidth}"
  292. Cursor="Hand"
  293. RenderTransformOrigin="0.5,0.5">
  294. <Button.Style>
  295. <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
  296. <Setter Property="Foreground" Value="{StaticResource MainBrush}" />
  297. </Style>
  298. </Button.Style>
  299. <hc:Interaction.Triggers>
  300. <hc:EventTrigger EventName="Click">
  301. <hc:ExInvokeCommandAction Command="{Binding Source={StaticResource MainViewModel}, Path=Data.Shakers.SelectShakerCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}, Path=DataContext}" />
  302. </hc:EventTrigger>
  303. </hc:Interaction.Triggers>
  304. </Button>
  305. <Button
  306. Grid.Column="7"
  307. Width="{StaticResource buttonwidth}"
  308. Margin="20,0,20,0"
  309. hc:IconElement.Width="{StaticResource buttonwidth}"
  310. Cursor="Hand">
  311. <Button.Style>
  312. <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
  313. <Setter Property="hc:IconElement.Geometry" Value="{StaticResource WindowMaxGeometry}" />
  314. <Setter Property="ToolTip" Value="最大化" />
  315. <Setter Property="Foreground" Value="{StaticResource MainBrush}" />
  316. <Style.Triggers>
  317. <DataTrigger Binding="{Binding Path=IsMax}" Value="True">
  318. <Setter Property="hc:IconElement.Geometry" Value="{StaticResource WindowRestoreGeometry}" />
  319. <Setter Property="ToolTip" Value="还原" />
  320. </DataTrigger>
  321. </Style.Triggers>
  322. </Style>
  323. </Button.Style>
  324. <hc:Interaction.Triggers>
  325. <hc:EventTrigger EventName="Click">
  326. <hc:ExInvokeCommandAction Command="{Binding Source={StaticResource MainViewModel}, Path=Data.Shakers.MaxOrMinCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}, Path=DataContext}" />
  327. </hc:EventTrigger>
  328. </hc:Interaction.Triggers>
  329. </Button>
  330. </Grid>
  331. </Border>
  332. <local:ShakerCoolingWaterView Grid.Row="1">
  333. <local:ShakerCoolingWaterView.Style>
  334. <Style TargetType="local:ShakerCoolingWaterView">
  335. <Style.Triggers>
  336. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.None}">
  337. <Setter Property="Visibility" Value="Collapsed" />
  338. </DataTrigger>
  339. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.ShakerControl}">
  340. <Setter Property="Visibility" Value="Collapsed" />
  341. </DataTrigger>
  342. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.Plot}">
  343. <Setter Property="Visibility" Value="Collapsed" />
  344. </DataTrigger>
  345. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.CoolingWater}">
  346. <Setter Property="Visibility" Value="Visible" />
  347. </DataTrigger>
  348. </Style.Triggers>
  349. </Style>
  350. </local:ShakerCoolingWaterView.Style>
  351. </local:ShakerCoolingWaterView>
  352. <local:ShakerInfoView Grid.Row="1">
  353. <local:ShakerInfoView.Style>
  354. <Style TargetType="local:ShakerInfoView">
  355. <Style.Triggers>
  356. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.None}">
  357. <Setter Property="Visibility" Value="Collapsed" />
  358. </DataTrigger>
  359. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.ShakerControl}">
  360. <Setter Property="Visibility" Value="Visible" />
  361. </DataTrigger>
  362. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.Plot}">
  363. <Setter Property="Visibility" Value="Collapsed" />
  364. </DataTrigger>
  365. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.CoolingWater}">
  366. <Setter Property="Visibility" Value="Collapsed" />
  367. </DataTrigger>
  368. </Style.Triggers>
  369. </Style>
  370. </local:ShakerInfoView.Style>
  371. </local:ShakerInfoView>
  372. <oxyplot:PlotView
  373. Grid.Row="1"
  374. Margin="0,0,4,0"
  375. Background="Transparent"
  376. Controller="{Binding PlotController}"
  377. Model="{Binding PlotModel}">
  378. <oxyplot:PlotView.Style>
  379. <Style TargetType="oxyplot:PlotView">
  380. <Style.Triggers>
  381. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.None}">
  382. <Setter Property="Visibility" Value="Collapsed" />
  383. </DataTrigger>
  384. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.ShakerControl}">
  385. <Setter Property="Visibility" Value="Collapsed" />
  386. </DataTrigger>
  387. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.Plot}">
  388. <Setter Property="Visibility" Value="Visible" />
  389. </DataTrigger>
  390. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.CoolingWater}">
  391. <Setter Property="Visibility" Value="Collapsed" />
  392. </DataTrigger>
  393. </Style.Triggers>
  394. </Style>
  395. </oxyplot:PlotView.Style>
  396. <oxyplot:PlotView.DefaultTrackerTemplate>
  397. <ControlTemplate>
  398. <oxy:TrackerControl
  399. Background="#6F999999"
  400. BorderBrush="Gray"
  401. BorderEdgeMode="Unspecified"
  402. BorderThickness="1"
  403. CornerRadius="6"
  404. LineStroke="{StaticResource AuxiliaryBrush}"
  405. Position="{Binding Position}"
  406. ShowPointer="False">
  407. <oxy:TrackerControl.Content>
  408. <TextBlock Margin="6" Text="{Binding}" />
  409. </oxy:TrackerControl.Content>
  410. </oxy:TrackerControl>
  411. </ControlTemplate>
  412. </oxyplot:PlotView.DefaultTrackerTemplate>
  413. </oxyplot:PlotView>
  414. <Grid Grid.Row="1">
  415. <Grid.Style>
  416. <Style TargetType="Grid">
  417. <Style.Triggers>
  418. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.None}">
  419. <Setter Property="Visibility" Value="Visible" />
  420. </DataTrigger>
  421. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.ShakerControl}">
  422. <Setter Property="Visibility" Value="Collapsed" />
  423. </DataTrigger>
  424. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.Plot}">
  425. <Setter Property="Visibility" Value="Collapsed" />
  426. </DataTrigger>
  427. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.CoolingWater}">
  428. <Setter Property="Visibility" Value="Collapsed" />
  429. </DataTrigger>
  430. </Style.Triggers>
  431. </Style>
  432. </Grid.Style>
  433. <StackPanel
  434. HorizontalAlignment="Center"
  435. VerticalAlignment="Center"
  436. Orientation="Vertical">
  437. <TextBlock
  438. HorizontalAlignment="Center"
  439. VerticalAlignment="Center"
  440. FontSize="22"
  441. Foreground="{DynamicResource ErrorBrush}"
  442. Text="当前控制台未上线" />
  443. <Button
  444. Width="126"
  445. Height="46"
  446. Margin="0,10,0,0"
  447. hc:IconElement.Geometry="{StaticResource LinkGeometry}"
  448. hc:IconElement.Height="20"
  449. hc:IconElement.Width="20"
  450. Command="{Binding ConnectCommand}"
  451. Content="连接功放"
  452. FontSize="14">
  453. <Button.Style>
  454. <Style TargetType="Button" BasedOn="{StaticResource HasIconButton}">
  455. <Setter Property="IsEnabled">
  456. <Setter.Value>
  457. <MultiBinding Converter="{StaticResource MultiBoolConverter}">
  458. <Binding Path="IsOnline" />
  459. <Binding
  460. Converter="{StaticResource Boolean2BooleanReConverter}"
  461. Path="Data.IsAnonymous"
  462. Source="{StaticResource Login}" />
  463. </MultiBinding>
  464. </Setter.Value>
  465. </Setter>
  466. </Style>
  467. </Button.Style>
  468. </Button>
  469. </StackPanel>
  470. </Grid>
  471. <Popup
  472. AllowsTransparency="True"
  473. IsOpen="{Binding SetPlotConfigIsOpen}"
  474. Placement="Mouse"
  475. PopupAnimation="Scroll"
  476. StaysOpen="True">
  477. <local:SetPlotConfigView />
  478. </Popup>
  479. <Popup
  480. AllowsTransparency="True"
  481. IsOpen="{Binding MenuIsOpen}"
  482. Placement="Mouse"
  483. PopupAnimation="Slide"
  484. StaysOpen="True">
  485. <Border
  486. Width="240"
  487. Height="180"
  488. Background="{StaticResource MainBrush}"
  489. BorderBrush="{StaticResource AuxiliaryBrush}"
  490. BorderThickness="1"
  491. CornerRadius="6">
  492. <StackPanel Margin="0,10,0,0" Orientation="Vertical">
  493. <Border Height="32" Cursor="Hand">
  494. <Border.Style>
  495. <Style TargetType="Border">
  496. <Style.Triggers>
  497. <Trigger Property="IsMouseOver" Value="True">
  498. <Setter Property="Background" Value="{StaticResource ButtonFocusedColor}" />
  499. </Trigger>
  500. </Style.Triggers>
  501. </Style>
  502. </Border.Style>
  503. <hc:Interaction.Triggers>
  504. <hc:EventTrigger EventName="MouseUp">
  505. <hc:SetPropertyAction
  506. PropertyName="MenuIsOpen"
  507. PropertyValue="{x:Static system:Boolean.FalseString}"
  508. TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Border}, Path=DataContext}" />
  509. <hc:ExInvokeCommandAction Command="{Binding Source={StaticResource MainViewModel}, Path=Data.Shakers.AutoLayoutCommand}" />
  510. </hc:EventTrigger>
  511. </hc:Interaction.Triggers>
  512. <TextBlock
  513. Margin="10,0,0,0"
  514. HorizontalAlignment="Left"
  515. VerticalAlignment="Center"
  516. FontSize="14"
  517. Text="自动布局" />
  518. </Border>
  519. <Border Height="32" Cursor="Hand">
  520. <Border.Style>
  521. <Style TargetType="Border">
  522. <Style.Triggers>
  523. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.None}">
  524. <Setter Property="IsEnabled" Value="False" />
  525. </DataTrigger>
  526. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.ShakerControl}">
  527. <Setter Property="IsEnabled" Value="True" />
  528. </DataTrigger>
  529. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.Plot}">
  530. <Setter Property="IsEnabled" Value="True" />
  531. </DataTrigger>
  532. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.CoolingWater}">
  533. <Setter Property="IsEnabled" Value="True" />
  534. </DataTrigger>
  535. <Trigger Property="IsMouseOver" Value="True">
  536. <Setter Property="Background" Value="{StaticResource ButtonFocusedColor}" />
  537. </Trigger>
  538. </Style.Triggers>
  539. </Style>
  540. </Border.Style>
  541. <StackPanel Margin="10,0,0,0" Orientation="Horizontal">
  542. <TextBlock
  543. VerticalAlignment="Center"
  544. FontSize="14"
  545. Text="显示内容">
  546. <TextBlock.Style>
  547. <Style TargetType="TextBlock">
  548. <Style.Triggers>
  549. <Trigger Property="IsEnabled" Value="False">
  550. <Setter Property="Foreground" Value="Gray" />
  551. </Trigger>
  552. </Style.Triggers>
  553. </Style>
  554. </TextBlock.Style>
  555. </TextBlock>
  556. <ComboBox
  557. Width="120"
  558. Margin="4,0,0,0"
  559. VerticalAlignment="Center"
  560. Background="Transparent"
  561. DisplayMemberPath="Description"
  562. FontSize="14"
  563. ItemsSource="{Binding ShakerView, Converter={StaticResource EnumToCollectionConverter}, ConverterParameter='1,2,3', Mode=OneTime}"
  564. SelectedValue="{Binding ShakerView}"
  565. SelectedValuePath="Value"
  566. Style="{StaticResource ComboBoxStyle1}" />
  567. </StackPanel>
  568. </Border>
  569. <Border Height="32" Cursor="Hand">
  570. <Border.Style>
  571. <Style TargetType="Border">
  572. <Style.Triggers>
  573. <Trigger Property="IsMouseOver" Value="True">
  574. <Setter Property="Background" Value="{StaticResource ButtonFocusedColor}" />
  575. </Trigger>
  576. </Style.Triggers>
  577. </Style>
  578. </Border.Style>
  579. <hc:Interaction.Triggers>
  580. <hc:EventTrigger EventName="MouseUp">
  581. <hc:SetPropertyAction
  582. PropertyName="MenuIsOpen"
  583. PropertyValue="{x:Static system:Boolean.FalseString}"
  584. TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Border}, Path=DataContext}" />
  585. </hc:EventTrigger>
  586. </hc:Interaction.Triggers>
  587. <TextBlock
  588. Margin="10,0,0,0"
  589. HorizontalAlignment="Left"
  590. VerticalAlignment="Center"
  591. FontSize="14"
  592. Text="关闭" />
  593. </Border>
  594. </StackPanel>
  595. </Border>
  596. </Popup>
  597. </Grid>
  598. </Border>
  599. </UserControl>