MainWindow.xaml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <Window x:Class="Yunda.SOMS.DataMonitoringServer.Viewport.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  6. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  7. xmlns:converter="clr-namespace:Yunda.SOMS.DataMonitoringServer.Viewport.Domain.Converters"
  8. TextElement.Foreground="{StaticResource MaterialDesignBody}"
  9. TextElement.FontWeight="Regular"
  10. TextElement.FontFamily="微软雅黑"
  11. TextElement.FontSize="13"
  12. TextOptions.TextFormattingMode="Ideal"
  13. TextOptions.TextRenderingMode="Auto"
  14. Background="{DynamicResource MaterialDesignPaper}"
  15. WindowStartupLocation="CenterScreen"
  16. mc:Ignorable="d"
  17. Title="数据服务" Height="450" Width="1100">
  18. <Window.Resources>
  19. <converter:InverseBoolValueConverter x:Key="InverseBoolValueConverter"></converter:InverseBoolValueConverter>
  20. <converter:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></converter:BooleanToVisibilityConverter>
  21. </Window.Resources>
  22. <Grid Background="{StaticResource WheatColor}">
  23. <DockPanel LastChildFill="True">
  24. <materialDesign:Card DockPanel.Dock="Top" Margin="10">
  25. <Grid>
  26. <Grid.ColumnDefinitions>
  27. <ColumnDefinition Width="6*"></ColumnDefinition>
  28. <ColumnDefinition Width="1*"></ColumnDefinition>
  29. </Grid.ColumnDefinitions>
  30. <WrapPanel Margin="5,5,5,5" Grid.Column="0" Orientation="Horizontal" AllowDrop="True">
  31. <WrapPanel Margin="5" Width="210" Visibility="Collapsed">
  32. <TextBlock VerticalAlignment="Bottom" Text="Web服务IP:" />
  33. <TextBox Text="{Binding Path=SettingModel.WebIp}" Width="120" materialDesign:HintAssist.Hint="0" VerticalContentAlignment="Bottom"
  34. IsEnabled="{Binding
  35. Path=IsRunning ,Converter={StaticResource InverseBoolValueConverter}}" />
  36. </WrapPanel>
  37. <WrapPanel Margin="5" Width="210" Visibility="Collapsed">
  38. <TextBlock VerticalAlignment="Bottom" Text="Web服务端口:" />
  39. <TextBox Text="{Binding Path=SettingModel.WebPort}" Width="60" materialDesign:HintAssist.Hint="0" VerticalContentAlignment="Bottom"
  40. IsEnabled="{Binding
  41. Path=IsRunning ,Converter={StaticResource InverseBoolValueConverter}}" />
  42. </WrapPanel>
  43. <WrapPanel Margin="5" Width="210" Visibility="Collapsed">
  44. <TextBlock VerticalAlignment="Bottom" Text="Websocket监听端口:" />
  45. <TextBox Text="{Binding Path=SettingModel.WebsocketPort}" Width="60" materialDesign:HintAssist.Hint="0" VerticalContentAlignment="Bottom"
  46. IsEnabled="{Binding
  47. Path=IsRunning ,Converter={StaticResource InverseBoolValueConverter}}" />
  48. </WrapPanel>
  49. <WrapPanel Margin="5" Width="110">
  50. <TextBlock Margin="0" VerticalAlignment="Bottom" Text="远动机IP:" />
  51. <TextBox Text="{Binding Path=SettingModel.Dev_Ip}" Width="120" VerticalContentAlignment="Bottom"
  52. IsEnabled="{Binding
  53. Path=IsRunning ,Converter={StaticResource InverseBoolValueConverter}}" />
  54. </WrapPanel>
  55. <WrapPanel Margin="5" Width="110">
  56. <TextBlock Margin="0" VerticalAlignment="Bottom" Text="远动机端口:" />
  57. <TextBox Text="{Binding Path=SettingModel.Dev_Port}" Width="60" VerticalContentAlignment="Bottom"
  58. IsEnabled="{Binding
  59. Path=IsRunning ,Converter={StaticResource InverseBoolValueConverter}}" />
  60. </WrapPanel>
  61. <WrapPanel Margin="5" Width="110">
  62. <TextBlock Margin="0" VerticalAlignment="Bottom" Text="RTU地址:" />
  63. <TextBox Text="1" Width="60" VerticalContentAlignment="Bottom"
  64. IsEnabled="False" />
  65. </WrapPanel>
  66. <WrapPanel Margin="5" Width="110">
  67. <TextBlock VerticalAlignment="Bottom" Text="数据保存间隔:" />
  68. <TextBox Text="{Binding Path=SettingModel.DataHandleInterval}" Width="50" materialDesign:HintAssist.Hint="0" VerticalContentAlignment="Center"
  69. IsEnabled="{Binding Path=IsRunning ,Converter={StaticResource InverseBoolValueConverter}}" />
  70. <TextBlock Width="auto" Margin="0,0" VerticalAlignment="Center" Text="(秒)" />
  71. </WrapPanel>
  72. <WrapPanel Margin="5" VerticalAlignment="Center" Width="110">
  73. <TextBlock Margin="0" VerticalAlignment="Center" Text="自动启动:" />
  74. <ToggleButton IsChecked="{Binding Path=SettingModel.IsAutoStartup,
  75. Converter={StaticResource BoolPositiveConverter}}"
  76. IsEnabled="{Binding Path=IsRunning ,Converter={StaticResource InverseBoolValueConverter}}"
  77. Style="{StaticResource MaterialDesignSwitchToggleButton}"
  78. ToolTip="" />
  79. </WrapPanel>
  80. <WrapPanel Margin="5" Width="210" VerticalAlignment="Bottom" Visibility="Collapsed">
  81. <TextBlock Margin="0" VerticalAlignment="Bottom" Text="手动配置其他项:" />
  82. <CheckBox IsChecked="{Binding Path=IsManualSetting}" IsEnabled="{Binding
  83. Path=IsRunning ,Converter={StaticResource InverseBoolValueConverter}}"></CheckBox>
  84. </WrapPanel>
  85. <WrapPanel Margin="5" Width="210" Height="30" Visibility="Collapsed" >
  86. <TextBlock Margin="0" VerticalAlignment="Bottom" Text="装置地址:" />
  87. <TextBox Width="60" Text="{Binding Path=SettingModel.Dev_addr}" VerticalContentAlignment="Bottom"
  88. IsEnabled="{Binding
  89. Path=IsRunning ,Converter={StaticResource InverseBoolValueConverter}}" />
  90. </WrapPanel>
  91. <WrapPanel Margin="5" Width="210" Height="30" Visibility="Collapsed" >
  92. <TextBlock Margin="0" VerticalAlignment="Bottom" Text="遥测起始地址:" />
  93. <TextBox Text="{Binding Path=SettingModel.Dev_yc_start}" Width="60" VerticalContentAlignment="Bottom"
  94. IsEnabled="{Binding
  95. Path=IsRunning ,Converter={StaticResource InverseBoolValueConverter}}" />
  96. </WrapPanel>
  97. <WrapPanel Margin="5" Width="210" Height="30" Visibility="Collapsed" >
  98. <TextBlock Margin="0" VerticalAlignment="Bottom" Text="遥测数量:" />
  99. <TextBox Width="60" Text="{Binding Path=SettingModel.Dev_yc_num}" VerticalContentAlignment="Bottom"
  100. IsEnabled="{Binding
  101. Path=IsRunning ,Converter={StaticResource InverseBoolValueConverter}}" />
  102. </WrapPanel>
  103. <WrapPanel Margin="5" Width="210" Height="30" Visibility="Collapsed" >
  104. <TextBlock Margin="0" VerticalAlignment="Bottom" Text="遥信起始地址:"></TextBlock>
  105. <TextBox Width="60" Text="{Binding Path=SettingModel.Dev_yx_start}" VerticalContentAlignment="Bottom"
  106. IsEnabled="{Binding
  107. Path=IsRunning ,Converter={StaticResource InverseBoolValueConverter}}" />
  108. </WrapPanel>
  109. <WrapPanel Margin="5" Height="30" Width="210" Visibility="Collapsed" >
  110. <TextBlock Margin="0" VerticalAlignment="Bottom" Text="遥信数量:" />
  111. <TextBox Width="60" Text="{Binding Path=SettingModel.Dev_yx_num}" x:Name="CommentTextBox" VerticalContentAlignment="Bottom"
  112. IsEnabled="{Binding
  113. Path=IsRunning ,Converter={StaticResource InverseBoolValueConverter}}" />
  114. </WrapPanel>
  115. <WrapPanel Margin="5" VerticalAlignment="Center" Width="210">
  116. <TextBlock Margin="0" VerticalAlignment="Center" Text="联动摄像机权限:" />
  117. <ToggleButton IsChecked="{Binding Path=SettingModel.IsAuthority,
  118. Converter={StaticResource BoolPositiveConverter}}"
  119. Style="{StaticResource MaterialDesignSwitchToggleButton}"
  120. ToolTip="" />
  121. </WrapPanel>
  122. </WrapPanel>
  123. <StackPanel Grid.Column="1" VerticalAlignment="Bottom" HorizontalAlignment="Right">
  124. <Button Command="{Binding Path=SaveCommand}"
  125. Background="#1ab394" Margin="5" Foreground="#000" Width="100" Height="30"
  126. Style="{StaticResource MaterialDesignRaisedLightButton}" Content="保存配置"
  127. IsEnabled="{Binding Path=IsRunning,Converter={StaticResource InverseBoolValueConverter }}"/>
  128. <Button
  129. Background="OrangeRed" Margin="5" Foreground="#fff" Width="100" Height="30" x:Name="restart"
  130. Click="restart_Click"
  131. Style="{StaticResource MaterialDesignRaisedLightButton}" Content="重启服务"
  132. />
  133. </StackPanel>
  134. </Grid>
  135. </materialDesign:Card>
  136. <materialDesign:Card DockPanel.Dock="Top" Margin="10">
  137. <Grid>
  138. <Grid.ColumnDefinitions>
  139. <ColumnDefinition Width="1*"></ColumnDefinition>
  140. <ColumnDefinition Width="3*"></ColumnDefinition>
  141. </Grid.ColumnDefinitions>
  142. <StackPanel Orientation="Horizontal" Margin="5" Grid.Column="0">
  143. <WrapPanel x:Name="stationSelect" Margin="5" Width="210">
  144. <TextBlock VerticalAlignment="Bottom" Text="变电所:" />
  145. <ComboBox Width="140" ItemsSource="{Binding Path=TransformerSubstations}"
  146. SelectedItem="{Binding Path=TransformerSubstation}"
  147. VerticalContentAlignment="Center"
  148. IsEnabled="{Binding
  149. Path=IsRunning ,Converter={StaticResource InverseBoolValueConverter}}">
  150. <ComboBox.ItemTemplate>
  151. <DataTemplate>
  152. <TextBlock Text="{Binding Path=Text}"></TextBlock>
  153. </DataTemplate>
  154. </ComboBox.ItemTemplate>
  155. </ComboBox>
  156. </WrapPanel>
  157. <!--<TextBlock Margin="5" FontSize="17" Padding="5" Width="210" Foreground="Red" Background="Azure"></TextBlock>-->
  158. </StackPanel>
  159. <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
  160. <!--<Button DockPanel.Dock="Right" x:Name="ResetBtn" Visibility="{Binding Path=Is}" Command="{Binding ResetCommand}"
  161. Background="#FFB3471A" Margin="5" Foreground="#f3f3f3" Width="120" Height="30"
  162. Style="{StaticResource MaterialDesignRaisedLightButton}" Content="重新初始化"
  163. IsEnabled="{Binding Path=IsRunning,Converter={StaticResource BoolNegateConverter }}"/>-->
  164. <Button DockPanel.Dock="Right" Command="{Binding StartCommand}"
  165. Background="Red" Margin="5" Foreground="#fff" Width="90" Height="30"
  166. Style="{StaticResource MaterialDesignRaisedLightButton}" Content="{Binding StatBtnContent}"
  167. />
  168. <Button Visibility="Collapsed" Command="{Binding Path=StopCommand}"
  169. Margin="5" Background="Red" Foreground="#f3f3f3" Width="90" Height="30"
  170. Style="{StaticResource MaterialDesignRaisedLightButton}" Content="停止服务"
  171. IsEnabled="{Binding Path=IsRunning,Converter={StaticResource BoolPositiveConverter}}" Click="StopBtn_Click"/>
  172. <Button Command="{Binding Path=UpdateAllMenuCmd}"
  173. Margin="5" Background="BlueViolet" Foreground="#f3f3f3" Width="80" Height="30"
  174. Style="{StaticResource MaterialDesignRaisedLightButton}" Content="总召唤"
  175. IsEnabled="{Binding Path=IsRunning,Converter={StaticResource BoolPositiveConverter}}" />
  176. <Button Command="{Binding Path=CleanCommand}"
  177. Margin="5" Background="Wheat" Foreground="#000" Width="70" Height="30"
  178. Style="{StaticResource MaterialDesignRaisedLightButton}" Content="清屏"
  179. />
  180. <Button Command="{Binding Path=StopMenuCmd}"
  181. Margin="5" Background="BlueViolet" Foreground="#f3f3f3" Width="100" Height="30"
  182. Style="{StaticResource MaterialDesignRaisedLightButton}" Content="暂停报文"
  183. />
  184. <Button Command="{Binding Path=StartMenuCmd}"
  185. Margin="5" Background="LightYellow" Foreground="#000" Width="100" Height="30"
  186. Style="{StaticResource MaterialDesignRaisedLightButton}" Content="开始报文" Cursor=""
  187. />
  188. <Button Command="{Binding Path=UpdataLiveDataCommand}"
  189. Margin="5" Background="LightBlue" Foreground="#000" Width="120" Height="30"
  190. Style="{StaticResource MaterialDesignRaisedLightButton}" Content="刷新实时监视" Cursor=""
  191. />
  192. <Button Command="{Binding Path=ExportLiveDataCommand}"
  193. Margin="5" Background="LightBlue" Foreground="#000" Width="120" Height="30"
  194. Style="{StaticResource MaterialDesignRaisedLightButton}" Content="导出实时监视" Cursor=""
  195. />
  196. </StackPanel>
  197. </Grid>
  198. </materialDesign:Card>
  199. <TabControl DockPanel.Dock="Top">
  200. <TabItem Header="实时报文">
  201. <DockPanel Background="{StaticResource WheatColor}" LastChildFill="True" >
  202. <ProgressBar DockPanel.Dock="Top" Height="4" Padding="0" Margin="10,5" Background="LightGreen" BorderBrush="AliceBlue" Foreground="Green" IsIndeterminate="{Binding Path=IsRunning}" />
  203. <ScrollViewer VerticalScrollBarVisibility="Visible" MouseWheel="ScrollViewer_MouseWheel">
  204. <!--<RichTextBox x:Name="richTextBox" FontSize="12" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" />-->
  205. <ListView ItemsSource="{Binding Path=Recorders}" FontSize="12">
  206. <ListView.View>
  207. <GridView>
  208. <GridViewColumn Width="180" DisplayMemberBinding="{Binding Path=DateTime, StringFormat={}{0:MM-dd HH:mm:ss fff}}" Header="时间" />
  209. <GridViewColumn Width="120" DisplayMemberBinding="{Binding Path=MsgType}" Header="类别" />
  210. <GridViewColumn Width="500" DisplayMemberBinding="{Binding Path=Msg}" Header="信息" />
  211. </GridView>
  212. </ListView.View>
  213. <ListView.ContextMenu>
  214. <ContextMenu>
  215. <MenuItem Header="过滤报文" FontFamily="微软雅黑" FontWeight="Regular" Name="regMenu" Command="{Binding Path=RegMenuCmd}"></MenuItem>
  216. <MenuItem Header="暂停报文" FontFamily="微软雅黑" FontWeight="Regular" Name="stopMenu" Command="{Binding Path=StopMenuCmd}"></MenuItem>
  217. <MenuItem Header="开始报文" FontFamily="微软雅黑" FontWeight="Regular" Name="startMenu" Command="{Binding Path=StartMenuCmd}" ></MenuItem>
  218. <MenuItem Header="复制报文" FontFamily="微软雅黑" FontWeight="Regular" Name="copyMenu" Command="{Binding Path=CopyMenuCmd}" CommandParameter="{Binding ElementName=copyMenu }">
  219. </MenuItem>
  220. <MenuItem Header="更新三遥数据" FontFamily="微软雅黑" FontWeight="Regular" Command="{Binding Path=UpdateAllMenuCmd}">
  221. </MenuItem>
  222. <MenuItem Header="更新指定数据" FontFamily="微软雅黑" FontWeight="Regular" Command="{Binding Path=UpdateOneMenuCmd}" >
  223. </MenuItem>
  224. <MenuItem Header="更新联动数据" FontFamily="微软雅黑" FontWeight="Regular" Command="{Binding Path=UpdateLinkageDataCommand}" >
  225. </MenuItem>
  226. <MenuItem Header="清屏" FontFamily="微软雅黑" FontWeight="Regular" Command="{Binding Path=CleanCommand}" >
  227. </MenuItem>
  228. </ContextMenu>
  229. </ListView.ContextMenu>
  230. </ListView>
  231. </ScrollViewer>
  232. </DockPanel>
  233. </TabItem>
  234. <TabItem Header="实时监视" IsSelected="True">
  235. <ScrollViewer VerticalScrollBarVisibility="Visible" x:Name="liveDatasScrollViewer" MouseWheel="ScrollViewer_MouseWheel">
  236. <ListView ItemsSource="{Binding Path=InfoAddrLiveDatas}" FontSize="12" d:ItemsSource="{d:SampleData ItemCount=5}" >
  237. <ListView.View>
  238. <GridView>
  239. <GridViewColumn Width="180" DisplayMemberBinding="{Binding Path=DateTime, StringFormat={}{0:MM-dd HH:mm:ss fff}}" Header="更新时间" />
  240. <GridViewColumn Width="180" DisplayMemberBinding="{Binding Path=EquipmentName}" Header="设备名称" />
  241. <GridViewColumn Width="180" DisplayMemberBinding="{Binding Path=Name}" Header="名称" />
  242. <GridViewColumn Width="180" DisplayMemberBinding="{Binding Path=TypeName}" Header="类型" />
  243. <GridViewColumn Width="150" DisplayMemberBinding="{Binding Path=InfoAddr}" Header="调度地址" />
  244. <GridViewColumn Width="150" DisplayMemberBinding="{Binding Path=Value}" Header="数值" />
  245. </GridView>
  246. </ListView.View>
  247. </ListView>
  248. </ScrollViewer>
  249. </TabItem>
  250. </TabControl>
  251. </DockPanel>
  252. </Grid>
  253. </Window>