ShakerView.xaml 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  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 ButtonNomalColor}"
  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="Green" />
  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="Red" />
  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. <Ellipse
  134. Width="30"
  135. Height="30"
  136. Margin="4,0,0,0"
  137. Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=StackPanel}, Path=Children[0].Foreground}" />
  138. <TextBlock
  139. Margin="20,0,0,0"
  140. HorizontalAlignment="Center"
  141. VerticalAlignment="Center"
  142. FontSize="14"
  143. FontWeight="Normal"
  144. Text="冷却单元状态:"
  145. Visibility="{Binding AllowCoolingWater, Converter={StaticResource Boolean2VisibilityConverter}}">
  146. <TextBlock.Style>
  147. <Style TargetType="TextBlock">
  148. <Style.Triggers>
  149. <DataTrigger Binding="{Binding CurrentData.CoolingWaterStatus}" Value="{x:Static data:CoolingWaterOperatingStatus.Run}">
  150. <Setter Property="Foreground" Value="Green" />
  151. </DataTrigger>
  152. <DataTrigger Binding="{Binding CurrentData.CoolingWaterStatus}" Value="{x:Static data:CoolingWaterOperatingStatus.Warn}">
  153. <Setter Property="Foreground" Value="Red" />
  154. </DataTrigger>
  155. <DataTrigger Binding="{Binding CurrentData.CoolingWaterStatus}" Value="{x:Static data:CoolingWaterOperatingStatus.Wait}">
  156. <Setter Property="Foreground" Value="Yellow" />
  157. </DataTrigger>
  158. </Style.Triggers>
  159. </Style>
  160. </TextBlock.Style>
  161. </TextBlock>
  162. <Ellipse
  163. Width="30"
  164. Height="30"
  165. Margin="4,0,0,0"
  166. Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=StackPanel}, Path=Children[2].Foreground}"
  167. Visibility="{Binding AllowCoolingWater, Converter={StaticResource Boolean2VisibilityConverter}}" />
  168. </StackPanel>
  169. </StackPanel>
  170. <Button
  171. Grid.Column="2"
  172. Width="{StaticResource buttonwidth}"
  173. hc:IconElement.Geometry="{StaticResource RequestPermissions}"
  174. hc:IconElement.Width="{StaticResource buttonwidth}"
  175. Command="{Binding RequestPermissionsCommand}"
  176. Cursor="Hand"
  177. RenderTransformOrigin="0.5,0.5"
  178. ToolTip="申请控制权限"
  179. Visibility="{Binding IsRemoteControl, Converter={StaticResource Boolean2VisibilityReConverter}}">
  180. <Button.Style>
  181. <Style BasedOn="{StaticResource ImageButton}" TargetType="Button">
  182. <Setter Property="IsEnabled">
  183. <Setter.Value>
  184. <MultiBinding Converter="{StaticResource MultiBoolConverter}">
  185. <Binding Path="IsOnline" />
  186. <Binding
  187. Converter="{StaticResource Boolean2BooleanReConverter}"
  188. Path="Data.IsAnonymous"
  189. Source="{StaticResource Login}" />
  190. </MultiBinding>
  191. </Setter.Value>
  192. </Setter>
  193. </Style>
  194. </Button.Style>
  195. </Button>
  196. <Button
  197. Grid.Column="3"
  198. Width="{StaticResource buttonwidth}"
  199. Margin="20,0,0,0"
  200. 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"
  201. hc:IconElement.Width="{StaticResource buttonwidth}"
  202. Command="{Binding DisConnectCommand}"
  203. Cursor="Hand"
  204. RenderTransformOrigin="0.5,0.5"
  205. ToolTip="断开连接"
  206. Visibility="{Binding IsConnected, Converter={StaticResource Boolean2VisibilityConverter}}">
  207. <Button.Style>
  208. <Style BasedOn="{StaticResource ImageButton}" TargetType="Button">
  209. <Setter Property="IsEnabled">
  210. <Setter.Value>
  211. <MultiBinding Converter="{StaticResource MultiBoolConverter}">
  212. <Binding Path="IsRemoteControl" />
  213. <Binding
  214. Converter="{StaticResource Boolean2BooleanReConverter}"
  215. Path="Data.IsAnonymous"
  216. Source="{StaticResource Login}" />
  217. </MultiBinding>
  218. </Setter.Value>
  219. </Setter>
  220. </Style>
  221. </Button.Style>
  222. </Button>
  223. <Button
  224. Grid.Column="4"
  225. Width="{StaticResource buttonwidth}"
  226. Margin="20,0,0,0"
  227. hc:IconElement.Geometry="{StaticResource PlotConfigGeometry}"
  228. hc:IconElement.Width="{StaticResource buttonwidth}"
  229. Cursor="Hand">
  230. <Button.Style>
  231. <Style BasedOn="{StaticResource ImageButton}" TargetType="Button">
  232. <Style.Triggers>
  233. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.None}">
  234. <Setter Property="IsEnabled" Value="False" />
  235. </DataTrigger>
  236. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.ShakerControl}">
  237. <Setter Property="IsEnabled" Value="False" />
  238. </DataTrigger>
  239. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.Plot}">
  240. <Setter Property="IsEnabled" Value="True" />
  241. </DataTrigger>
  242. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.CoolingWater}">
  243. <Setter Property="IsEnabled" Value="False" />
  244. </DataTrigger>
  245. </Style.Triggers>
  246. </Style>
  247. </Button.Style>
  248. <hc:Interaction.Triggers>
  249. <hc:EventTrigger EventName="Click">
  250. <hc:SetPropertyAction
  251. PropertyName="SetPlotConfigIsOpen"
  252. PropertyValue="True"
  253. TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}, Path=DataContext}" />
  254. </hc:EventTrigger>
  255. </hc:Interaction.Triggers>
  256. </Button>
  257. <Button
  258. x:Name="shakerselct"
  259. Grid.Column="5"
  260. Width="{StaticResource buttonwidth}"
  261. Margin="20,0,0,0"
  262. 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"
  263. hc:IconElement.Width="{StaticResource buttonwidth}"
  264. Cursor="Hand"
  265. RenderTransformOrigin="0.5,0.5"
  266. Style="{StaticResource ImageButton}">
  267. <hc:Interaction.Triggers>
  268. <hc:EventTrigger EventName="Click">
  269. <hc:ExInvokeCommandAction Command="{Binding Source={StaticResource MainViewModel}, Path=Data.Shakers.SelectShakerCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}, Path=DataContext}" />
  270. </hc:EventTrigger>
  271. </hc:Interaction.Triggers>
  272. </Button>
  273. <Button
  274. Grid.Column="7"
  275. Width="{StaticResource buttonwidth}"
  276. Margin="20,0,20,0"
  277. hc:IconElement.Width="{StaticResource buttonwidth}"
  278. Cursor="Hand">
  279. <Button.Style>
  280. <Style BasedOn="{StaticResource ImageButton}" TargetType="Button">
  281. <Setter Property="hc:IconElement.Geometry" Value="{StaticResource WindowMaxGeometry}" />
  282. <Setter Property="ToolTip" Value="最大化" />
  283. <Style.Triggers>
  284. <DataTrigger Binding="{Binding Path=IsMax}" Value="True">
  285. <Setter Property="hc:IconElement.Geometry" Value="{StaticResource WindowRestoreGeometry}" />
  286. <Setter Property="ToolTip" Value="还原" />
  287. </DataTrigger>
  288. </Style.Triggers>
  289. </Style>
  290. </Button.Style>
  291. <hc:Interaction.Triggers>
  292. <hc:EventTrigger EventName="Click">
  293. <hc:ExInvokeCommandAction Command="{Binding Source={StaticResource MainViewModel}, Path=Data.Shakers.MaxOrMinCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}, Path=DataContext}" />
  294. </hc:EventTrigger>
  295. </hc:Interaction.Triggers>
  296. </Button>
  297. </Grid>
  298. </Border>
  299. <local:ShakerCoolingWaterView Grid.Row="1">
  300. <local:ShakerCoolingWaterView.Style>
  301. <Style TargetType="local:ShakerCoolingWaterView">
  302. <Style.Triggers>
  303. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.None}">
  304. <Setter Property="Visibility" Value="Collapsed" />
  305. </DataTrigger>
  306. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.ShakerControl}">
  307. <Setter Property="Visibility" Value="Collapsed" />
  308. </DataTrigger>
  309. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.Plot}">
  310. <Setter Property="Visibility" Value="Collapsed" />
  311. </DataTrigger>
  312. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.CoolingWater}">
  313. <Setter Property="Visibility" Value="Visible" />
  314. </DataTrigger>
  315. </Style.Triggers>
  316. </Style>
  317. </local:ShakerCoolingWaterView.Style>
  318. </local:ShakerCoolingWaterView>
  319. <local:ShakerInfoView Grid.Row="1">
  320. <local:ShakerInfoView.Style>
  321. <Style TargetType="local:ShakerInfoView">
  322. <Style.Triggers>
  323. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.None}">
  324. <Setter Property="Visibility" Value="Collapsed" />
  325. </DataTrigger>
  326. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.ShakerControl}">
  327. <Setter Property="Visibility" Value="Visible" />
  328. </DataTrigger>
  329. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.Plot}">
  330. <Setter Property="Visibility" Value="Collapsed" />
  331. </DataTrigger>
  332. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.CoolingWater}">
  333. <Setter Property="Visibility" Value="Collapsed" />
  334. </DataTrigger>
  335. </Style.Triggers>
  336. </Style>
  337. </local:ShakerInfoView.Style>
  338. </local:ShakerInfoView>
  339. <oxyplot:PlotView
  340. Grid.Row="1"
  341. Background="Transparent"
  342. Controller="{Binding PlotController}"
  343. Model="{Binding PlotModel}">
  344. <oxyplot:PlotView.Style>
  345. <Style TargetType="oxyplot:PlotView">
  346. <Style.Triggers>
  347. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.None}">
  348. <Setter Property="Visibility" Value="Collapsed" />
  349. </DataTrigger>
  350. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.ShakerControl}">
  351. <Setter Property="Visibility" Value="Collapsed" />
  352. </DataTrigger>
  353. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.Plot}">
  354. <Setter Property="Visibility" Value="Visible" />
  355. </DataTrigger>
  356. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.CoolingWater}">
  357. <Setter Property="Visibility" Value="Collapsed" />
  358. </DataTrigger>
  359. </Style.Triggers>
  360. </Style>
  361. </oxyplot:PlotView.Style>
  362. <oxyplot:PlotView.DefaultTrackerTemplate>
  363. <ControlTemplate>
  364. <oxy:TrackerControl
  365. Background="#6F999999"
  366. BorderBrush="Gray"
  367. BorderEdgeMode="Unspecified"
  368. BorderThickness="1"
  369. CornerRadius="6"
  370. LineStroke="White"
  371. Position="{Binding Position}"
  372. ShowPointer="False">
  373. <oxy:TrackerControl.Content>
  374. <TextBlock Margin="6" Text="{Binding}" />
  375. </oxy:TrackerControl.Content>
  376. </oxy:TrackerControl>
  377. </ControlTemplate>
  378. </oxyplot:PlotView.DefaultTrackerTemplate>
  379. </oxyplot:PlotView>
  380. <Grid Grid.Row="1">
  381. <Grid.Style>
  382. <Style TargetType="Grid">
  383. <Style.Triggers>
  384. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.None}">
  385. <Setter Property="Visibility" Value="Visible" />
  386. </DataTrigger>
  387. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.ShakerControl}">
  388. <Setter Property="Visibility" Value="Collapsed" />
  389. </DataTrigger>
  390. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.Plot}">
  391. <Setter Property="Visibility" Value="Collapsed" />
  392. </DataTrigger>
  393. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.CoolingWater}">
  394. <Setter Property="Visibility" Value="Collapsed" />
  395. </DataTrigger>
  396. </Style.Triggers>
  397. </Style>
  398. </Grid.Style>
  399. <StackPanel
  400. HorizontalAlignment="Center"
  401. VerticalAlignment="Center"
  402. Orientation="Vertical">
  403. <TextBlock
  404. HorizontalAlignment="Center"
  405. VerticalAlignment="Center"
  406. FontSize="22"
  407. Foreground="Red"
  408. Text="当前控制台未上线" />
  409. <Button
  410. Width="126"
  411. Height="46"
  412. Margin="0,10,0,0"
  413. Command="{Binding ConnectCommand}"
  414. Content="连接功放"
  415. FontSize="14">
  416. <Button.Style>
  417. <Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button">
  418. <Setter Property="IsEnabled">
  419. <Setter.Value>
  420. <MultiBinding Converter="{StaticResource MultiBoolConverter}">
  421. <Binding Path="IsOnline" />
  422. <Binding
  423. Converter="{StaticResource Boolean2BooleanReConverter}"
  424. Path="Data.IsAnonymous"
  425. Source="{StaticResource Login}" />
  426. </MultiBinding>
  427. </Setter.Value>
  428. </Setter>
  429. </Style>
  430. </Button.Style>
  431. </Button>
  432. </StackPanel>
  433. </Grid>
  434. <Popup
  435. AllowsTransparency="True"
  436. IsOpen="{Binding SetPlotConfigIsOpen}"
  437. Placement="Mouse"
  438. PopupAnimation="Scroll"
  439. StaysOpen="True">
  440. <local:SetPlotConfigView />
  441. </Popup>
  442. <Popup
  443. IsOpen="{Binding MenuIsOpen}"
  444. Placement="Mouse"
  445. PopupAnimation="Slide"
  446. StaysOpen="True">
  447. <Border
  448. Width="240"
  449. Height="180"
  450. Background="White"
  451. CornerRadius="6">
  452. <StackPanel Margin="0,10,0,0" Orientation="Vertical">
  453. <Border Height="32" Cursor="Hand">
  454. <Border.Style>
  455. <Style TargetType="Border">
  456. <Style.Triggers>
  457. <Trigger Property="IsMouseOver" Value="True">
  458. <Setter Property="Background" Value="{StaticResource ButtonFocusedColor}" />
  459. </Trigger>
  460. </Style.Triggers>
  461. </Style>
  462. </Border.Style>
  463. <hc:Interaction.Triggers>
  464. <hc:EventTrigger EventName="MouseUp">
  465. <hc:SetPropertyAction
  466. PropertyName="MenuIsOpen"
  467. PropertyValue="{x:Static system:Boolean.FalseString}"
  468. TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Border}, Path=DataContext}" />
  469. <hc:ExInvokeCommandAction Command="{Binding Source={StaticResource MainViewModel}, Path=Data.Shakers.AutoLayoutCommand}" />
  470. </hc:EventTrigger>
  471. </hc:Interaction.Triggers>
  472. <TextBlock
  473. Margin="10,0,0,0"
  474. HorizontalAlignment="Left"
  475. VerticalAlignment="Center"
  476. FontSize="14"
  477. Text="自动布局" />
  478. </Border>
  479. <Border Height="32" Cursor="Hand">
  480. <Border.Style>
  481. <Style TargetType="Border">
  482. <Style.Triggers>
  483. <Trigger Property="IsMouseOver" Value="True">
  484. <Setter Property="Background" Value="{StaticResource ButtonFocusedColor}" />
  485. </Trigger>
  486. </Style.Triggers>
  487. </Style>
  488. </Border.Style>
  489. <StackPanel Margin="10,0,0,0" Orientation="Horizontal">
  490. <StackPanel.Style>
  491. <Style TargetType="StackPanel">
  492. <Style.Triggers>
  493. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.None}">
  494. <Setter Property="Visibility" Value="Collapsed" />
  495. </DataTrigger>
  496. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.ShakerControl}">
  497. <Setter Property="Visibility" Value="Visible" />
  498. </DataTrigger>
  499. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.Plot}">
  500. <Setter Property="Visibility" Value="Visible" />
  501. </DataTrigger>
  502. <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.CoolingWater}">
  503. <Setter Property="Visibility" Value="Visible" />
  504. </DataTrigger>
  505. </Style.Triggers>
  506. </Style>
  507. </StackPanel.Style>
  508. <TextBlock
  509. VerticalAlignment="Center"
  510. FontSize="14"
  511. Text="显示内容" />
  512. <ComboBox
  513. Width="120"
  514. Margin="4,0,0,0"
  515. VerticalAlignment="Center"
  516. Background="Transparent"
  517. DisplayMemberPath="Description"
  518. FontSize="14"
  519. ItemsSource="{Binding ShakerView, Converter={StaticResource EnumToCollectionConverter}, ConverterParameter='1,2,3', Mode=OneTime}"
  520. SelectedValue="{Binding ShakerView}"
  521. SelectedValuePath="Value"
  522. Style="{StaticResource ComboBoxStyle1}" />
  523. </StackPanel>
  524. </Border>
  525. <Border Height="32" Cursor="Hand">
  526. <Border.Style>
  527. <Style TargetType="Border">
  528. <Style.Triggers>
  529. <Trigger Property="IsMouseOver" Value="True">
  530. <Setter Property="Background" Value="{StaticResource ButtonFocusedColor}" />
  531. </Trigger>
  532. </Style.Triggers>
  533. </Style>
  534. </Border.Style>
  535. <hc:Interaction.Triggers>
  536. <hc:EventTrigger EventName="MouseUp">
  537. <hc:SetPropertyAction
  538. PropertyName="MenuIsOpen"
  539. PropertyValue="{x:Static system:Boolean.FalseString}"
  540. TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Border}, Path=DataContext}" />
  541. </hc:EventTrigger>
  542. </hc:Interaction.Triggers>
  543. <TextBlock
  544. Margin="10,0,0,0"
  545. HorizontalAlignment="Left"
  546. VerticalAlignment="Center"
  547. FontSize="14"
  548. Text="关闭" />
  549. </Border>
  550. </StackPanel>
  551. </Border>
  552. </Popup>
  553. </Grid>
  554. </Border>
  555. </UserControl>