SettingDialog.xaml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <pu:WindowX x:Class="SWRIS.Pages.SettingDialog"
  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:SWRIS.Pages"
  7. mc:Ignorable="d" Foreground="#FFFFFF"
  8. xmlns:pu="https://opensource.panuon.com/wpf-ui"
  9. xmlns:cvt="clr-namespace:SWRIS.Converters" AllowsTransparency="True"
  10. xmlns:vm="clr-namespace:SWRIS.Models.ViewModel"
  11. MinHeight="750" Width="1100" WindowStyle="None"
  12. ResizeMode="NoResize" FontSize="18" Background="#141332"
  13. FontFamily="{StaticResource PuHuiTiRegular}"
  14. Title="系统设置" pu:WindowXCaption.Height="0"
  15. WindowStartupLocation="CenterScreen" IsEscEnabled="True" >
  16. <pu:WindowX.DataContext>
  17. <vm:SettingViewModel/>
  18. </pu:WindowX.DataContext>
  19. <pu:WindowX.Resources>
  20. <cvt:BooleanInverterConverter x:Key="InverterConverter"/>
  21. <cvt:PercentageConverter x:Key="PercentageConverter"/>
  22. <cvt:NullToVisibilityConverter x:Key="NullToVisibilityConverter"/>
  23. <cvt:ModuleTypeToVisibilityConverter x:Key="ModuleTypeToVisibilityConverter"/>
  24. </pu:WindowX.Resources>
  25. <Border BorderThickness="2" BorderBrush="#3B3B7B" CornerRadius="10">
  26. <Grid Margin="20">
  27. <Grid.RowDefinitions>
  28. <RowDefinition Height="60"/>
  29. <RowDefinition Height="*"/>
  30. <RowDefinition Height="90"/>
  31. </Grid.RowDefinitions>
  32. <Grid.ColumnDefinitions>
  33. <ColumnDefinition Width="400"/>
  34. <ColumnDefinition Width="1.5"/>
  35. <ColumnDefinition Width="*"/>
  36. </Grid.ColumnDefinitions>
  37. <TextBlock Text="系统设置" Grid.Row="0" Grid.ColumnSpan="3" HorizontalAlignment="Center" FontSize="36" FontWeight="Bold"/>
  38. <StackPanel Orientation="Vertical" Grid.Row="1" Grid.Column="0" Margin="35,0">
  39. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
  40. <Rectangle Height="2" Width="110" Stroke="#3B3B7B"/>
  41. <TextBlock Text="基本参数" Foreground="#615CDD" FontSize="24" Margin="15" FontWeight="Regular"/>
  42. <Rectangle Height="2" Width="110" Stroke="#3B3B7B"/>
  43. </StackPanel>
  44. <StackPanel Orientation="Vertical" HorizontalAlignment="Center">
  45. <StackPanel Orientation="Horizontal">
  46. <StackPanel Orientation="Vertical">
  47. <TextBlock Text="设备名称" Foreground="#7886B2" FontWeight="Regular"/>
  48. <TextBox Margin="0,10" Text="{Binding Crane}" Width="247"/>
  49. </StackPanel>
  50. </StackPanel>
  51. <StackPanel Orientation="Horizontal">
  52. <StackPanel Orientation="Vertical" Margin="0,0,27,0">
  53. <TextBlock Text="服务地址" Foreground="#7886B2" FontWeight="Regular"/>
  54. <TextBox Margin="0,10" Text="{Binding IpAddress}"/>
  55. </StackPanel>
  56. <StackPanel Orientation="Vertical">
  57. <TextBlock Text="端口号" Foreground="#7886B2" FontWeight="Regular"/>
  58. <TextBox Margin="0,10" Text="{Binding Port}" Width="70"/>
  59. </StackPanel>
  60. </StackPanel>
  61. <StackPanel Orientation="Horizontal">
  62. <StackPanel Orientation="Vertical" Margin="0,0,27,0">
  63. <TextBlock Text="数据清理时间" Foreground="#7886B2" FontWeight="Regular"/>
  64. <TextBox Margin="0,10" Text="{Binding CleanScheduledTime}" Width="150"/>
  65. </StackPanel>
  66. <StackPanel Orientation="Vertical">
  67. <TextBlock Text="存储时长" Foreground="#7886B2" FontWeight="Regular"/>
  68. <StackPanel Orientation="Horizontal" Margin="0,10" >
  69. <TextBox Text="{Binding DataSaveDays}" Width="70"/>
  70. <TextBlock VerticalAlignment="Center" Margin="5" Text="天"/>
  71. </StackPanel>
  72. </StackPanel>
  73. </StackPanel>
  74. <StackPanel Orientation="Horizontal">
  75. <StackPanel Orientation="Vertical" Margin="0,0,27,0">
  76. <TextBlock Text="语音报警级别" Foreground="#7886B2" FontWeight="Regular"/>
  77. <ComboBox Margin="0,10" Width="150" ItemsSource="{Binding RiskLevels}"
  78. SelectedValue="{Binding SoundRiskLevel}"
  79. DisplayMemberPath="Value" SelectedValuePath="Key"/>
  80. </StackPanel>
  81. <StackPanel Orientation="Vertical">
  82. <TextBlock Text="速度波动阈值" Foreground="#7886B2" FontWeight="Regular"/>
  83. <StackPanel Orientation="Horizontal" Margin="0,10">
  84. <TextBox Text="{Binding SpeedVariationThreshold,Converter={StaticResource PercentageConverter}}" Width="70"/>
  85. <TextBlock Text="%" Margin="5,0" VerticalAlignment="Center"/>
  86. </StackPanel>
  87. </StackPanel>
  88. </StackPanel>
  89. <StackPanel Orientation="Horizontal">
  90. <StackPanel Orientation="Vertical" Margin="0,0,22,0">
  91. <TextBlock Text="损伤容差范围" Foreground="#7886B2" FontWeight="Regular"/>
  92. <StackPanel Orientation="Horizontal" Margin="0,10">
  93. <TextBox Text="{Binding DamageExtent}" Width="125"/>
  94. <TextBlock Text="米" Margin="5,0" VerticalAlignment="Center"/>
  95. </StackPanel>
  96. </StackPanel>
  97. <StackPanel Orientation="Vertical">
  98. <TextBlock Text="损伤确认频次" Foreground="#7886B2" FontWeight="Regular"/>
  99. <StackPanel Orientation="Horizontal" Margin="0,10">
  100. <TextBox Text="{Binding AlarmValidCount}" Width="70"/>
  101. <TextBlock Text="次" Margin="5,0" VerticalAlignment="Center"/>
  102. </StackPanel>
  103. </StackPanel>
  104. </StackPanel>
  105. </StackPanel>
  106. </StackPanel>
  107. <Rectangle Grid.Row="1" Grid.Column="1">
  108. <Rectangle.Fill>
  109. <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
  110. <GradientStop Offset="0" Color="Transparent"/>
  111. <GradientStop Offset="0.5" Color="#3B3B7B"/>
  112. <GradientStop Offset="1" Color="Transparent"/>
  113. </LinearGradientBrush>
  114. </Rectangle.Fill>
  115. </Rectangle>
  116. <StackPanel Orientation="Vertical" Grid.Row="1" Grid.Column="2">
  117. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
  118. <Rectangle Height="2" Width="250" Stroke="#3B3B7B"/>
  119. <TextBlock Text="标定" Foreground="#615CDD" FontSize="24" Margin="15" FontWeight="Regular"/>
  120. <Rectangle Height="2" Width="250" Stroke="#3B3B7B"/>
  121. </StackPanel>
  122. <StackPanel Orientation="Vertical" HorizontalAlignment="Center" DataContext="{Binding Calibration}">
  123. <StackPanel Orientation="Vertical">
  124. <TextBlock Text="类型" Foreground="#7886B2" FontWeight="Regular"/>
  125. <ComboBox Margin="0,10" Width="320" ItemsSource="{Binding ModuleTypes}"
  126. SelectedValue="{Binding ModuleType}"
  127. HorizontalAlignment="Left"
  128. DisplayMemberPath="Value" SelectedValuePath="Key"/>
  129. </StackPanel>
  130. <StackPanel Orientation="Vertical"
  131. Visibility="{Binding ModuleType,Converter={StaticResource ModuleTypeToVisibilityConverter},ConverterParameter=Tcp}">
  132. <StackPanel Orientation="Horizontal" DataContext="{Binding Tcp}">
  133. <StackPanel Orientation="Vertical" Margin="0,0,20,0">
  134. <TextBlock Text="设备地址" Foreground="#7886B2" FontWeight="Regular"/>
  135. <TextBox Margin="0,10" Text="{Binding IpAddress}" Width="150"/>
  136. </StackPanel>
  137. <StackPanel Orientation="Vertical" Margin="0,0,20,0">
  138. <TextBlock Text="端口号" Foreground="#7886B2" FontWeight="Regular"/>
  139. <TextBox Margin="0,10" Text="{Binding Port}" Width="75"/>
  140. </StackPanel>
  141. <StackPanel Orientation="Vertical">
  142. <TextBlock Text="站号" Foreground="#7886B2" FontWeight="Regular"/>
  143. <TextBox Margin="0,10" Text="{Binding Station}" Width="55"/>
  144. </StackPanel>
  145. </StackPanel>
  146. </StackPanel>
  147. <StackPanel Orientation="Vertical"
  148. Visibility="{Binding ModuleType,Converter={StaticResource ModuleTypeToVisibilityConverter},ConverterParameter=Serial}">
  149. <StackPanel Orientation="Vertical" DataContext="{Binding Serial}">
  150. <StackPanel Orientation="Horizontal">
  151. <StackPanel Orientation="Vertical" Margin="0,0,20,0">
  152. <TextBlock Text="串口名称" Foreground="#7886B2" FontWeight="Regular"/>
  153. <ComboBox ItemsSource="{Binding Path=SerialNames}" Margin="0,10" SelectedValue="{Binding PortName}" Width="150"/>
  154. </StackPanel>
  155. <StackPanel Orientation="Vertical">
  156. <TextBlock Text="波特率" Foreground="#7886B2" FontWeight="Regular"/>
  157. <ComboBox Margin="0,10" SelectedValue="{Binding BaudRate}"
  158. SelectedValuePath="Content" Width="150">
  159. <ComboBoxItem Content="1200"/>
  160. <ComboBoxItem Content="4800"/>
  161. <ComboBoxItem Content="9600"/>
  162. <ComboBoxItem Content="19200"/>
  163. <ComboBoxItem Content="38400"/>
  164. <ComboBoxItem Content="57600"/>
  165. <ComboBoxItem Content="115200"/>
  166. </ComboBox>
  167. </StackPanel>
  168. </StackPanel>
  169. <StackPanel Orientation="Horizontal">
  170. <StackPanel Orientation="Vertical" Margin="0,0,20,0">
  171. <TextBlock Text="数据位" Foreground="#7886B2" FontWeight="Regular"/>
  172. <ComboBox Margin="0,10" SelectedValue="{Binding DataBits}"
  173. SelectedValuePath="Content" Width="63">
  174. <ComboBoxItem Content="7"/>
  175. <ComboBoxItem Content="8"/>
  176. </ComboBox>
  177. </StackPanel>
  178. <StackPanel Orientation="Vertical" Margin="0,0,20,0">
  179. <TextBlock Text="校验位" Foreground="#7886B2" FontWeight="Regular"/>
  180. <ComboBox Margin="0,10" SelectedValue="{Binding Parity}"
  181. SelectedValuePath="Content" Width="100">
  182. <ComboBoxItem Content="None"/>
  183. <ComboBoxItem Content="Odd"/>
  184. <ComboBoxItem Content="Even"/>
  185. </ComboBox>
  186. </StackPanel>
  187. <StackPanel Orientation="Vertical" Margin="0,0,20,0">
  188. <TextBlock Text="停止位" Foreground="#7886B2" FontWeight="Regular"/>
  189. <ComboBox Margin="0,10" SelectedValue="{Binding StopBits}"
  190. SelectedValuePath="Content" Width="63">
  191. <ComboBoxItem Content="1"/>
  192. <ComboBoxItem Content="2"/>
  193. </ComboBox>
  194. </StackPanel>
  195. <StackPanel Orientation="Vertical">
  196. <TextBlock Text="站号" Foreground="#7886B2" FontWeight="Regular"/>
  197. <TextBox Margin="0,10" Text="{Binding Station}" Width="35"/>
  198. </StackPanel>
  199. </StackPanel>
  200. </StackPanel>
  201. </StackPanel>
  202. <Rectangle Width="600" Height="1.5" Margin="-200,10,-200,5">
  203. <Rectangle.Fill>
  204. <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
  205. <GradientStop Offset="0" Color="Transparent"/>
  206. <GradientStop Offset="0.5" Color="#3B3B7B"/>
  207. <GradientStop Offset="1" Color="Transparent"/>
  208. </LinearGradientBrush>
  209. </Rectangle.Fill>
  210. </Rectangle>
  211. <ItemsControl ItemsSource="{Binding Limits}" Margin="0,10">
  212. <ItemsControl.ItemsPanel>
  213. <ItemsPanelTemplate>
  214. <StackPanel Orientation="Vertical"/>
  215. </ItemsPanelTemplate>
  216. </ItemsControl.ItemsPanel>
  217. <ItemsControl.ItemTemplate>
  218. <DataTemplate>
  219. <StackPanel Orientation="Horizontal" >
  220. <CheckBox IsChecked="{Binding IsEnable}" ToolTip="是否启用" Margin="0,25,5,0" BorderThickness="1.6" pu:CheckBoxHelper.GlyphThickness="2"/>
  221. <StackPanel Orientation="Horizontal" IsEnabled="{Binding IsEnable}">
  222. <StackPanel Orientation="Vertical" Margin="0,0,20,0">
  223. <TextBlock Text="限位" Foreground="#7886B2" FontWeight="Regular"/>
  224. <TextBox Margin="0,10" Text="{Binding Name}" Width="120"/>
  225. </StackPanel>
  226. <StackPanel Orientation="Vertical" Margin="0,0,40,0">
  227. <TextBlock Text="地址" Foreground="#7886B2" FontWeight="Regular"/>
  228. <Grid Margin="0,10">
  229. <TextBox Text="{Binding Address}" Width="80" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
  230. <CheckBox Content="反" ToolTip="取反" IsChecked="{Binding IsReverse}" HorizontalAlignment="Right" VerticalAlignment="Top"
  231. Foreground="LightGreen" BorderBrush="LightGreen"
  232. Margin="0,0,-30,0" Width="35" Height="22" FontSize="15" Padding="1"
  233. pu:CheckBoxHelper.CheckedGlyphBrush="OrangeRed"
  234. pu:CheckBoxHelper.CheckedForeground="OrangeRed"
  235. pu:CheckBoxHelper.CheckedBorderBrush="OrangeRed">
  236. <CheckBox.LayoutTransform>
  237. <ScaleTransform ScaleX="0.8" ScaleY="0.8"/>
  238. </CheckBox.LayoutTransform>
  239. </CheckBox>
  240. </Grid>
  241. </StackPanel>
  242. <StackPanel Orientation="Vertical">
  243. <TextBlock Text="高度" Foreground="#7886B2" FontWeight="Regular"/>
  244. <StackPanel Orientation="Horizontal">
  245. <TextBox Margin="0,10" Text="{Binding Position}" Width="65"/>
  246. <TextBlock Text="米" Margin="5,0" VerticalAlignment="Center"/>
  247. </StackPanel>
  248. </StackPanel>
  249. <ItemsControl ItemsSource="{Binding RelatedRopes}" Margin="10,0,0,0">
  250. <ItemsControl.ItemsPanel>
  251. <ItemsPanelTemplate>
  252. <StackPanel Orientation="Vertical" VerticalAlignment="Bottom" Margin="0,5"/>
  253. </ItemsPanelTemplate>
  254. </ItemsControl.ItemsPanel>
  255. <ItemsControl.ItemTemplate>
  256. <DataTemplate>
  257. <CheckBox Content="{Binding RopeName}"
  258. Tag="{Binding RopeNumber}"
  259. IsChecked="{Binding IsSelected}"/>
  260. </DataTemplate>
  261. </ItemsControl.ItemTemplate>
  262. </ItemsControl>
  263. </StackPanel>
  264. </StackPanel>
  265. </DataTemplate>
  266. </ItemsControl.ItemTemplate>
  267. </ItemsControl>
  268. </StackPanel>
  269. </StackPanel>
  270. <Grid Grid.Row="4" Grid.ColumnSpan="3">
  271. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
  272. <Button Content="取消" Width="130" Height="60" FontWeight="Regular" pu:ButtonHelper.CornerRadius="15" IsCancel="True" Margin="30,0">
  273. <Button.Background>
  274. <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
  275. <GradientStop Color="#615E7C" Offset="0.0"/>
  276. <GradientStop Color="#807E9F" Offset="1.0"/>
  277. </LinearGradientBrush>
  278. </Button.Background>
  279. </Button>
  280. <Button Content="保存" Grid.Row="4" Width="250" Height="60" IsDefault="True" FontWeight="Bold"
  281. FontFamily="{StaticResource PuHuiTiRegular}" Click="Save_Click"/>
  282. </StackPanel>
  283. <CheckBox Content="保存后重新启动程序" Foreground="Orange" BorderBrush="Orange"
  284. pu:CheckBoxHelper.CheckedGlyphBrush="Orange" Margin="0,10,0,0" IsChecked="{Binding IsAutoStart}"
  285. HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
  286. </Grid>
  287. </Grid>
  288. </Border>
  289. </pu:WindowX>