终端一体化运控平台
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

297 líneas
21 KiB

  1. <Window x:Name="window" x:Class="BeDesignerSCADA.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:local="clr-namespace:BeDesignerSCADA"
  7. xmlns:s="clr-namespace:BeDesignerSCADA.Converters"
  8. xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
  9. xmlns:avae="http://icsharpcode.net/sharpdevelop/avalonedit"
  10. xmlns:ctl="clr-namespace:BeDesignerSCADA.Controls"
  11. xmlns:mypro="http://schemas.xceed.com/wpf/xaml/toolkit"
  12. mc:Ignorable="d"
  13. WindowStartupLocation="CenterScreen"
  14. Title="黑菠萝科技-[组态软件1.0]" Height="900" Width="1400" Icon="/Images/ico.ico" >
  15. <Window.Resources>
  16. <ResourceDictionary>
  17. <ResourceDictionary.MergedDictionaries>
  18. <ResourceDictionary Source="/BeDesignerSCADA;component/Themes/Styles.xaml" />
  19. <ResourceDictionary Source="/BPASmartClient.SCADAControl;component/Themes/Generic.xaml" />
  20. </ResourceDictionary.MergedDictionaries>
  21. </ResourceDictionary>
  22. </Window.Resources>
  23. <Grid x:Name="grid">
  24. <Grid.ColumnDefinitions>
  25. <ColumnDefinition Width="240"/>
  26. <ColumnDefinition/>
  27. <ColumnDefinition Width="350"/>
  28. </Grid.ColumnDefinitions>
  29. <!--<icon:PackIconMaterial x:Name="icon" Kind="LineScan" BorderThickness="1" VerticalAlignment="Stretch" Width="24" HorizontalAlignment="Stretch"/>-->
  30. <!--左侧控件栏-->
  31. <Border BorderThickness="1" BorderBrush="{StaticResource AccentBrush}" Margin="4">
  32. <ListBox x:Name="CtlList" Background="Transparent" ItemTemplate="{DynamicResource ToolBoxStyle}" BorderThickness="0" PreviewMouseMove="CtlList_PreviewMouseMove">
  33. </ListBox>
  34. </Border>
  35. <!--中间控制区域-->
  36. <DockPanel Grid.Column="1">
  37. <!--按钮控制-->
  38. <DockPanel LastChildFill="False" DockPanel.Dock="Top" Height="24" Margin="4 4 4 0">
  39. <Button Margin="0" Width="24" Padding="0" Click="AglinLeftBtn_Click" ToolTip="左对齐">
  40. <icon:PackIconModern Kind="AlignLeft"/>
  41. </Button>
  42. <Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinRightBtn_Click" ToolTip="右对齐">
  43. <icon:PackIconModern Kind="AlignRight"/>
  44. </Button>
  45. <Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinCenterBtn_Click" ToolTip="中心对齐">
  46. <icon:PackIconModern Kind="AlignCenter"/>
  47. </Button>
  48. <Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinTopBtn_Click" ToolTip="上对齐">
  49. <icon:PackIconModern Kind="BorderTop"/>
  50. </Button>
  51. <Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinBottomBtn_Click" ToolTip="下对齐">
  52. <icon:PackIconModern Kind="BorderBottom"/>
  53. </Button>
  54. <Button Margin="16 0 0 0" Width="24" Padding="0" Click="HorizontalLayoutBtn_Click" ToolTip="水平分布">
  55. <icon:PackIconModern Kind="BorderHorizontal"/>
  56. </Button>
  57. <Button Margin="4 0 0 0" Width="24" Padding="0" Click="VerticalLayoutBtn_Click" ToolTip="垂直分布">
  58. <icon:PackIconModern Kind="BorderVertical"/>
  59. </Button>
  60. <ToggleButton IsChecked="{Binding UseAutoAlignment, ElementName=cav, Mode=TwoWay}" ToolTip="使用对齐网格" Margin="4 0 0 0" Width="24" Padding="0">
  61. <icon:PackIconModern Kind="CellAlign"/>
  62. </ToggleButton>
  63. <Button Margin="16 0 0 0" Width="24" Padding="0" ToolTip="复制" Command="{Binding ElementName=cav, Path=CopySelectItemsCommand}">
  64. <icon:PackIconModern Kind="PageCopy"/>
  65. </Button>
  66. <Button Margin="4 0 0 0" Width="24" Padding="0" ToolTip="粘贴" Command="{Binding ElementName=cav, Path=PasteSelectItemsCommand}">
  67. <icon:PackIconModern Kind="ClipboardPaste"/>
  68. </Button>
  69. <Button Margin="4 0 0 0" Width="24" Padding="0" ToolTip="删除" Command="{Binding ElementName=cav, Path=DeleteSelectItemsCommand}">
  70. <icon:PackIconModern Kind="Delete"/>
  71. </Button>
  72. <Button x:Name="RunBtn" Margin="16 0 0 0" Padding="0" Click="RunBtn_Click" Command="{Binding RunUiCommand}">
  73. <Button.Style>
  74. <Style TargetType="Button">
  75. <Setter Property="Tag" Value="运行"/>
  76. <Setter Property="Content">
  77. <Setter.Value>
  78. <StackPanel Orientation="Horizontal" Margin="8 0">
  79. <icon:PackIconModern Kind="ControlPlay" VerticalAlignment="Center" Foreground="#28B60F" Width="8"/>
  80. <TextBlock Text="运行" Margin="4 0" VerticalAlignment="Center"/>
  81. </StackPanel>
  82. </Setter.Value>
  83. </Setter>
  84. <Style.Triggers>
  85. <DataTrigger Binding="{Binding IsRunning}" Value="True">
  86. <Setter Property="Tag" Value="停止"/>
  87. <Setter Property="Content">
  88. <Setter.Value>
  89. <StackPanel Orientation="Horizontal" Margin="8 0">
  90. <icon:PackIconModern Kind="ControlStop" VerticalAlignment="Center" Foreground="#B60F0F" Width="8"/>
  91. <TextBlock Text="停止" Margin="4 0" VerticalAlignment="Center"/>
  92. </StackPanel>
  93. </Setter.Value>
  94. </Setter>
  95. </DataTrigger>
  96. </Style.Triggers>
  97. </Style>
  98. </Button.Style>
  99. </Button>
  100. <Button x:Name="SaveBtn" Margin="16 0 0 0" Padding="0" Click="SaveBtn_Click">
  101. <StackPanel Orientation="Horizontal" Margin="8 0">
  102. <icon:PackIconModern Kind="Save" VerticalAlignment="Center" Width="12"/>
  103. <TextBlock Text="保存" Margin="4 0" VerticalAlignment="Center"/>
  104. </StackPanel>
  105. </Button>
  106. <Button x:Name="LoadBtn" Margin="4 0 0 0" Padding="0" Click="LoadBtn_Click">
  107. <StackPanel Orientation="Horizontal" Margin="8 0">
  108. <icon:PackIconModern Kind="DiskDownload" VerticalAlignment="Center" Width="14"/>
  109. <TextBlock Text="加载" Margin="4 0" VerticalAlignment="Center"/>
  110. </StackPanel>
  111. </Button>
  112. <Button x:Name="MNBtn" Margin="4 0 0 0" Padding="0" Click="MNBtn_Click">
  113. <StackPanel Orientation="Horizontal" Margin="8 0">
  114. <icon:PackIconModern Kind="MessageSend" VerticalAlignment="Center" Width="14"/>
  115. <TextBlock Text="模拟消息" Margin="4 0" VerticalAlignment="Center"/>
  116. </StackPanel>
  117. </Button>
  118. <ToggleButton x:Name="showCode" Click="showCode_Click" DockPanel.Dock="Right" Margin="4 0 0 0" Padding="4 0">
  119. <icon:Material Kind="FileCode"/>
  120. </ToggleButton>
  121. <Slider DockPanel.Dock="Right" Width="100" Maximum="16" Minimum="1" Margin="4 0 0 0"
  122. HorizontalContentAlignment="Center" Value="{Binding ElementName=cav,Path=GridPxiel}" ></Slider>
  123. <TextBlock DockPanel.Dock="Right" Text="对齐:" VerticalAlignment="Center" Margin="16 0 0 0"/>
  124. </DockPanel>
  125. <!--中间画布-->
  126. <Border BorderThickness="1" BorderBrush="{StaticResource AccentBrush}" Margin="4">
  127. <Border.Background>
  128. <ImageBrush ImageSource="/Images/bj.png" Stretch="UniformToFill"/>
  129. </Border.Background>
  130. <Grid>
  131. <Grid.ColumnDefinitions>
  132. <ColumnDefinition/>
  133. <ColumnDefinition Width="auto"/>
  134. </Grid.ColumnDefinitions>
  135. <ctl:CanvasPanel x:Name="cav" Visibility="{Binding CanvasPanelVisibility}" SelectedItem="{Binding CanSelectedItem,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AllowDrop="True" RenderTransformOrigin="0.5,0.5" ClipToBounds="True" UseLayoutRounding="True" Focusable="True" SnapsToDevicePixels="True">
  136. <ctl:CanvasPanel.Background>
  137. <VisualBrush TileMode="Tile" Viewport="0,0,20,20" ViewportUnits="Absolute">
  138. <VisualBrush.Visual>
  139. <Rectangle Width="20" Height="20" StrokeDashArray="4,2" StrokeThickness="0.5" Stroke="#CBCBCB">
  140. <Rectangle.Style>
  141. <Style TargetType="{x:Type Rectangle}">
  142. <Style.Triggers>
  143. <DataTrigger Binding="{Binding UseAutoAlignment, RelativeSource={RelativeSource AncestorType={x:Type ctl:CanvasPanel}, Mode=FindAncestor}}" Value="True">
  144. <Setter Property="Visibility" Value="Visible"/>
  145. </DataTrigger>
  146. <DataTrigger Binding="{Binding UseAutoAlignment, RelativeSource={RelativeSource AncestorType={x:Type ctl:CanvasPanel}, Mode=FindAncestor}}" Value="False">
  147. <Setter Property="Visibility" Value="Collapsed"/>
  148. </DataTrigger>
  149. </Style.Triggers>
  150. </Style>
  151. </Rectangle.Style>
  152. </Rectangle>
  153. </VisualBrush.Visual>
  154. </VisualBrush>
  155. </ctl:CanvasPanel.Background>
  156. <ctl:CanvasPanel.RenderTransform>
  157. <TransformGroup>
  158. <TranslateTransform x:Name="CanvasTranslate"/>
  159. </TransformGroup>
  160. </ctl:CanvasPanel.RenderTransform>
  161. </ctl:CanvasPanel>
  162. <ctl:RunCanvas x:Name="runCanvas" Visibility="{Binding RunCanvasVisibility}" >
  163. </ctl:RunCanvas>
  164. <avae:TextEditor x:Name="codeEditor" ShowLineNumbers="True" Padding="4" WordWrap="True" IsReadOnly="True" SyntaxHighlighting="XML" BorderThickness="1 0 0 0" BorderBrush="{StaticResource ControlBorderBrush}" Grid.Column="1" Width="480" Visibility="{Binding ElementName=showCode, Path=IsChecked, Converter={x:Static s:BoolToVisibilityConverter.Instance}}"/>
  165. </Grid>
  166. </Border>
  167. </DockPanel>
  168. <GridSplitter HorizontalAlignment="Right" Grid.Column="1" VerticalAlignment="Stretch" Width="5" Background="Transparent"/>
  169. <!--右侧属性栏-->
  170. <Grid Grid.Column="2">
  171. <TabControl SelectedIndex="0">
  172. <TabItem Header="控制协议">
  173. <mypro:PropertyGrid x:Name="kzxy" SelectedObject="{Binding PropeObject}"
  174. Margin="10" ShowAdvancedOptions="True" ShowDescriptionByTooltip="True"
  175. FontSize="14" ShowTitle="False" ShowSortOptions="False" ShowSearchBox="False"
  176. CategoryGroupHeaderTemplate="{DynamicResource Category}">
  177. <mypro:PropertyGrid.EditorDefinitions>
  178. <!--EditorTemplateDefinition可添加多个-->
  179. <!--要修改编辑模板的属性的名称-->
  180. <mypro:EditorTemplateDefinition TargetProperties="点击事件,值改变事件,定时触发,勾选事件,取消勾选事件" >
  181. <mypro:EditorTemplateDefinition.EditingTemplate>
  182. <DataTemplate>
  183. <!--此处可自由发挥-->
  184. <Grid>
  185. <!-- Command生效: DataTemplate的DataContext指代不明确,需要改为父类的DataContext。 参数Value表示原对象-->
  186. <!--Command="{Binding Path=DataContext.PropeSetCommand ,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=xctk:PropertyGrid}}"-->
  187. <!--DataContext="{Binding DataContext, ElementName=window}" Command="{Binding PropeSetCommand}" CommandParameter="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"-->
  188. <Grid.ColumnDefinitions>
  189. <ColumnDefinition Width="*" x:Name="key"/>
  190. <ColumnDefinition Width="35"/>
  191. </Grid.ColumnDefinitions>
  192. <TextBox Width="{Binding Width, ElementName=key}" Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap"></TextBox>
  193. <ToggleButton Grid.Column="1" Height="25" Content="编辑" Width="30" HorizontalAlignment="Left" Click="ToggleButton_Click"></ToggleButton>
  194. </Grid>
  195. </DataTemplate>
  196. </mypro:EditorTemplateDefinition.EditingTemplate>
  197. </mypro:EditorTemplateDefinition>
  198. <mypro:EditorTemplateDefinition TargetProperties="代码过滤脚本" >
  199. <mypro:EditorTemplateDefinition.EditingTemplate>
  200. <DataTemplate>
  201. <!--此处可自由发挥-->
  202. <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
  203. <TextBox Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AcceptsReturn="True" TextWrapping="Wrap"></TextBox>
  204. </ScrollViewer>
  205. </DataTemplate>
  206. </mypro:EditorTemplateDefinition.EditingTemplate>
  207. </mypro:EditorTemplateDefinition>
  208. <mypro:EditorTemplateDefinition TargetProperties="设备解析变量" >
  209. <mypro:EditorTemplateDefinition.EditingTemplate>
  210. <DataTemplate>
  211. <!--此处可自由发挥-->
  212. <Grid>
  213. <ComboBox Grid.Column="1" Height="25" Width="{Binding Width, ElementName=com}" Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
  214. ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window},Path=DataContext.DevValueList}"
  215. ></ComboBox>
  216. </Grid>
  217. </DataTemplate>
  218. </mypro:EditorTemplateDefinition.EditingTemplate>
  219. </mypro:EditorTemplateDefinition>
  220. <mypro:EditorTemplateDefinition TargetProperties="设备名称" >
  221. <mypro:EditorTemplateDefinition.EditingTemplate>
  222. <DataTemplate>
  223. <!--此处可自由发挥-->
  224. <Grid>
  225. <ComboBox Grid.Column="1" Height="25" Width="{Binding Width, ElementName=com}" Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
  226. ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window},Path=DataContext.DevNameList}"
  227. ></ComboBox>
  228. </Grid>
  229. </DataTemplate>
  230. </mypro:EditorTemplateDefinition.EditingTemplate>
  231. </mypro:EditorTemplateDefinition>
  232. <mypro:EditorTemplateDefinition TargetProperties="文本,文本1,标题,变量" >
  233. <mypro:EditorTemplateDefinition.EditingTemplate>
  234. <DataTemplate>
  235. <!--此处可自由发挥-->
  236. <Grid>
  237. <Grid.RowDefinitions>
  238. <RowDefinition/>
  239. <RowDefinition/>
  240. </Grid.RowDefinitions>
  241. <Grid Margin="0,5,0,5">
  242. <Grid.ColumnDefinitions>
  243. <ColumnDefinition Width="40" />
  244. <ColumnDefinition Width="*" x:Name="key"/>
  245. <ColumnDefinition Width="*" x:Name="Text"/>
  246. </Grid.ColumnDefinitions>
  247. <TextBlock>绑定:</TextBlock>
  248. <ComboBox x:Name="namebox" DropDownOpened="namebox_DropDownOpened" Grid.Column="1" Height="25" IsTextSearchEnabled="True" IsEditable="True" Tag="{Binding Text, ElementName=valuebox}" Width="{Binding Width, ElementName=key}" TextBoxBase.TextChanged="ComboBoxName_TextChanged"
  249. ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window},Path=DataContext.DevNameList}">
  250. </ComboBox>
  251. <ComboBox x:Name="valuebox" DropDownOpened="valuebox_DropDownOpened" Grid.Column="2" Height="25" IsTextSearchEnabled="True" IsEditable="True" Tag="{Binding Text, ElementName=namebox}" Width="{Binding Width, ElementName=Text}" TextBoxBase.TextChanged="ComboBoxValue_TextChanged"
  252. ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window},Path=DataContext.DevValueList}"/>
  253. </Grid>
  254. <TextBox Grid.Row="2" x:Name="wenben" Width="{Binding Width, ElementName=Text}" Padding="5" Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap"></TextBox>
  255. </Grid>
  256. </DataTemplate>
  257. </mypro:EditorTemplateDefinition.EditingTemplate>
  258. </mypro:EditorTemplateDefinition>
  259. </mypro:PropertyGrid.EditorDefinitions>
  260. </mypro:PropertyGrid>
  261. </TabItem>
  262. <TabItem Header="控件样式">
  263. <mypro:PropertyGrid x:Name="dsdsdsd"
  264. Margin="10" ShowAdvancedOptions="True" ShowDescriptionByTooltip="True"
  265. FontSize="14" ShowTitle="False" ShowSortOptions="False" ShowSearchBox="False"
  266. CategoryGroupHeaderTemplate="{DynamicResource Category}" SelectedObject="{Binding SelectedItem,ElementName=cav,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
  267. </TabItem>
  268. </TabControl>
  269. </Grid>
  270. </Grid>
  271. </Window>