MainWindow.xaml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <Window x:Class="QuickIP.Client.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. mc:Ignorable="d"
  7. Title="QuickIP"
  8. Height="680"
  9. Width="980"
  10. MinHeight="640"
  11. MinWidth="920"
  12. WindowStartupLocation="CenterScreen">
  13. <Grid Background="#F5F7FB">
  14. <Grid.RowDefinitions>
  15. <RowDefinition Height="*" />
  16. <RowDefinition Height="Auto" />
  17. </Grid.RowDefinitions>
  18. <Border x:Name="StatusMessageBorder"
  19. Visibility="Collapsed"
  20. Panel.ZIndex="100"
  21. HorizontalAlignment="Center"
  22. VerticalAlignment="Top"
  23. Margin="24,16,24,0"
  24. MaxWidth="760"
  25. Padding="14,10"
  26. Background="#111827"
  27. CornerRadius="10">
  28. <TextBlock x:Name="StatusTextBlock"
  29. FontSize="13"
  30. Foreground="White"
  31. TextWrapping="Wrap"
  32. Text="" />
  33. </Border>
  34. <Grid Grid.Row="0" Margin="24,24,24,16">
  35. <Grid.ColumnDefinitions>
  36. <ColumnDefinition Width="2.2*" />
  37. <ColumnDefinition Width="1.4*" />
  38. </Grid.ColumnDefinitions>
  39. <Border Grid.Column="0"
  40. Margin="0,0,16,0"
  41. Padding="24"
  42. Background="White"
  43. CornerRadius="12">
  44. <Grid>
  45. <Grid.RowDefinitions>
  46. <RowDefinition Height="Auto" />
  47. <RowDefinition Height="*" />
  48. </Grid.RowDefinitions>
  49. <TextBlock FontSize="20"
  50. FontWeight="SemiBold"
  51. Foreground="#111827"
  52. Text="① 连接准备" />
  53. <Grid Grid.Row="1" Margin="0,20,0,0">
  54. <Grid.RowDefinitions>
  55. <RowDefinition Height="Auto" />
  56. <RowDefinition Height="Auto" />
  57. <RowDefinition Height="*" />
  58. </Grid.RowDefinitions>
  59. <Border Padding="16" Background="#F9FAFB" CornerRadius="10">
  60. <StackPanel>
  61. <TextBlock FontSize="13" FontWeight="SemiBold" Foreground="#111827" Text="本机网卡与连接" />
  62. <TextBlock Margin="0,12,0,0"
  63. FontSize="13"
  64. Foreground="#374151"
  65. Text="本机有线网卡" />
  66. <Grid Margin="0,8,0,0">
  67. <Grid.ColumnDefinitions>
  68. <ColumnDefinition Width="*" />
  69. <ColumnDefinition Width="Auto" />
  70. </Grid.ColumnDefinitions>
  71. <ComboBox x:Name="AdapterComboBox"
  72. MinHeight="36"
  73. DisplayMemberPath="DisplayName"
  74. SelectionChanged="AdapterComboBox_OnSelectionChanged" />
  75. <Button x:Name="RefreshAdaptersButton"
  76. Grid.Column="1"
  77. Margin="8,0,0,0"
  78. MinHeight="36"
  79. Padding="14,0"
  80. Click="RefreshAdaptersButton_OnClick"
  81. Content="刷新" />
  82. </Grid>
  83. <Border Margin="0,16,0,0" Padding="14" Background="#ECFDF5" CornerRadius="10">
  84. <StackPanel>
  85. <TextBlock FontSize="12" Foreground="#065F46" Text="管理口探测结果" />
  86. <TextBlock x:Name="AdapterProbeTextBlock"
  87. Margin="0,8,0,0"
  88. FontSize="16"
  89. FontWeight="SemiBold"
  90. Foreground="#065F46"
  91. Text="-" />
  92. </StackPanel>
  93. </Border>
  94. </StackPanel>
  95. </Border>
  96. <Border Grid.Row="1" Margin="0,16,0,0" Padding="16" Background="#F9FAFB" CornerRadius="10">
  97. <StackPanel>
  98. <TextBlock FontSize="13" FontWeight="SemiBold" Foreground="#111827" Text="操作顺序" />
  99. <TextBlock Margin="0,12,0,0" Foreground="#4B5563" Text="1. 选择本机有线网卡" />
  100. <TextBlock Margin="0,8,0,0" Foreground="#4B5563" Text="2. 输入或确认管理密码" />
  101. <TextBlock Margin="0,8,0,0" Foreground="#4B5563" Text="3. 点击连接设备" />
  102. <TextBlock Margin="0,8,0,0" Foreground="#4B5563" Text="4. 如果连接失败,再切换到维护网络后重试" />
  103. </StackPanel>
  104. </Border>
  105. <Border Grid.Row="2" Margin="0,16,0,0" Padding="16" Background="#F3F4F6" CornerRadius="10">
  106. <Grid>
  107. <Grid.RowDefinitions>
  108. <RowDefinition Height="Auto" />
  109. <RowDefinition Height="*" />
  110. </Grid.RowDefinitions>
  111. <TextBlock FontSize="13" FontWeight="SemiBold" Foreground="#111827" Text="运行日志" />
  112. <ListBox x:Name="EventLogListBox"
  113. Grid.Row="1"
  114. Margin="0,12,0,0"
  115. Height="108" />
  116. </Grid>
  117. </Border>
  118. </Grid>
  119. </Grid>
  120. </Border>
  121. <Border Grid.Column="1"
  122. Padding="24"
  123. Background="White"
  124. CornerRadius="12">
  125. <Grid>
  126. <Grid.RowDefinitions>
  127. <RowDefinition Height="Auto" />
  128. <RowDefinition Height="Auto" />
  129. <RowDefinition Height="Auto" />
  130. <RowDefinition Height="Auto" />
  131. <RowDefinition Height="*" />
  132. </Grid.RowDefinitions>
  133. <TextBlock FontSize="20"
  134. FontWeight="SemiBold"
  135. Foreground="#111827"
  136. Text="② 连接与操作" />
  137. <Border Grid.Row="1" Margin="0,20,0,0" Padding="16" Background="#F9FAFB" CornerRadius="10">
  138. <StackPanel>
  139. <TextBlock FontSize="13"
  140. FontWeight="SemiBold"
  141. Foreground="#111827"
  142. Text="管理密码(必填)" />
  143. <TextBlock Margin="0,6,0,0"
  144. FontSize="12"
  145. Foreground="#6B7280"
  146. Text="用于连接 Linux Agent。客户端不会在界面上显示默认密码。" />
  147. <Grid Margin="0,10,0,0">
  148. <Grid.ColumnDefinitions>
  149. <ColumnDefinition Width="*" />
  150. <ColumnDefinition Width="Auto" />
  151. </Grid.ColumnDefinitions>
  152. <PasswordBox x:Name="PasswordBox"
  153. MinHeight="38"
  154. VerticalContentAlignment="Center"
  155. PasswordChanged="PasswordBox_OnPasswordChanged"
  156. ToolTip="请输入当前 Agent 使用的管理密码。" />
  157. <TextBox x:Name="PasswordTextBox"
  158. Visibility="Collapsed"
  159. MinHeight="38"
  160. VerticalContentAlignment="Center"
  161. TextChanged="PasswordTextBox_OnTextChanged"
  162. ToolTip="请输入当前 Agent 使用的管理密码。" />
  163. <Button x:Name="TogglePasswordVisibilityButton"
  164. Grid.Column="1"
  165. Margin="8,0,0,0"
  166. MinWidth="42"
  167. Padding="10,0"
  168. Click="TogglePasswordVisibilityButton_OnClick"
  169. Content="👁" />
  170. </Grid>
  171. <TextBlock Margin="0,10,0,0"
  172. FontSize="12"
  173. Foreground="#6B7280"
  174. Text="客户端会自动保存并回填你上次输入的密码。" />
  175. </StackPanel>
  176. </Border>
  177. <Button x:Name="SwitchMaintenanceButton"
  178. Grid.Row="2"
  179. Margin="0,16,0,0"
  180. MinHeight="42"
  181. Click="SwitchMaintenanceButton_OnClick"
  182. Content="③ 切换到维护网络(可选)" />
  183. <Button x:Name="DiscoverConnectButton"
  184. Grid.Row="3"
  185. Margin="0,12,0,0"
  186. MinHeight="42"
  187. Click="DiscoverConnectButton_OnClick"
  188. Content="④ 连接设备" />
  189. <Border Grid.Row="4" Margin="0,16,0,0" Padding="12" Background="#FEF3C7" CornerRadius="10">
  190. <TextBlock x:Name="AdminStateTextBlock"
  191. FontSize="12"
  192. Foreground="#92400E"
  193. TextWrapping="Wrap"
  194. Text="管理员状态:未知" />
  195. </Border>
  196. </Grid>
  197. </Border>
  198. </Grid>
  199. <Border Grid.Row="1"
  200. x:Name="RemoteDetailsBorder"
  201. Visibility="Collapsed"
  202. Margin="24,0,24,24"
  203. Padding="16"
  204. Background="White"
  205. CornerRadius="12">
  206. <Grid>
  207. <Grid.RowDefinitions>
  208. <RowDefinition Height="Auto" />
  209. <RowDefinition Height="Auto" />
  210. <RowDefinition Height="Auto" />
  211. <RowDefinition Height="Auto" />
  212. <RowDefinition Height="Auto" />
  213. <RowDefinition Height="Auto" />
  214. </Grid.RowDefinitions>
  215. <TextBlock FontSize="18"
  216. FontWeight="SemiBold"
  217. Foreground="#111827"
  218. Text="设备信息与 Linux 接口" />
  219. <UniformGrid Grid.Row="1" Margin="0,16,0,0" Columns="4">
  220. <Border Margin="0,0,12,0" Padding="14" Background="#F9FAFB" CornerRadius="10">
  221. <StackPanel>
  222. <TextBlock FontSize="12" Foreground="#6B7280" Text="设备 ID" />
  223. <TextBlock x:Name="RemoteDeviceIdTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  224. </StackPanel>
  225. </Border>
  226. <Border Margin="0,0,12,0" Padding="14" Background="#F9FAFB" CornerRadius="10">
  227. <StackPanel>
  228. <TextBlock FontSize="12" Foreground="#6B7280" Text="主机名" />
  229. <TextBlock x:Name="RemoteHostnameTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  230. </StackPanel>
  231. </Border>
  232. <Border Margin="0,0,12,0" Padding="14" Background="#F9FAFB" CornerRadius="10">
  233. <StackPanel>
  234. <TextBlock FontSize="12" Foreground="#6B7280" Text="Ubuntu 版本" />
  235. <TextBlock x:Name="RemoteOsVersionTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  236. </StackPanel>
  237. </Border>
  238. <Border Padding="14" Background="#F9FAFB" CornerRadius="10">
  239. <StackPanel>
  240. <TextBlock FontSize="12" Foreground="#6B7280" Text="Agent 版本" />
  241. <TextBlock x:Name="RemoteAgentVersionTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  242. </StackPanel>
  243. </Border>
  244. </UniformGrid>
  245. <Border Grid.Row="2" Margin="0,16,0,0" Padding="16" Background="#F9FAFB" CornerRadius="10">
  246. <Grid>
  247. <Grid.RowDefinitions>
  248. <RowDefinition Height="Auto" />
  249. <RowDefinition Height="Auto" />
  250. <RowDefinition Height="Auto" />
  251. </Grid.RowDefinitions>
  252. <TextBlock FontSize="13" FontWeight="SemiBold" Foreground="#111827" Text="目标接口" />
  253. <ComboBox x:Name="RemoteTargetInterfaceComboBox"
  254. Grid.Row="1"
  255. Margin="0,12,0,0"
  256. MinHeight="36"
  257. DisplayMemberPath="DisplayName"
  258. SelectionChanged="RemoteTargetInterfaceComboBox_OnSelectionChanged" />
  259. <UniformGrid Grid.Row="2" Margin="0,16,0,0" Columns="4">
  260. <Border Margin="0,0,12,0" Padding="12" Background="#EEF2FF" CornerRadius="10">
  261. <StackPanel>
  262. <TextBlock FontSize="12" Foreground="#6B7280" Text="接口名" />
  263. <TextBlock x:Name="RemoteConfigInterfaceTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  264. </StackPanel>
  265. </Border>
  266. <Border Margin="0,0,12,0" Padding="12" Background="#EEF2FF" CornerRadius="10">
  267. <StackPanel>
  268. <TextBlock FontSize="12" Foreground="#6B7280" Text="当前 IP" />
  269. <TextBlock x:Name="RemoteConfigIpTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  270. </StackPanel>
  271. </Border>
  272. <Border Margin="0,0,12,0" Padding="12" Background="#EEF2FF" CornerRadius="10">
  273. <StackPanel>
  274. <TextBlock FontSize="12" Foreground="#6B7280" Text="当前网关" />
  275. <TextBlock x:Name="RemoteConfigGatewayTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  276. </StackPanel>
  277. </Border>
  278. <Border Padding="12" Background="#EEF2FF" CornerRadius="10">
  279. <StackPanel>
  280. <TextBlock FontSize="12" Foreground="#6B7280" Text="当前 DNS" />
  281. <TextBlock x:Name="RemoteConfigDnsTextBlock" Margin="0,8,0,0" FontSize="14" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  282. </StackPanel>
  283. </Border>
  284. </UniformGrid>
  285. </Grid>
  286. </Border>
  287. <Border Grid.Row="3" Margin="0,16,0,0" Padding="12" Background="#EEF2FF" CornerRadius="10">
  288. <TextBlock x:Name="RemoteSummaryTextBlock"
  289. FontSize="12"
  290. Foreground="#3730A3"
  291. TextWrapping="Wrap"
  292. Text="连接成功后,这里会显示 Linux 管理接口和建议目标接口。" />
  293. </Border>
  294. <Border Grid.Row="4" Margin="0,12,0,0" Padding="12" Background="#F9FAFB" CornerRadius="10">
  295. <Grid>
  296. <Grid.RowDefinitions>
  297. <RowDefinition Height="Auto" />
  298. <RowDefinition Height="Auto" />
  299. <RowDefinition Height="Auto" />
  300. <RowDefinition Height="Auto" />
  301. <RowDefinition Height="Auto" />
  302. <RowDefinition Height="Auto" />
  303. </Grid.RowDefinitions>
  304. <TextBlock FontSize="13" FontWeight="SemiBold" Foreground="#111827" Text="新配置" />
  305. <StackPanel Grid.Row="1" Margin="0,12,0,0" Orientation="Horizontal">
  306. <Button x:Name="ReloadInterfaceConfigButton"
  307. MinHeight="36"
  308. Padding="14,0"
  309. Click="ReloadInterfaceConfigButton_OnClick"
  310. Content="1. 读取当前配置" />
  311. <Button x:Name="ValidateConfigButton"
  312. Margin="10,0,0,0"
  313. MinHeight="36"
  314. Padding="14,0"
  315. Click="ValidateConfigButton_OnClick"
  316. Content="2. 校验配置" />
  317. <Button x:Name="ApplyConfigButton"
  318. Margin="10,0,0,0"
  319. MinHeight="36"
  320. Padding="14,0"
  321. Click="ApplyConfigButton_OnClick"
  322. Content="3. 应用配置" />
  323. </StackPanel>
  324. <UniformGrid Grid.Row="2" Margin="0,12,0,0" Columns="2">
  325. <StackPanel Margin="0,0,12,12">
  326. <TextBlock FontSize="12" Foreground="#6B7280" Text="IP 地址" />
  327. <TextBox x:Name="NewIpTextBox" Margin="0,8,0,0" MinHeight="32" TextChanged="ConfigInputChanged_OnChanged" />
  328. </StackPanel>
  329. <StackPanel Margin="0,0,0,12">
  330. <TextBlock FontSize="12" Foreground="#6B7280" Text="子网掩码" />
  331. <TextBox x:Name="NewMaskTextBox" Margin="0,8,0,0" MinHeight="32" TextChanged="ConfigInputChanged_OnChanged" />
  332. </StackPanel>
  333. <StackPanel Margin="0,0,12,0">
  334. <TextBlock FontSize="12" Foreground="#6B7280" Text="网关" />
  335. <TextBox x:Name="NewGatewayTextBox" Margin="0,8,0,0" MinHeight="32" TextChanged="ConfigInputChanged_OnChanged" />
  336. </StackPanel>
  337. <StackPanel Margin="0,0,0,0">
  338. <TextBlock FontSize="12" Foreground="#6B7280" Text="首选 DNS" />
  339. <TextBox x:Name="NewDnsTextBox" Margin="0,8,0,0" MinHeight="32" TextChanged="ConfigInputChanged_OnChanged" />
  340. </StackPanel>
  341. </UniformGrid>
  342. <Border Grid.Row="3" Margin="0,12,0,0" Padding="10" Background="#EEF2FF" CornerRadius="10">
  343. <TextBlock x:Name="ConfigValidationTextBlock"
  344. FontSize="12"
  345. Foreground="#3730A3"
  346. TextWrapping="Wrap"
  347. Text="点击 1/2/3 按顺序操作:先读取当前配置,再校验,最后应用。" />
  348. </Border>
  349. <Border Grid.Row="4" Margin="0,12,0,0" Padding="10" Background="#ECFDF5" CornerRadius="10">
  350. <TextBlock x:Name="ApplyTaskStatusTextBlock"
  351. FontSize="12"
  352. Foreground="#065F46"
  353. TextWrapping="Wrap"
  354. Text="尚未提交配置任务。" />
  355. </Border>
  356. </Grid>
  357. </Border>
  358. </Grid>
  359. </Border>
  360. </Grid>
  361. </Window>