MainWindow.xaml 21 KB

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