终端一体化运控平台
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.
 
 
 

299 lines
20 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. <!--左侧选择区域-->
  30. <Grid >
  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. </Grid>
  36. <!--中间控制区域-->
  37. <DockPanel Grid.Column="1">
  38. <!--按钮控制-->
  39. <DockPanel LastChildFill="False" DockPanel.Dock="Top" Height="24" Margin="4 4 4 0">
  40. <Button Margin="0" Width="24" Padding="0" Click="AglinLeftBtn_Click" ToolTip="左对齐">
  41. <icon:PackIconModern Kind="AlignLeft"/>
  42. </Button>
  43. <Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinRightBtn_Click" ToolTip="右对齐">
  44. <icon:PackIconModern Kind="AlignRight"/>
  45. </Button>
  46. <Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinCenterBtn_Click" ToolTip="中心对齐">
  47. <icon:PackIconModern Kind="AlignCenter"/>
  48. </Button>
  49. <Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinTopBtn_Click" ToolTip="上对齐">
  50. <icon:PackIconModern Kind="BorderTop"/>
  51. </Button>
  52. <Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinBottomBtn_Click" ToolTip="下对齐">
  53. <icon:PackIconModern Kind="BorderBottom"/>
  54. </Button>
  55. <Button Margin="16 0 0 0" Width="24" Padding="0" Click="HorizontalLayoutBtn_Click" ToolTip="水平分布">
  56. <icon:PackIconModern Kind="BorderHorizontal"/>
  57. </Button>
  58. <Button Margin="4 0 0 0" Width="24" Padding="0" Click="VerticalLayoutBtn_Click" ToolTip="垂直分布">
  59. <icon:PackIconModern Kind="BorderVertical"/>
  60. </Button>
  61. <ToggleButton IsChecked="{Binding UseAutoAlignment, ElementName=cav, Mode=TwoWay}" ToolTip="使用对齐网格" Margin="4 0 0 0" Width="24" Padding="0">
  62. <icon:PackIconModern Kind="CellAlign"/>
  63. </ToggleButton>
  64. <Button Margin="16 0 0 0" Width="24" Padding="0" ToolTip="复制" Command="{Binding ElementName=cav, Path=CopySelectItemsCommand}">
  65. <icon:PackIconModern Kind="PageCopy"/>
  66. </Button>
  67. <Button Margin="4 0 0 0" Width="24" Padding="0" ToolTip="粘贴" Command="{Binding ElementName=cav, Path=PasteSelectItemsCommand}">
  68. <icon:PackIconModern Kind="ClipboardPaste"/>
  69. </Button>
  70. <Button Margin="4 0 0 0" Width="24" Padding="0" ToolTip="删除" Command="{Binding ElementName=cav, Path=DeleteSelectItemsCommand}">
  71. <icon:PackIconModern Kind="Delete"/>
  72. </Button>
  73. <Button x:Name="RunBtn" Margin="16 0 0 0" Padding="0" Click="RunBtn_Click" Command="{Binding RunUiCommand}">
  74. <Button.Style>
  75. <Style TargetType="Button">
  76. <Setter Property="Tag" Value="运行"/>
  77. <Setter Property="Content">
  78. <Setter.Value>
  79. <StackPanel Orientation="Horizontal" Margin="8 0">
  80. <icon:PackIconModern Kind="ControlPlay" VerticalAlignment="Center" Foreground="#28B60F" Width="8"/>
  81. <TextBlock Text="运行" Margin="4 0" VerticalAlignment="Center"/>
  82. </StackPanel>
  83. </Setter.Value>
  84. </Setter>
  85. <Style.Triggers>
  86. <DataTrigger Binding="{Binding IsRunning}" Value="True">
  87. <Setter Property="Tag" Value="停止"/>
  88. <Setter Property="Content">
  89. <Setter.Value>
  90. <StackPanel Orientation="Horizontal" Margin="8 0">
  91. <icon:PackIconModern Kind="ControlStop" VerticalAlignment="Center" Foreground="#B60F0F" Width="8"/>
  92. <TextBlock Text="停止" Margin="4 0" VerticalAlignment="Center"/>
  93. </StackPanel>
  94. </Setter.Value>
  95. </Setter>
  96. </DataTrigger>
  97. </Style.Triggers>
  98. </Style>
  99. </Button.Style>
  100. </Button>
  101. <Button x:Name="SaveBtn" Margin="16 0 0 0" Padding="0" Click="SaveBtn_Click">
  102. <StackPanel Orientation="Horizontal" Margin="8 0">
  103. <icon:PackIconModern Kind="Save" VerticalAlignment="Center" Width="12"/>
  104. <TextBlock Text="保存" Margin="4 0" VerticalAlignment="Center"/>
  105. </StackPanel>
  106. </Button>
  107. <Button x:Name="LoadBtn" Margin="4 0 0 0" Padding="0" Click="LoadBtn_Click">
  108. <StackPanel Orientation="Horizontal" Margin="8 0">
  109. <icon:PackIconModern Kind="DiskDownload" VerticalAlignment="Center" Width="14"/>
  110. <TextBlock Text="加载" Margin="4 0" VerticalAlignment="Center"/>
  111. </StackPanel>
  112. </Button>
  113. <Button x:Name="MNBtn" Margin="4 0 0 0" Padding="0" Click="MNBtn_Click">
  114. <StackPanel Orientation="Horizontal" Margin="8 0">
  115. <icon:PackIconModern Kind="MessageSend" VerticalAlignment="Center" Width="14"/>
  116. <TextBlock Text="模拟消息" Margin="4 0" VerticalAlignment="Center"/>
  117. </StackPanel>
  118. </Button>
  119. <ToggleButton x:Name="showCode" Click="showCode_Click" DockPanel.Dock="Right" Margin="4 0 0 0" Padding="4 0">
  120. <icon:Material Kind="FileCode"/>
  121. </ToggleButton>
  122. <Slider DockPanel.Dock="Right" Width="100" Maximum="16" Minimum="1" Margin="4 0 0 0"
  123. HorizontalContentAlignment="Center" Value="{Binding ElementName=cav,Path=GridPxiel}" ></Slider>
  124. <TextBlock DockPanel.Dock="Right" Text="对齐:" VerticalAlignment="Center" Margin="16 0 0 0"/>
  125. </DockPanel>
  126. <!--中间画布-->
  127. <Border BorderThickness="1" BorderBrush="{StaticResource AccentBrush}" Margin="4">
  128. <Border.Background>
  129. <ImageBrush ImageSource="/Images/bj.png" Stretch="UniformToFill"/>
  130. </Border.Background>
  131. <Grid>
  132. <Grid.ColumnDefinitions>
  133. <ColumnDefinition/>
  134. <ColumnDefinition Width="auto"/>
  135. </Grid.ColumnDefinitions>
  136. <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">
  137. <ctl:CanvasPanel.Background>
  138. <VisualBrush TileMode="Tile" Viewport="0,0,20,20" ViewportUnits="Absolute">
  139. <VisualBrush.Visual>
  140. <Rectangle Width="20" Height="20" StrokeDashArray="4,2" StrokeThickness="0.5" Stroke="#CBCBCB">
  141. <Rectangle.Style>
  142. <Style TargetType="{x:Type Rectangle}">
  143. <Style.Triggers>
  144. <DataTrigger Binding="{Binding UseAutoAlignment, RelativeSource={RelativeSource AncestorType={x:Type ctl:CanvasPanel}, Mode=FindAncestor}}" Value="True">
  145. <Setter Property="Visibility" Value="Visible"/>
  146. </DataTrigger>
  147. <DataTrigger Binding="{Binding UseAutoAlignment, RelativeSource={RelativeSource AncestorType={x:Type ctl:CanvasPanel}, Mode=FindAncestor}}" Value="False">
  148. <Setter Property="Visibility" Value="Collapsed"/>
  149. </DataTrigger>
  150. </Style.Triggers>
  151. </Style>
  152. </Rectangle.Style>
  153. </Rectangle>
  154. </VisualBrush.Visual>
  155. </VisualBrush>
  156. </ctl:CanvasPanel.Background>
  157. <ctl:CanvasPanel.RenderTransform>
  158. <TransformGroup>
  159. <TranslateTransform x:Name="CanvasTranslate"/>
  160. </TransformGroup>
  161. </ctl:CanvasPanel.RenderTransform>
  162. </ctl:CanvasPanel>
  163. <ctl:RunCanvas x:Name="runCanvas" Visibility="{Binding RunCanvasVisibility}" />
  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>