UaClient.xaml 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. <UserControl x:Class="YSAI.Tool.Wpf.views.UaClient"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:YSAI.Tool.Wpf.views"
  7. xmlns:NodeStructuralBody="clr-namespace:YSAI.Tool.Wpf.data"
  8. xmlns:c="clr-namespace:YSAI.Tool.Wpf.controllers"
  9. xmlns:txt="clr-namespace:YSAI.Core.Wpf.controls.textbox;assembly=YSAI.Core.Wpf"
  10. xmlns:btn="clr-namespace:YSAI.Core.Wpf.controls.button;assembly=YSAI.Core.Wpf"
  11. xmlns:pt="http://propertytools.org/wpf"
  12. xmlns:helpers="clr-namespace:YSAI.Core.Wpf.style;assembly=YSAI.Core.Wpf"
  13. xmlns:cs="clr-namespace:YSAI.Core.Wpf.converters;assembly=YSAI.Core.Wpf"
  14. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  15. xmlns:mvvm="clr-namespace:YSAI.Core.Wpf.mvvm;assembly=YSAI.Core.Wpf"
  16. Background="{DynamicResource ContentBackgroundPicture}">
  17. <UserControl.DataContext>
  18. <c:UaClientController />
  19. </UserControl.DataContext>
  20. <!--资源加载-->
  21. <UserControl.Resources>
  22. <ResourceDictionary>
  23. <Style TargetType="ToolTip">
  24. <Setter Property="Foreground" Value="{DynamicResource Font.Content.Foreground}"/>
  25. <Setter Property="BorderBrush" Value="{DynamicResource Control.Border.Color}"/>
  26. </Style>
  27. <cs:CheckConverter x:Key="CheckConverter" />
  28. <ResourceDictionary.MergedDictionaries>
  29. <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/resources/style/Style_ComboBox.xaml" />
  30. <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/resources/style/Style_Button.xaml" />
  31. <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/resources/style/Style_DataGrid.xaml" />
  32. <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/resources/style/Style_Border.xaml" />
  33. <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/resources/style/Style_TbaControl.xaml" />
  34. <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/resources/style/Style_ScrollViewer.xaml" />
  35. <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/resources/style/Style_GroupBox.xaml" />
  36. <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/resources/style/Style_TextBox.xaml" />
  37. <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/resources/style/Style_CheckBox.xaml" />
  38. <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/resources/style/Style_RadioButton.xaml" />
  39. <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/resources/style/Style_DatePicker.xaml" />
  40. <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/resources/style/Style_ContextMenu.xaml" />
  41. <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/resources/style/Style_TreeView.xaml" />
  42. </ResourceDictionary.MergedDictionaries>
  43. </ResourceDictionary>
  44. </UserControl.Resources>
  45. <Border Background="#F0F2F0" Width="auto" Height="auto" CornerRadius="{DynamicResource WindowCornerRadius}" Margin="50">
  46. <GroupBox Style="{StaticResource GroupBoxTab}" Margin="0" >
  47. <GroupBox.Header>
  48. <StackPanel Orientation="Horizontal">
  49. <Grid Background="Transparent">
  50. <Grid.ColumnDefinitions>
  51. <ColumnDefinition Width="auto" />
  52. <ColumnDefinition Width="*" />
  53. </Grid.ColumnDefinitions>
  54. <Image Grid.Column="0" Margin="10,0,8,0" Source="{DynamicResource Tool}" Width="14" />
  55. <TextBlock Text="{Binding ToolTitle}" FontSize="13" Grid.Column="1" Foreground="{DynamicResource Font.Content.Foreground}" />
  56. </Grid>
  57. </StackPanel>
  58. </GroupBox.Header>
  59. <!--基础数据与功能区域-->
  60. <Grid >
  61. <Grid.ColumnDefinitions>
  62. <ColumnDefinition Width="auto"/>
  63. <ColumnDefinition Width="*"/>
  64. <ColumnDefinition Width="auto"/>
  65. </Grid.ColumnDefinitions>
  66. <ToggleButton Grid.Column="0" Grid.ColumnSpan="3" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,-28,3,0" ToolTip="节点信息浏览[隐藏/显示]" Panel.ZIndex="3" IsChecked="{Binding NodeBrowseIsChecked}">
  67. <i:Interaction.Triggers>
  68. <i:EventTrigger EventName="Unchecked">
  69. <mvvm:EventCommand Command="{Binding ToggleButton_Unchecked}" />
  70. </i:EventTrigger>
  71. <i:EventTrigger EventName="Checked">
  72. <mvvm:EventCommand Command="{Binding ToggleButton_Checked}" />
  73. </i:EventTrigger>
  74. </i:Interaction.Triggers>
  75. <ToggleButton.Template>
  76. <ControlTemplate TargetType="{x:Type ToggleButton}">
  77. <Image x:Name="image" Source="{DynamicResource ZommOff}" Stretch="Fill" Width="15" Height="15" />
  78. <ControlTemplate.Triggers>
  79. <Trigger Property="IsChecked" Value="True">
  80. <Setter Property="Source" TargetName="image" Value="{DynamicResource ZommOn}"/>
  81. </Trigger>
  82. </ControlTemplate.Triggers>
  83. </ControlTemplate>
  84. </ToggleButton.Template>
  85. <ToggleButton.Triggers>
  86. <EventTrigger RoutedEvent="ToggleButton.Unchecked">
  87. <BeginStoryboard>
  88. <Storyboard>
  89. <DoubleAnimation Storyboard.TargetName="nodeBrowse" Storyboard.TargetProperty="MinWidth" From="1150" To="0" Duration="0:0:0.7"/>
  90. </Storyboard>
  91. </BeginStoryboard>
  92. </EventTrigger>
  93. <EventTrigger RoutedEvent="ToggleButton.Checked">
  94. <BeginStoryboard>
  95. <Storyboard>
  96. <DoubleAnimation Storyboard.TargetName="nodeBrowse" Storyboard.TargetProperty="MinWidth" From="0" To="1150" Duration="0:0:0.7"/>
  97. </Storyboard>
  98. </BeginStoryboard>
  99. </EventTrigger>
  100. </ToggleButton.Triggers>
  101. </ToggleButton>
  102. <!--基础数据-->
  103. <Grid Grid.Column="0" x:Name="propertyGrid" Margin="0,0,3,0" Width="550">
  104. <Grid.RowDefinitions>
  105. <RowDefinition Height="auto"/>
  106. <RowDefinition Height="auto"/>
  107. </Grid.RowDefinitions>
  108. <!--导入导出-->
  109. <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,0,-30" Panel.ZIndex="2">
  110. <btn:ButtonControl
  111. Width="80"
  112. Command="{Binding IncBasics}"
  113. HorizontalAlignment="Center"
  114. VerticalAlignment="Center"
  115. IsMouseOverBorderBrushColor="{DynamicResource Control.Border.One.Color}"
  116. BorderBrush="{DynamicResource Control.Border.Color}"
  117. IsPressedBorderBrushColor="{DynamicResource Control.Border.Two.Color}"
  118. Foreground="{DynamicResource Font.Content.Foreground}"
  119. Icon="{DynamicResource Inc}"
  120. Content="导入"
  121. BorderThickness="1,0,0,0" />
  122. <btn:ButtonControl
  123. Width="80"
  124. Command="{Binding ExpBasics}"
  125. HorizontalAlignment="Center"
  126. VerticalAlignment="Center"
  127. IsMouseOverBorderBrushColor="{DynamicResource Control.Border.One.Color}"
  128. BorderBrush="{DynamicResource Control.Border.Color}"
  129. IsPressedBorderBrushColor="{DynamicResource Control.Border.Two.Color}"
  130. Foreground="{DynamicResource Font.Content.Foreground}"
  131. Icon="{DynamicResource Exp}"
  132. Content="导出"
  133. BorderThickness="1,0,0,0" />
  134. </StackPanel>
  135. <!--属性表格-->
  136. <Grid Grid.Row="1" Panel.ZIndex="1">
  137. <Grid.Resources>
  138. <ResourceDictionary>
  139. <Style TargetType="{x:Type Label}" >
  140. <Setter Property="FontSize" Value="13"/>
  141. <Setter Property="Foreground" Value="{DynamicResource Font.Content.Foreground}"/>
  142. <Setter Property="HorizontalAlignment" Value="Left"/>
  143. </Style>
  144. <Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource DefaultComboBox}" >
  145. <Setter Property="Height" Value="25"/>
  146. <Setter Property="Background" Value="White"/>
  147. <Setter Property="VerticalAlignment" Value="Center"/>
  148. <Setter Property="helpers:Style_ComboBox.CornerRadius" Value="{DynamicResource WindowCornerRadius}"/>
  149. </Style>
  150. <Style TargetType="{x:Type pt:TextBoxEx}" BasedOn="{StaticResource TextBoxStyle2}">
  151. <Setter Property="FontSize" Value="13"/>
  152. <Setter Property="Foreground" Value="{DynamicResource Font.Content.Foreground}"/>
  153. <Setter Property="BorderBrush" Value="{DynamicResource Control.Border.Color}"/>
  154. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  155. <Setter Property="VerticalContentAlignment" Value="Center"/>
  156. </Style>
  157. <Style TargetType="CheckBox" BasedOn="{StaticResource CheckBoxStyle}"/>
  158. <Style TargetType="ContentControl" >
  159. <Setter Property="Foreground" Value="{DynamicResource Font.Content.Foreground}"/>
  160. </Style>
  161. <Style TargetType="Expander">
  162. <Setter Property="Foreground" Value="{DynamicResource Font.Content.Foreground}"/>
  163. </Style>
  164. <Style TargetType="RadioButton" BasedOn="{StaticResource RadioButtonStyle}"/>
  165. <Style TargetType="GroupBox" BasedOn="{StaticResource GroupBoxTab}"/>
  166. <DataTemplate x:Key="HeaderTemplate">
  167. <StackPanel Orientation="Horizontal">
  168. <Grid>
  169. <Grid.ColumnDefinitions>
  170. <ColumnDefinition Width="auto" />
  171. <ColumnDefinition Width="*" />
  172. </Grid.ColumnDefinitions>
  173. <Image Grid.Column="0" Margin="10,0,8,0" Source="{DynamicResource ConfigBase}" Width="14" />
  174. <TextBlock Text="{Binding}" FontSize="13" Grid.Column="1" Foreground="{DynamicResource Font.Content.Foreground}" />
  175. </Grid>
  176. </StackPanel>
  177. </DataTemplate>
  178. </ResourceDictionary>
  179. </Grid.Resources>
  180. <pt:PropertyGrid Margin="1,-4,1,0"
  181. SelectedObject="{Binding BasicsData}"
  182. TabVisibility="VisibleIfMoreThanOne"
  183. TextBlock.Foreground="{DynamicResource Font.Content.Foreground}"
  184. Foreground="{DynamicResource Font.Content.Foreground}"
  185. BorderBrush="{DynamicResource Control.Border.Color}"
  186. CategoryHeaderTemplate="{StaticResource HeaderTemplate}"/>
  187. </Grid>
  188. </Grid>
  189. <!--功能模块与信息-->
  190. <Grid Grid.Column="1" >
  191. <Grid.RowDefinitions>
  192. <RowDefinition Height="auto"/>
  193. <RowDefinition Height="*"/>
  194. </Grid.RowDefinitions>
  195. <ToggleButton Grid.Row="0" Grid.RowSpan="2" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="8,8,0,0" ToolTip="基础数据[隐藏/显示]" Panel.ZIndex="3" IsChecked="{Binding BasicsData_ToggleButtonIsChecked}">
  196. <ToggleButton.Template>
  197. <ControlTemplate TargetType="{x:Type ToggleButton}">
  198. <Image x:Name="image" Source="{DynamicResource GoLeft_Two}" Stretch="Fill" Width="15" Height="15" />
  199. <ControlTemplate.Triggers>
  200. <Trigger Property="IsChecked" Value="True">
  201. <Setter Property="Source" TargetName="image" Value="{DynamicResource GoRight_Two}"/>
  202. </Trigger>
  203. </ControlTemplate.Triggers>
  204. </ControlTemplate>
  205. </ToggleButton.Template>
  206. <ToggleButton.Triggers>
  207. <EventTrigger RoutedEvent="ToggleButton.Unchecked">
  208. <BeginStoryboard>
  209. <Storyboard>
  210. <DoubleAnimation Storyboard.TargetName="propertyGrid" Storyboard.TargetProperty="Width" From="0" To="550" Duration="0:0:0.7"/>
  211. <ThicknessAnimationUsingKeyFrames Storyboard.TargetName="propertyGrid" Storyboard.TargetProperty="Margin" BeginTime="00:00:00">
  212. <SplineThicknessKeyFrame KeyTime="00:00:00" Value="0" />
  213. <SplineThicknessKeyFrame KeyTime="00:00:0.7" Value="0,0,3,0" />
  214. </ThicknessAnimationUsingKeyFrames>
  215. </Storyboard>
  216. </BeginStoryboard>
  217. </EventTrigger>
  218. <EventTrigger RoutedEvent="ToggleButton.Checked">
  219. <BeginStoryboard>
  220. <Storyboard>
  221. <DoubleAnimation Storyboard.TargetName="propertyGrid" Storyboard.TargetProperty="Width" From="550" To="0" Duration="0:0:0.7"/>
  222. <ThicknessAnimationUsingKeyFrames Storyboard.TargetName="propertyGrid" Storyboard.TargetProperty="Margin" BeginTime="00:00:00">
  223. <SplineThicknessKeyFrame KeyTime="00:00:00" Value="0,0,3,0" />
  224. <SplineThicknessKeyFrame KeyTime="00:00:0.7" Value="0" />
  225. </ThicknessAnimationUsingKeyFrames>
  226. </Storyboard>
  227. </BeginStoryboard>
  228. </EventTrigger>
  229. </ToggleButton.Triggers>
  230. </ToggleButton>
  231. <!--功能模块-->
  232. <GroupBox Style="{StaticResource GroupBoxTab}" Margin="0" Grid.Row="0">
  233. <GroupBox.Header>
  234. <StackPanel Orientation="Horizontal">
  235. <Grid Background="transparent">
  236. <Grid.ColumnDefinitions>
  237. <ColumnDefinition Width="auto" />
  238. <ColumnDefinition Width="*" />
  239. </Grid.ColumnDefinitions>
  240. <Image Grid.Column="0" Margin="10,0,8,0" Source="{DynamicResource Function}" Width="14" />
  241. <TextBlock Text="功能" FontSize="13" Margin="0,0,10,0" Grid.Column="1" Foreground="{DynamicResource Font.Content.Foreground}" />
  242. </Grid>
  243. </StackPanel>
  244. </GroupBox.Header>
  245. <!--■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■-->
  246. <Grid>
  247. <Grid.RowDefinitions>
  248. <RowDefinition Height="auto"/>
  249. <RowDefinition Height="*"/>
  250. </Grid.RowDefinitions>
  251. <!--Start / Stop-->
  252. <Grid Grid.Row="0" Grid.Column="1" Margin="0,-40,0,0">
  253. <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" >
  254. <btn:ButtonControl Grid.Column="5" Width="80" Command="{Binding Start}" HorizontalAlignment="Right" VerticalAlignment="Center" BorderThickness="1,0,0,0"
  255. IsMouseOverBorderBrushColor="{DynamicResource Control.Border.One.Color}"
  256. BorderBrush="{DynamicResource Control.Border.Color}"
  257. IsPressedBorderBrushColor="{DynamicResource Control.Border.Two.Color}"
  258. Foreground="{DynamicResource Font.Content.Foreground}"
  259. Icon="{DynamicResource ConnectBase}"
  260. Content="连接"/>
  261. <btn:ButtonControl Grid.Column="6" Width="80" Command="{Binding Stop}" HorizontalAlignment="Right" VerticalAlignment="Center" BorderThickness="1,0,0,0"
  262. IsMouseOverBorderBrushColor="{DynamicResource Control.Border.One.Color}"
  263. BorderBrush="{DynamicResource Control.Border.Color}"
  264. IsPressedBorderBrushColor="{DynamicResource Control.Border.Two.Color}"
  265. Foreground="{DynamicResource Font.Content.Foreground}"
  266. Icon="{DynamicResource OffConnect}"
  267. Content="断开"/>
  268. </StackPanel>
  269. </Grid>
  270. <!--发送区域-->
  271. <Grid Grid.Row="1" Grid.Column="1">
  272. <Grid Margin="7">
  273. <Grid.RowDefinitions>
  274. <RowDefinition/>
  275. <RowDefinition/>
  276. <RowDefinition/>
  277. </Grid.RowDefinitions>
  278. <Grid.ColumnDefinitions>
  279. <ColumnDefinition/>
  280. <ColumnDefinition Width="auto"/>
  281. <ColumnDefinition Width="auto"/>
  282. </Grid.ColumnDefinitions>
  283. <GroupBox Grid.ColumnSpan="3" Style="{StaticResource GroupBoxTab}" Margin="0,1,0,10">
  284. <GroupBox.Header>
  285. <StackPanel Orientation="Horizontal">
  286. <Grid Background="transparent">
  287. <Grid.ColumnDefinitions>
  288. <ColumnDefinition Width="auto" />
  289. <ColumnDefinition Width="*" />
  290. </Grid.ColumnDefinitions>
  291. <Image Grid.Column="0" Margin="10,0,8,0" Source="{DynamicResource DataType}" Width="14" />
  292. <TextBlock Text="数据类型" FontSize="13" Margin="0,0,10,0" Grid.Column="1" Foreground="{DynamicResource Font.Content.Foreground}" />
  293. </Grid>
  294. </StackPanel>
  295. </GroupBox.Header>
  296. <Grid Margin="7">
  297. <Grid.ColumnDefinitions>
  298. <ColumnDefinition/>
  299. <ColumnDefinition/>
  300. <ColumnDefinition/>
  301. <ColumnDefinition/>
  302. <ColumnDefinition/>
  303. </Grid.ColumnDefinitions>
  304. <RadioButton Grid.Column="0" ToolTip="数据类型" IsChecked="{Binding DataType,Mode=TwoWay,Converter={StaticResource CheckConverter},ConverterParameter=0}" Style="{StaticResource RadioButtonStyle}" Content="String" VerticalAlignment="Center" HorizontalAlignment="Center" />
  305. <RadioButton Grid.Column="1" ToolTip="数据类型" IsChecked="{Binding DataType,Mode=TwoWay,Converter={StaticResource CheckConverter},ConverterParameter=1}" Style="{StaticResource RadioButtonStyle}" Content="Double" VerticalAlignment="Center" HorizontalAlignment="Center" />
  306. <RadioButton Grid.Column="2" ToolTip="数据类型" IsChecked="{Binding DataType,Mode=TwoWay,Converter={StaticResource CheckConverter},ConverterParameter=2}" Style="{StaticResource RadioButtonStyle}" Content="Float" VerticalAlignment="Center" HorizontalAlignment="Center" />
  307. <RadioButton Grid.Column="3" ToolTip="数据类型" IsChecked="{Binding DataType,Mode=TwoWay,Converter={StaticResource CheckConverter},ConverterParameter=3}" Style="{StaticResource RadioButtonStyle}" Content="Int" VerticalAlignment="Center" HorizontalAlignment="Center" />
  308. <RadioButton Grid.Column="4" ToolTip="数据类型" IsChecked="{Binding DataType,Mode=TwoWay,Converter={StaticResource CheckConverter},ConverterParameter=4}" Style="{StaticResource RadioButtonStyle}" Content="Bool" VerticalAlignment="Center" HorizontalAlignment="Center" />
  309. </Grid>
  310. </GroupBox>
  311. <txt:TextBoxControl Grid.Column="0" Grid.Row="1" FontSize="13" HorizontalContentAlignment="Center" Text="{Binding DotAddress}"
  312. SelectedColor="{DynamicResource Control.Border.Two.Color}"
  313. BorderBrush="{DynamicResource Control.Border.Color}"
  314. Foreground="{DynamicResource Font.Content.Foreground}"
  315. Icon="{DynamicResource Dot}"
  316. HintColor="{DynamicResource Control.Border.One.Color}"
  317. ShowIcon="True"
  318. Hint="节点地址"
  319. CornerRadius="{DynamicResource WindowCornerRadius}" />
  320. <txt:TextBoxControl Grid.Column="0" Grid.Row="2" Margin="0,10,0,0" FontSize="13" HorizontalContentAlignment="Center" VerticalAlignment="Center" Text="{Binding WriteInData}"
  321. SelectedColor="{DynamicResource Control.Border.Two.Color}"
  322. BorderBrush="{DynamicResource Control.Border.Color}"
  323. Foreground="{DynamicResource Font.Content.Foreground}"
  324. Icon="{DynamicResource WriteIn}"
  325. HintColor="{DynamicResource Control.Border.One.Color}"
  326. ShowIcon="True"
  327. Hint="写入数据"
  328. CornerRadius="{DynamicResource WindowCornerRadius}" />
  329. <btn:ButtonControl Width="100" Grid.Row="1" Grid.Column="1" Command="{Binding Read}" HorizontalAlignment="Center" VerticalAlignment="Center" CornerRadius="{DynamicResource WindowCornerRadius}" Margin="10,0,0,0"
  330. IsMouseOverBorderBrushColor="{DynamicResource Control.Border.One.Color}"
  331. BorderBrush="{DynamicResource Control.Border.Color}"
  332. IsPressedBorderBrushColor="{DynamicResource Control.Border.Two.Color}"
  333. Foreground="{DynamicResource Font.Content.Foreground}"
  334. Icon="{DynamicResource Read}"
  335. Content="读取"/>
  336. <btn:ButtonControl Width="100" Grid.Row="2" Grid.Column="1" Command="{Binding Write}" HorizontalAlignment="Center" VerticalAlignment="Center" CornerRadius="{DynamicResource WindowCornerRadius}" Margin="10,10,0,0"
  337. IsMouseOverBorderBrushColor="{DynamicResource Control.Border.One.Color}"
  338. BorderBrush="{DynamicResource Control.Border.Color}"
  339. IsPressedBorderBrushColor="{DynamicResource Control.Border.Two.Color}"
  340. Foreground="{DynamicResource Font.Content.Foreground}"
  341. Icon="{DynamicResource Write}"
  342. Content="写入"/>
  343. <btn:ButtonControl Width="100" Grid.Row="1" Grid.Column="2" Command="{Binding Subscribe}" HorizontalAlignment="Center" VerticalAlignment="Center" CornerRadius="{DynamicResource WindowCornerRadius}" Margin="10,0,0,0"
  344. IsMouseOverBorderBrushColor="{DynamicResource Control.Border.One.Color}"
  345. BorderBrush="{DynamicResource Control.Border.Color}"
  346. IsPressedBorderBrushColor="{DynamicResource Control.Border.Two.Color}"
  347. Foreground="{DynamicResource Font.Content.Foreground}"
  348. Icon="{DynamicResource Subscribe}"
  349. Content="订阅"/>
  350. <btn:ButtonControl Width="100" Grid.Row="2" Grid.Column="2" Command="{Binding UnSubscribe}" HorizontalAlignment="Center" VerticalAlignment="Center" CornerRadius="{DynamicResource WindowCornerRadius}" Margin="10,10,0,0"
  351. IsMouseOverBorderBrushColor="{DynamicResource Control.Border.One.Color}"
  352. BorderBrush="{DynamicResource Control.Border.Color}"
  353. IsPressedBorderBrushColor="{DynamicResource Control.Border.Two.Color}"
  354. Foreground="{DynamicResource Font.Content.Foreground}"
  355. Icon="{DynamicResource UnSubscribe}"
  356. Content="取消订阅"/>
  357. </Grid>
  358. </Grid>
  359. </Grid>
  360. <!--■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■-->
  361. </GroupBox>
  362. <!--信息-->
  363. <GroupBox Style="{StaticResource GroupBoxTab}" Margin="0,5,0,0" Grid.Row="1">
  364. <GroupBox.Header>
  365. <StackPanel Orientation="Horizontal">
  366. <Grid>
  367. <Grid.ColumnDefinitions>
  368. <ColumnDefinition Width="auto"/>
  369. <ColumnDefinition Width="*"/>
  370. </Grid.ColumnDefinitions>
  371. <Image Grid.Column="0" Margin="10,0,8,0" Source="{DynamicResource Info}" Width="14" />
  372. <TextBlock Text="信息" FontSize="13" Margin="0,0,10,0" Grid.Column="1" Foreground="{DynamicResource Font.Content.Foreground}" VerticalAlignment="Center"/>
  373. </Grid>
  374. </StackPanel>
  375. </GroupBox.Header>
  376. <Grid>
  377. <Grid.RowDefinitions>
  378. <RowDefinition Height="auto" />
  379. <RowDefinition />
  380. </Grid.RowDefinitions>
  381. <Grid.ColumnDefinitions>
  382. <ColumnDefinition />
  383. <ColumnDefinition Width="auto" />
  384. </Grid.ColumnDefinitions>
  385. <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right" Margin="0,-40,0,0">
  386. <RadioButton ToolTip="显示方式" Margin="0,0,15,0" Visibility="{Binding AsciiVisibility}" IsChecked="{Binding InfoFormat,Mode=TwoWay,Converter={StaticResource CheckConverter},ConverterParameter=0}" Style="{StaticResource RadioButtonStyle}" Content="ASCII" VerticalAlignment="Center" HorizontalAlignment="Right" />
  387. <RadioButton ToolTip="显示方式" Margin="0,0,15,0" Visibility="{Binding HexVisibility}" IsChecked="{Binding InfoFormat,Mode=TwoWay,Converter={StaticResource CheckConverter},ConverterParameter=1}" Style="{StaticResource RadioButtonStyle}" Content="Hex" VerticalAlignment="Center" HorizontalAlignment="Right" />
  388. <btn:ButtonControl Width="80" Command="{Binding Clear}" HorizontalAlignment="Right" VerticalAlignment="Center" BorderThickness="1,0,0,0"
  389. IsMouseOverBorderBrushColor="{DynamicResource Control.Border.One.Color}"
  390. BorderBrush="{DynamicResource Control.Border.Color}"
  391. IsPressedBorderBrushColor="{DynamicResource Control.Border.Two.Color}"
  392. Foreground="{DynamicResource Font.Content.Foreground}"
  393. Icon="{DynamicResource Clear}"
  394. Content="清空"/>
  395. </StackPanel>
  396. <TextBox Grid.Row="1" Padding="5" Grid.ColumnSpan="2" Style="{DynamicResource TextBoxStyle2}" FontSize="13" VerticalContentAlignment="Top" HorizontalContentAlignment="Left" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" Text="{Binding Info}" >
  397. <i:Interaction.Triggers>
  398. <i:EventTrigger EventName="TextChanged">
  399. <mvvm:EventCommand Command="{Binding Info_TextChanged}" />
  400. </i:EventTrigger>
  401. </i:Interaction.Triggers>
  402. </TextBox>
  403. </Grid>
  404. </GroupBox>
  405. </Grid>
  406. <!--■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■-->
  407. <!--节点浏览-->
  408. <Grid Grid.Column="2" Width="0" x:Name="nodeBrowse">
  409. <GroupBox Style="{StaticResource GroupBoxTab}" Margin="4,0,0,0">
  410. <GroupBox.Header>
  411. <StackPanel Orientation="Horizontal">
  412. <Grid Background="transparent">
  413. <Grid.ColumnDefinitions>
  414. <ColumnDefinition Width="auto" />
  415. <ColumnDefinition Width="*" />
  416. </Grid.ColumnDefinitions>
  417. <Image Grid.Column="0" Margin="10,0,8,0" Source="{DynamicResource Menu}" Width="14" />
  418. <TextBlock Text="节点信息浏览" FontSize="13" Grid.Column="1" Foreground="{DynamicResource Font.Content.Foreground}" />
  419. </Grid>
  420. </StackPanel>
  421. </GroupBox.Header>
  422. <Grid>
  423. <Grid.ColumnDefinitions>
  424. <ColumnDefinition Width="260" />
  425. <ColumnDefinition />
  426. </Grid.ColumnDefinitions>
  427. <!--节点-->
  428. <Grid Grid.Column="0">
  429. <GroupBox Style="{StaticResource GroupBoxTab}" Margin="0,0,5,0">
  430. <GroupBox.Header>
  431. <StackPanel Orientation="Horizontal">
  432. <Grid Background="transparent">
  433. <Grid.ColumnDefinitions>
  434. <ColumnDefinition Width="auto" />
  435. <ColumnDefinition Width="*" />
  436. </Grid.ColumnDefinitions>
  437. <Image Grid.Column="0" Margin="10,0,8,0" Source="{DynamicResource DotBase}" Width="14" />
  438. <TextBlock Text="节点" FontSize="13" Grid.Column="1" Foreground="{DynamicResource Font.Content.Foreground}" />
  439. </Grid>
  440. </StackPanel>
  441. </GroupBox.Header>
  442. <TreeView Background="Transparent" Margin="5,5,0,5" BorderBrush="{DynamicResource Control.Border.Color}" ItemsSource="{Binding Node}" Style="{StaticResource TreeViewStyle}" >
  443. <!--右键菜单暂不使用-->
  444. <!--<TreeView.ContextMenu>
  445. <ContextMenu VerticalContentAlignment="Center" FontSize="13">
  446. <MenuItem Header="批量订阅" Foreground="{DynamicResource Font.Content.Foreground}">
  447. <i:Interaction.Triggers>
  448. <i:EventTrigger EventName="Click">
  449. <mvvm:EventCommand Command="{Binding ContextMenu_Subscribe}" />
  450. </i:EventTrigger>
  451. </i:Interaction.Triggers>
  452. <MenuItem.Icon>
  453. <StackPanel Orientation="Horizontal">
  454. <Image Source="{DynamicResource Subscribe}" Width="15" Height="15" VerticalAlignment="Center" />
  455. </StackPanel>
  456. </MenuItem.Icon>
  457. </MenuItem>
  458. <MenuItem Header="取消批量订阅" Foreground="{DynamicResource Font.Content.Foreground}">
  459. <i:Interaction.Triggers>
  460. <i:EventTrigger EventName="Click">
  461. <mvvm:EventCommand Command="{Binding ContextMenu_UnSubscribe}" />
  462. </i:EventTrigger>
  463. </i:Interaction.Triggers>
  464. <MenuItem.Icon>
  465. <StackPanel Orientation="Horizontal">
  466. <Image Source="{DynamicResource UnSubscribe}" Width="15" Height="15" VerticalAlignment="Center" />
  467. </StackPanel>
  468. </MenuItem.Icon>
  469. </MenuItem>
  470. <MenuItem Header="导出节点" Foreground="{DynamicResource Font.Content.Foreground}">
  471. <i:Interaction.Triggers>
  472. <i:EventTrigger EventName="Click">
  473. <mvvm:EventCommand Command="{Binding ContextMenu_ExpNode}" />
  474. </i:EventTrigger>
  475. </i:Interaction.Triggers>
  476. <MenuItem.Icon>
  477. <StackPanel Orientation="Horizontal">
  478. <Image Source="{DynamicResource Exp}" Width="15" Height="15" VerticalAlignment="Center" />
  479. </StackPanel>
  480. </MenuItem.Icon>
  481. </MenuItem>
  482. </ContextMenu>
  483. </TreeView.ContextMenu>-->
  484. <i:Interaction.Triggers>
  485. <!--选中-->
  486. <i:EventTrigger EventName="SelectedItemChanged">
  487. <mvvm:EventCommand Command="{Binding TreeView_SelectedItemChanged}" />
  488. </i:EventTrigger>
  489. <!--右键按下暂不使用-->
  490. <!--<i:EventTrigger EventName="PreviewMouseRightButtonDown">
  491. <mvvm:EventCommand Command="{Binding TreeView_PreviewMouseRightButtonDown}" />
  492. </i:EventTrigger>-->
  493. <!--项被展开-->
  494. <mvvm:RoutedEventTrigger RoutedEvent="TreeViewItem.Expanded">
  495. <mvvm:EventCommand Command="{Binding TreeViewItem_Expanded}" />
  496. </mvvm:RoutedEventTrigger>
  497. </i:Interaction.Triggers>
  498. <TreeView.ItemTemplate>
  499. <HierarchicalDataTemplate DataType="{x:Type NodeStructuralBody:NodeStructuralBody}" ItemsSource="{Binding Children}">
  500. <StackPanel Margin="0,5,0,5">
  501. <Grid>
  502. <Grid.ColumnDefinitions>
  503. <ColumnDefinition />
  504. <ColumnDefinition />
  505. <ColumnDefinition />
  506. </Grid.ColumnDefinitions>
  507. <Image VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="Fill" Source="{Binding Icon}" Width="11" Height="11" Margin="0,0,5,0" Grid.Column="0" />
  508. <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Name}" FontSize="13" Foreground="{DynamicResource Font.Content.Foreground}" Grid.Column="1" Margin="0,0,5,0" />
  509. <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Count}" FontSize="11" Foreground="{DynamicResource Font.Content.Foreground}" Grid.Column="2" />
  510. </Grid>
  511. </StackPanel>
  512. </HierarchicalDataTemplate>
  513. </TreeView.ItemTemplate>
  514. </TreeView>
  515. </GroupBox>
  516. </Grid>
  517. <!--信息-->
  518. <Grid Grid.Column="1">
  519. <GroupBox Style="{StaticResource GroupBoxTab}" Margin="0">
  520. <GroupBox.Header>
  521. <StackPanel Orientation="Horizontal">
  522. <Grid Background="transparent">
  523. <Grid.ColumnDefinitions>
  524. <ColumnDefinition Width="auto" />
  525. <ColumnDefinition Width="*" />
  526. </Grid.ColumnDefinitions>
  527. <Image Grid.Column="0" Margin="10,0,8,0" Source="{DynamicResource Default}" Width="14" />
  528. <TextBlock Text="详情" FontSize="13" Grid.Column="1" Foreground="{DynamicResource Font.Content.Foreground}" />
  529. </Grid>
  530. </StackPanel>
  531. </GroupBox.Header>
  532. <DataGrid ColumnHeaderHeight="40" ItemsSource="{Binding NodeMessage}" Grid.Row="0" FontSize="13" SelectedItem="{Binding NodeMessageSelectedItem}" BorderThickness="0">
  533. <!--双击-->
  534. <i:Interaction.Triggers>
  535. <i:EventTrigger EventName="SelectedCellsChanged">
  536. <mvvm:EventCommand Command="{Binding DataGrid_SelectedCellsChanged}" />
  537. </i:EventTrigger>
  538. </i:Interaction.Triggers>
  539. <DataGrid.Columns>
  540. <DataGridTextColumn Header="名称" Width="auto" Binding="{Binding Name}" Visibility="Collapsed" />
  541. <DataGridTextColumn Header="地址" Width="*" Binding="{Binding Address}" />
  542. <DataGridTextColumn Header="值" Width="150" Binding="{Binding Value}" />
  543. <DataGridTextColumn Header="类型" Width="120" Binding="{Binding Type}" />
  544. <DataGridTextColumn Header="访问级别" Width="150" Binding="{Binding AccessLevel}" />
  545. <DataGridTextColumn Header="描述" Width="100" Binding="{Binding Description}" />
  546. </DataGrid.Columns>
  547. </DataGrid>
  548. </GroupBox>
  549. </Grid>
  550. </Grid>
  551. </GroupBox>
  552. </Grid>
  553. <!--■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■-->
  554. </Grid>
  555. </GroupBox>
  556. </Border>
  557. </UserControl>