DeviceDetailsWindow.xaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <Window x:Class="NetworkTool.Client.DeviceDetailsWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. Title="设备信息与接口配置"
  5. Height="760"
  6. Width="1100"
  7. MinHeight="680"
  8. MinWidth="1000"
  9. WindowState="Maximized"
  10. ShowInTaskbar="False"
  11. WindowStartupLocation="CenterOwner">
  12. <Grid Background="#F5F7FB">
  13. <ScrollViewer x:Name="ContentScrollViewer"
  14. Margin="20"
  15. VerticalScrollBarVisibility="Auto"
  16. HorizontalScrollBarVisibility="Disabled"
  17. CanContentScroll="True">
  18. <Grid>
  19. <Grid.RowDefinitions>
  20. <RowDefinition Height="Auto" />
  21. <RowDefinition Height="Auto" />
  22. <RowDefinition Height="Auto" />
  23. <RowDefinition Height="*" />
  24. </Grid.RowDefinitions>
  25. <UniformGrid Grid.Row="0" Columns="4">
  26. <Border Margin="0,0,12,0" Padding="14" Background="White" CornerRadius="10">
  27. <StackPanel>
  28. <TextBlock FontSize="12" Foreground="#6B7280" Text="设备 ID" />
  29. <TextBlock x:Name="RemoteDeviceIdTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  30. </StackPanel>
  31. </Border>
  32. <Border Margin="0,0,12,0" Padding="14" Background="White" CornerRadius="10">
  33. <StackPanel>
  34. <TextBlock FontSize="12" Foreground="#6B7280" Text="主机名" />
  35. <TextBlock x:Name="RemoteHostnameTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  36. </StackPanel>
  37. </Border>
  38. <Border Margin="0,0,12,0" Padding="14" Background="White" CornerRadius="10">
  39. <StackPanel>
  40. <TextBlock FontSize="12" Foreground="#6B7280" Text="Ubuntu 版本" />
  41. <TextBlock x:Name="RemoteOsVersionTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  42. </StackPanel>
  43. </Border>
  44. <Border Padding="14" Background="White" CornerRadius="10">
  45. <StackPanel>
  46. <TextBlock FontSize="12" Foreground="#6B7280" Text="Server 版本" />
  47. <TextBlock x:Name="RemoteServerVersionTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  48. </StackPanel>
  49. </Border>
  50. </UniformGrid>
  51. <Border Grid.Row="1" Margin="0,12,0,0" Padding="14" Background="White" CornerRadius="10">
  52. <Grid>
  53. <Grid.RowDefinitions>
  54. <RowDefinition Height="Auto" />
  55. <RowDefinition Height="Auto" />
  56. </Grid.RowDefinitions>
  57. <Grid.ColumnDefinitions>
  58. <ColumnDefinition Width="*" />
  59. <ColumnDefinition Width="Auto" />
  60. </Grid.ColumnDefinitions>
  61. <TextBlock FontSize="13"
  62. FontWeight="SemiBold"
  63. Foreground="#111827"
  64. Text="目标接口" />
  65. <ComboBox x:Name="RemoteTargetInterfaceComboBox"
  66. Grid.Row="1"
  67. Margin="0,10,0,0"
  68. MinHeight="36"
  69. VerticalContentAlignment="Center"
  70. DisplayMemberPath="DisplayName"
  71. SelectionChanged="RemoteTargetInterfaceComboBox_OnSelectionChanged" />
  72. <Button x:Name="ReloadInterfaceConfigButton"
  73. Grid.Row="1"
  74. Grid.Column="1"
  75. Margin="14,10,0,0"
  76. MinHeight="36"
  77. Padding="14,0"
  78. VerticalAlignment="Center"
  79. Click="ReloadInterfaceConfigButton_OnClick"
  80. Content="1. 读取当前配置" />
  81. </Grid>
  82. </Border>
  83. <Border Grid.Row="2" Margin="0,12,0,0" Padding="14" Background="White" CornerRadius="10">
  84. <Grid>
  85. <Grid.RowDefinitions>
  86. <RowDefinition Height="Auto" />
  87. <RowDefinition Height="Auto" />
  88. <RowDefinition Height="Auto" />
  89. <RowDefinition Height="Auto" />
  90. </Grid.RowDefinitions>
  91. <TextBlock FontSize="13" FontWeight="SemiBold" Foreground="#111827" Text="配置调整" />
  92. <Grid Grid.Row="1" Margin="0,12,0,0">
  93. <Grid.ColumnDefinitions>
  94. <ColumnDefinition Width="*" />
  95. <ColumnDefinition Width="*" />
  96. </Grid.ColumnDefinitions>
  97. <Border Margin="0,0,8,0" Padding="14" Background="#F9FAFB" CornerRadius="10">
  98. <StackPanel>
  99. <TextBlock FontSize="13" FontWeight="SemiBold" Foreground="#111827" Text="当前配置" />
  100. <TextBlock Margin="0,12,0,0" FontSize="12" Foreground="#6B7280" Text="接口名" />
  101. <TextBlock x:Name="RemoteConfigInterfaceTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  102. <TextBlock Margin="0,12,0,0" FontSize="12" Foreground="#6B7280" Text="当前 IP" />
  103. <TextBlock x:Name="RemoteConfigIpTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  104. <TextBlock Margin="0,12,0,0" FontSize="12" Foreground="#6B7280" Text="当前网关" />
  105. <TextBlock x:Name="RemoteConfigGatewayTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  106. <TextBlock Margin="0,12,0,0" FontSize="12" Foreground="#6B7280" Text="当前 DNS" />
  107. <TextBlock x:Name="RemoteConfigDnsTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  108. </StackPanel>
  109. </Border>
  110. <Border Grid.Column="1" Margin="8,0,0,0" Padding="14" Background="#F9FAFB" CornerRadius="10">
  111. <StackPanel>
  112. <TextBlock FontSize="13" FontWeight="SemiBold" Foreground="#111827" Text="新配置" />
  113. <CheckBox x:Name="Dhcp4CheckBox" Margin="0,12,0,0" VerticalContentAlignment="Center" Checked="ConfigModeChanged_OnChanged" Unchecked="ConfigModeChanged_OnChanged" Content="使用 DHCP 自动获取 IPv4 配置" />
  114. <TextBlock Margin="0,12,0,0" FontSize="12" Foreground="#6B7280" Text="IP 地址" />
  115. <TextBox x:Name="NewIpTextBox" Margin="0,8,0,0" MinHeight="32" VerticalContentAlignment="Center" TextChanged="ConfigInputChanged_OnChanged" />
  116. <TextBlock Margin="0,12,0,0" FontSize="12" Foreground="#6B7280" Text="子网掩码" />
  117. <TextBox x:Name="NewMaskTextBox" Margin="0,8,0,0" MinHeight="32" VerticalContentAlignment="Center" TextChanged="ConfigInputChanged_OnChanged" />
  118. <TextBlock Margin="0,12,0,0" FontSize="12" Foreground="#6B7280" Text="网关" />
  119. <TextBox x:Name="NewGatewayTextBox" Margin="0,8,0,0" MinHeight="32" VerticalContentAlignment="Center" TextChanged="ConfigInputChanged_OnChanged" />
  120. <TextBlock Margin="0,12,0,0" FontSize="12" Foreground="#6B7280" Text="首选 DNS" />
  121. <TextBox x:Name="NewDnsTextBox" Margin="0,8,0,0" MinHeight="32" VerticalContentAlignment="Center" TextChanged="ConfigInputChanged_OnChanged" />
  122. </StackPanel>
  123. </Border>
  124. </Grid>
  125. <Grid Grid.Row="2" Margin="0,12,0,0">
  126. <Grid.ColumnDefinitions>
  127. <ColumnDefinition Width="*" />
  128. <ColumnDefinition Width="Auto" />
  129. </Grid.ColumnDefinitions>
  130. <TextBlock VerticalAlignment="Center"
  131. FontSize="12"
  132. Foreground="#6B7280"
  133. Text="先确认当前配置,再校验新配置,最后再应用到目标接口。" />
  134. <StackPanel Grid.Column="1" Margin="12,0,0,0" Orientation="Horizontal">
  135. <Button x:Name="ValidateConfigButton"
  136. MinHeight="36"
  137. Padding="14,0"
  138. Click="ValidateConfigButton_OnClick"
  139. Content="2. 校验配置" />
  140. <Button x:Name="ApplyConfigButton"
  141. Margin="10,0,0,0"
  142. MinHeight="36"
  143. Padding="14,0"
  144. FontWeight="SemiBold"
  145. Click="ApplyConfigButton_OnClick"
  146. Content="3. 应用配置">
  147. <Button.Style>
  148. <Style TargetType="Button">
  149. <Setter Property="Background" Value="#2563EB" />
  150. <Setter Property="Foreground" Value="White" />
  151. <Setter Property="BorderBrush" Value="#2563EB" />
  152. <Style.Triggers>
  153. <Trigger Property="IsEnabled" Value="False">
  154. <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
  155. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  156. <Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" />
  157. </Trigger>
  158. </Style.Triggers>
  159. </Style>
  160. </Button.Style>
  161. </Button>
  162. </StackPanel>
  163. </Grid>
  164. <Border Grid.Row="3" Margin="0,12,0,0" Padding="14" Background="#FEF2F2" CornerRadius="10">
  165. <Grid>
  166. <Grid.RowDefinitions>
  167. <RowDefinition Height="Auto" />
  168. <RowDefinition Height="Auto" />
  169. </Grid.RowDefinitions>
  170. <TextBlock FontSize="13"
  171. FontWeight="SemiBold"
  172. Foreground="#991B1B"
  173. Text="高级操作" />
  174. <StackPanel Grid.Row="1" Margin="0,12,0,0">
  175. <TextBlock FontSize="12"
  176. Foreground="#991B1B"
  177. TextWrapping="Wrap"
  178. Text="重启或关闭设备会立即影响远端设备。执行后,当前连接可能马上断开。" />
  179. <StackPanel Margin="0,12,0,0" Orientation="Horizontal">
  180. <Button x:Name="RebootButton"
  181. MinHeight="36"
  182. Padding="14,0"
  183. FontWeight="SemiBold"
  184. Background="#FFF7ED"
  185. Foreground="#9A3412"
  186. BorderBrush="#FDBA74"
  187. Click="RebootButton_OnClick"
  188. Content="重启设备" />
  189. <Button x:Name="ShutdownButton"
  190. Margin="10,0,0,0"
  191. MinHeight="36"
  192. Padding="14,0"
  193. FontWeight="SemiBold"
  194. Background="#DC2626"
  195. Foreground="White"
  196. BorderBrush="#DC2626"
  197. Click="ShutdownButton_OnClick"
  198. Content="关闭设备" />
  199. </StackPanel>
  200. </StackPanel>
  201. </Grid>
  202. </Border>
  203. </Grid>
  204. </Border>
  205. </Grid>
  206. </ScrollViewer>
  207. <Border x:Name="BusyOverlay"
  208. Visibility="Collapsed"
  209. Panel.ZIndex="90"
  210. Background="#80F5F7FB">
  211. <Border HorizontalAlignment="Center"
  212. VerticalAlignment="Center"
  213. Padding="18,16"
  214. Background="White"
  215. CornerRadius="12">
  216. <StackPanel>
  217. <ProgressBar Width="220"
  218. Height="6"
  219. IsIndeterminate="True" />
  220. <TextBlock x:Name="BusyMessageTextBlock"
  221. Margin="0,12,0,0"
  222. HorizontalAlignment="Center"
  223. FontSize="13"
  224. FontWeight="SemiBold"
  225. Foreground="#111827"
  226. Text="正在处理,请稍候..." />
  227. </StackPanel>
  228. </Border>
  229. </Border>
  230. <Border x:Name="StatusMessageBorder"
  231. Visibility="Collapsed"
  232. Panel.ZIndex="100"
  233. HorizontalAlignment="Center"
  234. VerticalAlignment="Top"
  235. Margin="24,12,24,0"
  236. MaxWidth="860"
  237. Padding="14,10"
  238. Background="#111827"
  239. CornerRadius="10">
  240. <TextBlock x:Name="StatusMessageTextBlock"
  241. FontSize="13"
  242. Foreground="White"
  243. TextWrapping="Wrap"
  244. Text="" />
  245. </Border>
  246. </Grid>
  247. </Window>