终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

609 lines
34 KiB

  1. <UserControl
  2. x:Class="BPASmart.VariableManager.Views.VariableConfig"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:con="clr-namespace:BPASmart.VariableManager.Converter"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:local="clr-namespace:BPASmart.VariableManager.Views"
  8. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  9. xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
  10. xmlns:vm="clr-namespace:BPASmart.VariableManager.ViewModels"
  11. d:DesignHeight="600"
  12. d:DesignWidth="1200"
  13. mc:Ignorable="d">
  14. <!--<UserControl.DataContext>
  15. <vm:VariableConfig />
  16. </UserControl.DataContext>-->
  17. <UserControl.Resources>
  18. <Style x:Key="TextBoxStyle" TargetType="TextBox">
  19. <Setter Property="FontFamily" Value="楷体" />
  20. <Setter Property="FontSize" Value="22" />
  21. <Setter Property="VerticalContentAlignment" Value="Center" />
  22. <Setter Property="Width" Value="188" />
  23. <Setter Property="Padding" Value="6,0,0,0" />
  24. <Setter Property="Height" Value="37" />
  25. <Setter Property="BorderThickness" Value="0" />
  26. <Setter Property="Foreground" Value="{StaticResource PoupTextblockColor}" />
  27. <Setter Property="BorderBrush" Value="{StaticResource PoupTextblockColor}" />
  28. <Setter Property="CaretBrush" Value="{StaticResource PoupTextblockColor}" />
  29. <Setter Property="VerticalAlignment" Value="Center" />
  30. <Setter Property="Background">
  31. <Setter.Value>
  32. <ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/textBox.png" Stretch="Fill" />
  33. </Setter.Value>
  34. </Setter>
  35. </Style>
  36. <Style x:Key="TextBlockStyle" TargetType="TextBlock">
  37. <Setter Property="FontFamily" Value="楷体" />
  38. <Setter Property="FontSize" Value="18" />
  39. <Setter Property="Foreground" Value="{StaticResource PoupTextblockColor}" />
  40. <Setter Property="VerticalAlignment" Value="Center" />
  41. <Setter Property="HorizontalAlignment" Value="Center" />
  42. </Style>
  43. <Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}">
  44. <Setter Property="Template">
  45. <Setter.Value>
  46. <ControlTemplate TargetType="{x:Type RadioButton}">
  47. <Border
  48. x:Name="NvaBor"
  49. Background="Transparent"
  50. BorderBrush="#FF2AB2E7"
  51. BorderThickness="0">
  52. <ContentControl
  53. Margin="10,4"
  54. HorizontalAlignment="Center"
  55. VerticalAlignment="Center"
  56. HorizontalContentAlignment="Center"
  57. VerticalContentAlignment="Center"
  58. Content="{TemplateBinding Content}"
  59. FontSize="16" />
  60. </Border>
  61. <ControlTemplate.Triggers>
  62. <Trigger Property="IsChecked" Value="True">
  63. <Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
  64. <Setter TargetName="NvaBor" Property="BorderThickness" Value="0" />
  65. </Trigger>
  66. <MultiTrigger>
  67. <MultiTrigger.Conditions>
  68. <Condition Property="IsChecked" Value="false" />
  69. <Condition Property="IsMouseOver" Value="True" />
  70. </MultiTrigger.Conditions>
  71. <MultiTrigger.Setters>
  72. <Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
  73. </MultiTrigger.Setters>
  74. </MultiTrigger>
  75. </ControlTemplate.Triggers>
  76. </ControlTemplate>
  77. </Setter.Value>
  78. </Setter>
  79. </Style>
  80. <Style x:Key="InputTextboxStyle" TargetType="TextBox">
  81. <Setter Property="Margin" Value="0,0,0,0" />
  82. <Setter Property="Padding" Value="5,0,5,0" />
  83. <Setter Property="BorderThickness" Value="0" />
  84. <Setter Property="HorizontalAlignment" Value="Left" />
  85. <Setter Property="Height" Value="40" />
  86. <Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" />
  87. <Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" />
  88. <Setter Property="VerticalContentAlignment" Value="Center" />
  89. <Setter Property="FontSize" Value="14" />
  90. <Setter Property="Background" Value="Transparent" />
  91. <Setter Property="VerticalAlignment" Value="Center" />
  92. </Style>
  93. <Style x:Key="ControlButtonStyle" TargetType="Button">
  94. <Setter Property="Margin" Value="0" />
  95. <Setter Property="FontSize" Value="18" />
  96. <Setter Property="Foreground" Value="#FFF53F62" />
  97. <Setter Property="FontWeight" Value="SemiBold" />
  98. <Setter Property="FontFamily" Value="楷体" />
  99. <Setter Property="VerticalContentAlignment" Value="Center" />
  100. <Setter Property="Template">
  101. <Setter.Value>
  102. <ControlTemplate TargetType="Button">
  103. <Border
  104. Name="TitleBarBr"
  105. BorderBrush="#00c2f4"
  106. BorderThickness="0"
  107. CornerRadius="0"
  108. Opacity="0.8">
  109. <ContentPresenter
  110. Margin="{TemplateBinding Margin}"
  111. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  112. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  113. <Border.Background>
  114. <ImageBrush
  115. ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png"
  116. Opacity="0.8"
  117. Stretch="Fill" />
  118. </Border.Background>
  119. </Border>
  120. <ControlTemplate.Triggers>
  121. <Trigger Property="IsMouseOver" Value="true">
  122. <Setter TargetName="TitleBarBr" Property="Opacity" Value="1" />
  123. </Trigger>
  124. </ControlTemplate.Triggers>
  125. </ControlTemplate>
  126. </Setter.Value>
  127. </Setter>
  128. </Style>
  129. <Style x:Key="TitleTextblockStyle" TargetType="TextBlock">
  130. <Setter Property="FontSize" Value="16" />
  131. <Setter Property="HorizontalAlignment" Value="Center" />
  132. <Setter Property="VerticalAlignment" Value="Center" />
  133. <Setter Property="Foreground" Value="{StaticResource tabColor}" />
  134. <Setter Property="FontFamily" Value="楷体" />
  135. <Setter Property="FontWeight" Value="SemiBold" />
  136. </Style>
  137. </UserControl.Resources>
  138. <Grid Margin="10" SizeChanged="TabGrid_SizeChanged">
  139. <Grid.RowDefinitions>
  140. <RowDefinition Height="40" />
  141. <RowDefinition Height="40" />
  142. <RowDefinition />
  143. </Grid.RowDefinitions>
  144. <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
  145. <Button
  146. Width="150"
  147. Height="40"
  148. Margin="10,0,10,0"
  149. Command="{Binding StartMotionCommand}"
  150. Content="{Binding ButtonContext}"
  151. FontSize="20"
  152. Style="{StaticResource ImageButtonStyle}" />
  153. <Button
  154. Width="150"
  155. Height="40"
  156. Margin="10,0,10,0"
  157. Command="{Binding SaveCommand}"
  158. Content="保存参数"
  159. FontSize="20"
  160. Style="{StaticResource ImageButtonStyle}" />
  161. </StackPanel>
  162. <!--#region 表格标题栏设置-->
  163. <Grid
  164. Name="TabGrid"
  165. Grid.Row="1"
  166. Margin="0,10,0,0"
  167. Background="#ff0C255F">
  168. <Grid.ColumnDefinitions>
  169. <ColumnDefinition Width="0.2*" />
  170. <ColumnDefinition />
  171. <ColumnDefinition Width="0.4*" />
  172. <ColumnDefinition Width="0.3*" />
  173. <ColumnDefinition Width="0.2*" />
  174. <ColumnDefinition Width="0.2*" />
  175. <ColumnDefinition Width="0.2*" />
  176. </Grid.ColumnDefinitions>
  177. <TextBlock
  178. Grid.Column="0"
  179. Style="{StaticResource TitleTextblockStyle}"
  180. Text="ID" />
  181. <Grid Grid.Column="1">
  182. <TextBlock Style="{StaticResource TitleTextblockStyle}" Text="名称" />
  183. <Border
  184. BorderBrush="{StaticResource bordColor}"
  185. BorderThickness="1,0,1,0"
  186. Cursor="SizeWE" />
  187. </Grid>
  188. <TextBlock
  189. Grid.Column="2"
  190. Style="{StaticResource TitleTextblockStyle}"
  191. Text="地址" />
  192. <Grid Grid.Column="3">
  193. <TextBlock Style="{StaticResource TitleTextblockStyle}" Text="数据类型" />
  194. <Border
  195. BorderBrush="{StaticResource bordColor}"
  196. BorderThickness="1,0,1,0"
  197. Cursor="SizeWE" />
  198. </Grid>
  199. <Grid Grid.Column="4">
  200. <TextBlock Style="{StaticResource TitleTextblockStyle}" Text="报警" />
  201. <Border
  202. BorderBrush="{StaticResource bordColor}"
  203. BorderThickness="1,0,1,0"
  204. Cursor="SizeWE" />
  205. </Grid>
  206. <TextBlock
  207. Grid.Column="5"
  208. Style="{StaticResource TitleTextblockStyle}"
  209. Text="报警配置" />
  210. <Grid Grid.Column="6">
  211. <TextBlock Style="{StaticResource TitleTextblockStyle}" Text="{Binding TabName}" />
  212. <Border
  213. BorderBrush="{StaticResource bordColor}"
  214. BorderThickness="1,0,1,0"
  215. Cursor="SizeWE" />
  216. </Grid>
  217. <Border
  218. Grid.ColumnSpan="8"
  219. BorderBrush="{StaticResource bordColor}"
  220. BorderThickness="1,0,1,0" />
  221. </Grid>
  222. <!--#endregion-->
  223. <Grid Grid.Row="2">
  224. <ScrollViewer IsEnabled="{Binding IsEnable}" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
  225. <ItemsControl ItemsSource="{Binding varialeInfos}">
  226. <ItemsControl.ItemTemplate>
  227. <DataTemplate>
  228. <Grid Name="gr" Height="30">
  229. <Grid.ColumnDefinitions>
  230. <ColumnDefinition Width="0.2*" />
  231. <ColumnDefinition />
  232. <ColumnDefinition Width="0.4*" />
  233. <ColumnDefinition Width="0.3*" />
  234. <ColumnDefinition Width="0.2*" />
  235. <ColumnDefinition Width="0.2*" />
  236. <ColumnDefinition Width="0.2*" />
  237. </Grid.ColumnDefinitions>
  238. <TextBlock
  239. Grid.Column="0"
  240. HorizontalAlignment="Center"
  241. VerticalAlignment="Center"
  242. Background="Transparent"
  243. FontSize="14"
  244. Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
  245. Text="{Binding ID}" />
  246. <Grid Grid.Column="1">
  247. <TextBox
  248. Width="{Binding DataContext.NameWidth, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
  249. Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
  250. Style="{StaticResource InputTextboxStyle}"
  251. Text="{Binding VarName}" />
  252. <Border
  253. BorderBrush="{StaticResource bordColor}"
  254. BorderThickness="1,0,1,0"
  255. Cursor="SizeWE" />
  256. </Grid>
  257. <TextBox
  258. Grid.Column="2"
  259. Width="{Binding DataContext.AddressWidth, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
  260. Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
  261. Style="{StaticResource InputTextboxStyle}"
  262. Text="{Binding Address}" />
  263. <Grid Grid.Column="3">
  264. <ComboBox
  265. Name="cb"
  266. VerticalAlignment="Center"
  267. BorderBrush="Transparent"
  268. BorderThickness="1"
  269. FontFamily="楷体"
  270. FontSize="20"
  271. IsEnabled="{Binding DataContext.IsEnable,RelativeSource={RelativeSource AncestorType=ItemsControl,Mode=FindAncestor}}"
  272. Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
  273. IsEditable="False"
  274. ItemsSource="{Binding DataContext.dataType, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
  275. SelectedValue="{Binding DataType}"
  276. Style="{StaticResource ComboBoxStyle}"
  277. Text="{Binding DataType}" />
  278. <Border
  279. BorderBrush="{StaticResource bordColor}"
  280. BorderThickness="1,0,1,0"
  281. Cursor="SizeWE" />
  282. </Grid>
  283. <CheckBox
  284. Grid.Column="4"
  285. Margin="0,6"
  286. HorizontalAlignment="Center"
  287. VerticalAlignment="Center"
  288. Background="#009dff"
  289. FontSize="16"
  290. Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
  291. IsChecked="{Binding IsEnableAlarm}"
  292. IsEnabled="{Binding ElementName=cb, Path=Text, Converter={StaticResource IsEnableConvert}}"
  293. Template="{StaticResource CbTemplate}" />
  294. <!-- Content="{Binding IsEnableAlarm, Converter={StaticResource textDisplayConvert}}" -->
  295. <!--<TextBox
  296. Grid.Column="4"
  297. Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
  298. Style="{StaticResource InputTextboxStyle}"
  299. Text="{Binding SlowAcceleration}" />-->
  300. <Grid Grid.Column="5">
  301. <Grid>
  302. <ToggleButton
  303. Name="tb"
  304. Width="{Binding RelativeSource={RelativeSource AncestorType=Grid, AncestorLevel=1}, Path=ActualWidth}"
  305. Height="{Binding RelativeSource={RelativeSource AncestorType=Grid, AncestorLevel=1}, Path=ActualHeight}"
  306. Background="Transparent"
  307. BorderThickness="0"
  308. Content="编辑"
  309. FontSize="14"
  310. IsChecked="{Binding IsOpen}"
  311. IsEnabled="{Binding IsEnableAlarm}"
  312. Style="{StaticResource EditToggleButtonStyle}" />
  313. </Grid>
  314. <!-- 当 StaysOpen 设置为 True 时 popup失去焦点的时候不会自动关闭 -->
  315. <Popup
  316. AllowsTransparency="True"
  317. Focusable="False"
  318. IsOpen="{Binding IsOpen}"
  319. Placement="Left"
  320. PlacementTarget="{Binding ElementName=tb}"
  321. StaysOpen="False">
  322. <Border Background="#081424" ClipToBounds="True">
  323. <Grid Margin="0">
  324. <Grid.Background>
  325. <ImageBrush ImageSource="/Resources/Images/边框1.png" />
  326. </Grid.Background>
  327. <Grid.RowDefinitions>
  328. <RowDefinition />
  329. <RowDefinition />
  330. <RowDefinition />
  331. </Grid.RowDefinitions>
  332. <!--#region 离散量报警设置-->
  333. <StackPanel
  334. Grid.Row="0"
  335. Margin="10"
  336. Orientation="Vertical"
  337. Visibility="{Binding DataType, Converter={StaticResource discreteAlarmConvert}}">
  338. <Grid Margin="5">
  339. <pry:TitleTextBlock />
  340. <TextBlock
  341. Margin="10,5,30,5"
  342. Background="Transparent"
  343. FontSize="16"
  344. Foreground="#dd01FFFF"
  345. Text="离散量报警设置" />
  346. </Grid>
  347. <Grid>
  348. <Grid.ColumnDefinitions>
  349. <ColumnDefinition />
  350. <ColumnDefinition />
  351. </Grid.ColumnDefinitions>
  352. <TextBlock
  353. Margin="5"
  354. Style="{StaticResource TextBlockStyle}"
  355. Text="选择触发模式:" />
  356. <ComboBox
  357. Grid.Column="1"
  358. Width="180"
  359. Margin="5"
  360. VerticalAlignment="Center"
  361. BorderBrush="#009dff"
  362. BorderThickness="1"
  363. FontFamily="楷体"
  364. FontSize="20"
  365. Foreground="#009dff"
  366. IsEditable="False"
  367. ItemsSource="{Binding DataContext.PopupDiscreteAlarmType, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
  368. SelectedIndex="1"
  369. Style="{StaticResource ComboBoxStyle}"
  370. Text="{Binding DiscreteAlarmInfoSet.TrigAlarm}" />
  371. </Grid>
  372. <Grid>
  373. <Grid.ColumnDefinitions>
  374. <ColumnDefinition />
  375. <ColumnDefinition />
  376. <ColumnDefinition />
  377. </Grid.ColumnDefinitions>
  378. <TextBlock
  379. Grid.Column="0"
  380. Margin="5"
  381. Style="{StaticResource TextBlockStyle}"
  382. Text="输入报警信息:" />
  383. <TextBox
  384. Grid.Column="1"
  385. Grid.ColumnSpan="2"
  386. Style="{StaticResource TextBoxStyle}"
  387. Text="{Binding DiscreteAlarmInfoSet.AlarmInfo}" />
  388. </Grid>
  389. </StackPanel>
  390. <!--#endregion-->
  391. <!--#region 模拟量报警设置-->
  392. <StackPanel
  393. Grid.Row="1"
  394. Margin="10"
  395. Visibility="{Binding DataType, Converter={StaticResource analogAlarmConvert}}">
  396. <Grid Margin="5">
  397. <pry:TitleTextBlock />
  398. <TextBlock
  399. Margin="10,5,30,5"
  400. Background="Transparent"
  401. FontSize="16"
  402. Foreground="#dd01FFFF"
  403. Text="模拟量报警设置" />
  404. </Grid>
  405. <ItemsControl ItemsSource="{Binding AnalogAlarmModels}">
  406. <ItemsControl.ItemTemplate>
  407. <DataTemplate>
  408. <Grid Margin="0,0,0,8">
  409. <Grid.ColumnDefinitions>
  410. <ColumnDefinition />
  411. <ColumnDefinition />
  412. <ColumnDefinition />
  413. </Grid.ColumnDefinitions>
  414. <Grid.RowDefinitions>
  415. <RowDefinition />
  416. <RowDefinition />
  417. </Grid.RowDefinitions>
  418. <Border
  419. Grid.RowSpan="2"
  420. Grid.ColumnSpan="3"
  421. BorderBrush="#55009dff"
  422. BorderThickness="0,0,0,1" />
  423. <CheckBox
  424. Margin="5,5,0,0"
  425. HorizontalAlignment="Left"
  426. VerticalAlignment="Center"
  427. Background="#009dff"
  428. Content="{Binding AlarmTag}"
  429. FontSize="14"
  430. Foreground="#009dff"
  431. IsChecked="{Binding IsEnable}"
  432. Template="{StaticResource CbTemplate}" />
  433. <TextBlock
  434. Grid.Column="1"
  435. Margin="0,5,5,0"
  436. Style="{StaticResource TextBlockStyle}"
  437. Text="请输入报警值:" />
  438. <TextBox
  439. Grid.Column="2"
  440. Width="100"
  441. Margin="0,5,5,0"
  442. IsEnabled="{Binding IsEnable}"
  443. Style="{StaticResource TextBoxStyle}"
  444. Text="{Binding AlarmValue}" />
  445. <TextBlock
  446. Grid.Row="1"
  447. Grid.Column="0"
  448. Margin="5"
  449. Style="{StaticResource TextBlockStyle}"
  450. Text="输入报警信息:" />
  451. <TextBox
  452. Grid.Row="1"
  453. Grid.Column="1"
  454. Grid.ColumnSpan="2"
  455. Width="230"
  456. Height="35"
  457. Margin="5"
  458. IsEnabled="{Binding IsEnable}"
  459. Style="{StaticResource TextBoxStyle}"
  460. Text="{Binding AlarmInfo}" />
  461. </Grid>
  462. </DataTemplate>
  463. </ItemsControl.ItemTemplate>
  464. </ItemsControl>
  465. </StackPanel>
  466. <!--#endregion-->
  467. <!--#region 按钮控制-->
  468. <Grid Grid.Row="2" Margin="10">
  469. <Grid.ColumnDefinitions>
  470. <ColumnDefinition />
  471. <ColumnDefinition />
  472. </Grid.ColumnDefinitions>
  473. <Button
  474. Height="40"
  475. Margin="10,5,10,10"
  476. Command="{Binding CancelCommand}"
  477. Content="取消"
  478. FontFamily="楷体"
  479. FontSize="20"
  480. FontWeight="DemiBold"
  481. Foreground="#009dff"
  482. Style="{StaticResource FGImageButtonStyle}" />
  483. <Button
  484. Grid.Column="1"
  485. Height="40"
  486. Margin="10,5,10,10"
  487. Command="{Binding ConfirmCommand}"
  488. Content="确认"
  489. FontFamily="楷体"
  490. FontSize="20"
  491. FontWeight="DemiBold"
  492. Foreground="#009dff"
  493. Style="{StaticResource FGImageButtonStyle}" />
  494. </Grid>
  495. <!--#endregion-->
  496. </Grid>
  497. </Border>
  498. </Popup>
  499. <Border
  500. BorderBrush="{StaticResource bordColor}"
  501. BorderThickness="1,0,1,0"
  502. Cursor="SizeWE" />
  503. </Grid>
  504. <TextBlock
  505. Grid.Column="6"
  506. HorizontalAlignment="Center"
  507. VerticalAlignment="Center"
  508. Background="Transparent"
  509. FontSize="14"
  510. Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
  511. Text="{Binding CurrentValue}"
  512. Visibility="{Binding DataContext.CurrentVisibility, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" />
  513. <Button
  514. Grid.Column="6"
  515. Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
  516. CommandParameter="{Binding}"
  517. Content="删除"
  518. FontSize="16"
  519. Style="{StaticResource ControlButtonStyle}"
  520. Visibility="{Binding DataContext.RemoveButVisiblity, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" />
  521. <Border
  522. Grid.ColumnSpan="7"
  523. BorderBrush="{StaticResource bordColor}"
  524. BorderThickness="1,0,1,1" />
  525. </Grid>
  526. <DataTemplate.Triggers>
  527. <Trigger Property="IsMouseOver" Value="true">
  528. <Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
  529. </Trigger>
  530. </DataTemplate.Triggers>
  531. </DataTemplate>
  532. </ItemsControl.ItemTemplate>
  533. </ItemsControl>
  534. </ScrollViewer>
  535. </Grid>
  536. </Grid>
  537. </UserControl>