MainWindow.xaml 22 KB

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