MainWindow.xaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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="Auto" />
  16. <RowDefinition Height="*" />
  17. <RowDefinition Height="Auto" />
  18. </Grid.RowDefinitions>
  19. <Border Grid.Row="0"
  20. Margin="24,24,24,16"
  21. Padding="24"
  22. Background="White"
  23. CornerRadius="12">
  24. <StackPanel>
  25. <TextBlock FontSize="28"
  26. FontWeight="SemiBold"
  27. Foreground="#111827"
  28. Text="QuickIP 连接页" />
  29. <TextBlock Margin="0,8,0,0"
  30. FontSize="14"
  31. Foreground="#4B5563"
  32. Text="先选择本机有线网卡,客户端会优先尝试直连管理口;只有直连失败时,才需要切换到维护网络。" />
  33. </StackPanel>
  34. </Border>
  35. <Grid Grid.Row="1" Margin="24,0,24,16">
  36. <Grid.ColumnDefinitions>
  37. <ColumnDefinition Width="2.2*" />
  38. <ColumnDefinition Width="1.4*" />
  39. </Grid.ColumnDefinitions>
  40. <Border Grid.Column="0"
  41. Margin="0,0,16,0"
  42. Padding="24"
  43. Background="White"
  44. CornerRadius="12">
  45. <Grid>
  46. <Grid.RowDefinitions>
  47. <RowDefinition Height="Auto" />
  48. <RowDefinition Height="Auto" />
  49. <RowDefinition Height="Auto" />
  50. <RowDefinition Height="Auto" />
  51. <RowDefinition Height="*" />
  52. </Grid.RowDefinitions>
  53. <TextBlock FontSize="20"
  54. FontWeight="SemiBold"
  55. Foreground="#111827"
  56. Text="本机网卡与连接" />
  57. <StackPanel Grid.Row="1" Margin="0,20,0,0">
  58. <TextBlock FontSize="13"
  59. Foreground="#374151"
  60. Text="本机有线网卡" />
  61. <ComboBox x:Name="AdapterComboBox"
  62. Margin="0,8,0,0"
  63. MinHeight="36"
  64. DisplayMemberPath="DisplayName"
  65. SelectionChanged="AdapterComboBox_OnSelectionChanged" />
  66. <Border Margin="0,12,0,0" Padding="12" Background="#F9FAFB" CornerRadius="10">
  67. <StackPanel>
  68. <TextBlock FontSize="12" Foreground="#6B7280" Text="建议选择" />
  69. <TextBlock x:Name="RecommendedAdapterTextBlock"
  70. Margin="0,8,0,0"
  71. FontSize="14"
  72. FontWeight="SemiBold"
  73. Foreground="#111827"
  74. Text="-" />
  75. <TextBlock x:Name="RecommendedReasonTextBlock"
  76. Margin="0,8,0,0"
  77. FontSize="12"
  78. Foreground="#4B5563"
  79. Text="-" />
  80. <TextBlock x:Name="ProbeReasonTextBlock"
  81. Margin="0,8,0,0"
  82. FontSize="12"
  83. Foreground="#4B5563"
  84. Text="尚未对 169.254.100.2 进行可达性探测。" />
  85. </StackPanel>
  86. </Border>
  87. </StackPanel>
  88. <UniformGrid Grid.Row="2" Margin="0,24,0,0" Columns="2">
  89. <Border Margin="0,0,12,12" Padding="16" Background="#F9FAFB" CornerRadius="10">
  90. <StackPanel>
  91. <TextBlock FontSize="12" Foreground="#6B7280" Text="网卡名称 / 级别" />
  92. <TextBlock x:Name="AdapterNameTextBlock" Margin="0,8,0,0" FontSize="16" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  93. </StackPanel>
  94. </Border>
  95. <Border Margin="0,0,0,12" Padding="16" Background="#F9FAFB" CornerRadius="10">
  96. <StackPanel>
  97. <TextBlock FontSize="12" Foreground="#6B7280" Text="链路状态" />
  98. <TextBlock x:Name="AdapterLinkTextBlock" Margin="0,8,0,0" FontSize="16" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  99. </StackPanel>
  100. </Border>
  101. <Border Margin="0,0,12,0" Padding="16" Background="#F9FAFB" CornerRadius="10">
  102. <StackPanel>
  103. <TextBlock FontSize="12" Foreground="#6B7280" Text="当前 IPv4" />
  104. <TextBlock x:Name="AdapterIPv4TextBlock" Margin="0,8,0,0" FontSize="16" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  105. </StackPanel>
  106. </Border>
  107. <Border Margin="0,0,0,0" Padding="16" Background="#F9FAFB" CornerRadius="10">
  108. <StackPanel>
  109. <TextBlock FontSize="12" Foreground="#6B7280" Text="网卡类型" />
  110. <TextBlock x:Name="AdapterTypeTextBlock" Margin="0,8,0,0" FontSize="16" FontWeight="SemiBold" Foreground="#111827" Text="-" />
  111. </StackPanel>
  112. </Border>
  113. </UniformGrid>
  114. <Border Grid.Row="2" Margin="0,156,0,0" Padding="16" Background="#ECFDF5" CornerRadius="10" VerticalAlignment="Top">
  115. <StackPanel>
  116. <TextBlock FontSize="12" Foreground="#065F46" Text="管理口探测结果" />
  117. <TextBlock x:Name="AdapterProbeTextBlock"
  118. Margin="0,8,0,0"
  119. FontSize="16"
  120. FontWeight="SemiBold"
  121. Foreground="#065F46"
  122. Text="-" />
  123. </StackPanel>
  124. </Border>
  125. <Border Grid.Row="3" Margin="0,24,0,0" Padding="16" Background="#EEF2FF" CornerRadius="10">
  126. <StackPanel>
  127. <TextBlock x:Name="StatusTextBlock"
  128. FontSize="13"
  129. Foreground="#3730A3"
  130. TextWrapping="Wrap"
  131. Text="请选择一块有线网卡。" />
  132. <TextBlock x:Name="DiscoveredDeviceTextBlock"
  133. Margin="0,10,0,0"
  134. FontSize="12"
  135. Foreground="#4B5563"
  136. TextWrapping="Wrap"
  137. Text="尚未发现设备。" />
  138. </StackPanel>
  139. </Border>
  140. </Grid>
  141. </Border>
  142. <Border Grid.Column="1"
  143. Padding="24"
  144. Background="White"
  145. CornerRadius="12">
  146. <Grid>
  147. <Grid.RowDefinitions>
  148. <RowDefinition Height="Auto" />
  149. <RowDefinition Height="Auto" />
  150. <RowDefinition Height="Auto" />
  151. <RowDefinition Height="Auto" />
  152. <RowDefinition Height="Auto" />
  153. <RowDefinition Height="*" />
  154. </Grid.RowDefinitions>
  155. <TextBlock FontSize="20"
  156. FontWeight="SemiBold"
  157. Foreground="#111827"
  158. Text="操作" />
  159. <Border Grid.Row="1" Margin="0,20,0,0" Padding="16" Background="#F9FAFB" CornerRadius="10">
  160. <StackPanel>
  161. <TextBlock FontSize="13"
  162. FontWeight="SemiBold"
  163. Foreground="#111827"
  164. Text="管理密码(必填)" />
  165. <TextBlock Margin="0,6,0,0"
  166. FontSize="12"
  167. Foreground="#6B7280"
  168. Text="用于连接 Linux Agent。客户端不会在界面上显示默认密码。" />
  169. <Grid Margin="0,10,0,0">
  170. <Grid.ColumnDefinitions>
  171. <ColumnDefinition Width="*" />
  172. <ColumnDefinition Width="Auto" />
  173. </Grid.ColumnDefinitions>
  174. <PasswordBox x:Name="PasswordBox"
  175. MinHeight="38"
  176. VerticalContentAlignment="Center"
  177. PasswordChanged="PasswordBox_OnPasswordChanged"
  178. ToolTip="请输入当前 Agent 使用的管理密码。" />
  179. <TextBox x:Name="PasswordTextBox"
  180. Visibility="Collapsed"
  181. MinHeight="38"
  182. VerticalContentAlignment="Center"
  183. TextChanged="PasswordTextBox_OnTextChanged"
  184. ToolTip="请输入当前 Agent 使用的管理密码。" />
  185. <Button x:Name="TogglePasswordVisibilityButton"
  186. Grid.Column="1"
  187. Margin="8,0,0,0"
  188. MinWidth="42"
  189. Padding="10,0"
  190. Click="TogglePasswordVisibilityButton_OnClick"
  191. Content="👁" />
  192. </Grid>
  193. <TextBlock Margin="0,10,0,0"
  194. FontSize="12"
  195. Foreground="#6B7280"
  196. Text="客户端会自动保存并回填你上次输入的密码。" />
  197. </StackPanel>
  198. </Border>
  199. <Button x:Name="SwitchMaintenanceButton"
  200. Grid.Row="2"
  201. Margin="0,16,0,0"
  202. MinHeight="42"
  203. Click="SwitchMaintenanceButton_OnClick"
  204. Content="切换到维护网络" />
  205. <Button x:Name="DiscoverConnectButton"
  206. Grid.Row="3"
  207. Margin="0,12,0,0"
  208. MinHeight="42"
  209. Click="DiscoverConnectButton_OnClick"
  210. Content="发现并连接" />
  211. <Border Grid.Row="4" Margin="0,16,0,0" Padding="12" Background="#FEF3C7" CornerRadius="10">
  212. <TextBlock x:Name="AdminStateTextBlock"
  213. FontSize="12"
  214. Foreground="#92400E"
  215. TextWrapping="Wrap"
  216. Text="管理员状态:未知" />
  217. </Border>
  218. <Border Grid.Row="5" Margin="0,16,0,0" Padding="16" Background="#F9FAFB" CornerRadius="10">
  219. <StackPanel>
  220. <TextBlock FontSize="13" FontWeight="SemiBold" Foreground="#111827" Text="当前执行顺序" />
  221. <TextBlock Margin="0,12,0,0" Foreground="#4B5563" Text="1. 选择本机有线网卡" />
  222. <TextBlock Margin="0,8,0,0" Foreground="#4B5563" Text="2. 先尝试直接访问 169.254.100.2" />
  223. <TextBlock Margin="0,8,0,0" Foreground="#4B5563" Text="3. 如果直连失败,再切换到维护网络" />
  224. <TextBlock Margin="0,8,0,0" Foreground="#4B5563" Text="4. 自动带出或输入密码并验证连接" />
  225. </StackPanel>
  226. </Border>
  227. <Border Grid.Row="6" Margin="0,16,0,0" Padding="16" Background="#F3F4F6" CornerRadius="10">
  228. <Grid>
  229. <Grid.RowDefinitions>
  230. <RowDefinition Height="Auto" />
  231. <RowDefinition Height="*" />
  232. </Grid.RowDefinitions>
  233. <TextBlock FontSize="13" FontWeight="SemiBold" Foreground="#111827" Text="运行日志" />
  234. <ListBox x:Name="EventLogListBox"
  235. Grid.Row="1"
  236. Margin="0,12,0,0"
  237. MinHeight="180" />
  238. </Grid>
  239. </Border>
  240. </Grid>
  241. </Border>
  242. </Grid>
  243. <Border Grid.Row="2"
  244. Margin="24,0,24,24"
  245. Padding="16"
  246. Background="White"
  247. CornerRadius="12">
  248. <TextBlock Foreground="#6B7280"
  249. Text="当前版本已支持推荐网卡、本机密码保存、切换到维护网络、UDP 发现和最小 HTTP 连接验证。点击按钮后会在右侧日志里显示详细步骤。" />
  250. </Border>
  251. </Grid>
  252. </Window>