You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
372 lines
22 KiB
372 lines
22 KiB
<reactive:ReactiveUserControl xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:vm="using:AuroraDesk.Presentation.ViewModels.Pages"
|
|
xmlns:reactive="using:ReactiveUI.Avalonia"
|
|
xmlns:heroicons="clr-namespace:HeroIconsAvalonia.Controls;assembly=HeroIconsAvalonia"
|
|
xmlns:entities="using:AuroraDesk.Core.Entities"
|
|
xmlns:converters="using:AuroraDesk.Presentation.Converters"
|
|
mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="800"
|
|
x:Class="AuroraDesk.Presentation.Views.Pages.WirelessAdapterPageView"
|
|
x:DataType="vm:WirelessAdapterPageViewModel">
|
|
|
|
<Design.DataContext>
|
|
<vm:WirelessAdapterPageViewModel />
|
|
</Design.DataContext>
|
|
|
|
<Grid Margin="16">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- 状态卡片行 -->
|
|
<Grid Grid.Row="0" Margin="0,0,0,16">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!-- 网卡总数 -->
|
|
<Border Grid.Column="0"
|
|
Background="#3498DB"
|
|
CornerRadius="12"
|
|
Margin="0,0,8,0"
|
|
Padding="20">
|
|
<StackPanel>
|
|
<heroicons:HeroIcon Type="Signal"
|
|
Width="28" Height="28"
|
|
Foreground="White"
|
|
HorizontalAlignment="Center"
|
|
Margin="0,0,0,8"/>
|
|
<TextBlock Text="{Binding AdapterCount}"
|
|
FontSize="28"
|
|
FontWeight="Bold"
|
|
Foreground="White"
|
|
HorizontalAlignment="Center"/>
|
|
<TextBlock Text="网卡总数"
|
|
FontSize="12"
|
|
Foreground="White"
|
|
HorizontalAlignment="Center"
|
|
Opacity="0.9"
|
|
Margin="0,4,0,0"/>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- 已连接数量 -->
|
|
<Border Grid.Column="1"
|
|
Background="#27AE60"
|
|
CornerRadius="12"
|
|
Margin="4,0,4,0"
|
|
Padding="20">
|
|
<StackPanel>
|
|
<heroicons:HeroIcon Type="Link"
|
|
Width="28" Height="28"
|
|
Foreground="White"
|
|
HorizontalAlignment="Center"
|
|
Margin="0,0,0,8"/>
|
|
<TextBlock Text="{Binding ConnectedCount}"
|
|
FontSize="28"
|
|
FontWeight="Bold"
|
|
Foreground="White"
|
|
HorizontalAlignment="Center"/>
|
|
<TextBlock Text="已连接"
|
|
FontSize="12"
|
|
Foreground="White"
|
|
HorizontalAlignment="Center"
|
|
Opacity="0.9"
|
|
Margin="0,4,0,0"/>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- 状态信息 -->
|
|
<Border Grid.Column="2"
|
|
Background="#9B59B6"
|
|
CornerRadius="12"
|
|
Margin="8,0,0,0"
|
|
Padding="20">
|
|
<StackPanel>
|
|
<heroicons:HeroIcon Type="InformationCircle"
|
|
Width="28" Height="28"
|
|
Foreground="White"
|
|
HorizontalAlignment="Center"
|
|
Margin="0,0,0,8"/>
|
|
<TextBlock Text="{Binding StatusMessage}"
|
|
FontSize="13"
|
|
FontWeight="SemiBold"
|
|
Foreground="White"
|
|
HorizontalAlignment="Center"
|
|
TextWrapping="Wrap"
|
|
TextAlignment="Center"/>
|
|
</StackPanel>
|
|
</Border>
|
|
</Grid>
|
|
|
|
<!-- 操作按钮行 -->
|
|
<Grid Grid.Row="1" Margin="0,0,0,16">
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
|
<Button Content="刷新"
|
|
Command="{Binding RefreshCommand}"
|
|
IsEnabled="{Binding !IsLoading}"
|
|
Padding="16,8"
|
|
Margin="0,0,8,0">
|
|
<Button.Styles>
|
|
<Style Selector="Button">
|
|
<Setter Property="CornerRadius" Value="8"/>
|
|
</Style>
|
|
</Button.Styles>
|
|
</Button>
|
|
<Button Content="重新加载"
|
|
Command="{Binding LoadCommand}"
|
|
IsEnabled="{Binding !IsLoading}"
|
|
Padding="16,8">
|
|
<Button.Styles>
|
|
<Style Selector="Button">
|
|
<Setter Property="CornerRadius" Value="8"/>
|
|
</Style>
|
|
</Button.Styles>
|
|
</Button>
|
|
</StackPanel>
|
|
</Grid>
|
|
|
|
<!-- 网卡列表 -->
|
|
<Border Grid.Row="2"
|
|
BorderBrush="#E0E0E0"
|
|
BorderThickness="1"
|
|
CornerRadius="8"
|
|
Background="White">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- 列表标题 -->
|
|
<Border Grid.Row="0"
|
|
Background="#F5F5F5"
|
|
CornerRadius="8,8,0,0"
|
|
Padding="16,12"
|
|
BorderBrush="#E0E0E0"
|
|
BorderThickness="0,0,0,1">
|
|
<TextBlock Text="无线网卡列表"
|
|
FontSize="16"
|
|
FontWeight="SemiBold"
|
|
VerticalAlignment="Center"/>
|
|
</Border>
|
|
|
|
<!-- 网卡列表内容 -->
|
|
<ScrollViewer Grid.Row="1"
|
|
VerticalScrollBarVisibility="Auto"
|
|
HorizontalScrollBarVisibility="Auto">
|
|
<ItemsControl ItemsSource="{Binding Adapters}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate DataType="entities:WirelessAdapterInfo">
|
|
<Border BorderBrush="#E0E0E0"
|
|
BorderThickness="0,0,0,1"
|
|
Padding="16,12"
|
|
Background="White">
|
|
<Border.Styles>
|
|
<Style Selector="Border:pointerover">
|
|
<Setter Property="Background" Value="#F9F9F9"/>
|
|
</Style>
|
|
</Border.Styles>
|
|
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!-- 左侧信息 -->
|
|
<StackPanel Grid.Column="0" Spacing="8">
|
|
<!-- 名称和状态 -->
|
|
<StackPanel Orientation="Horizontal" Spacing="12">
|
|
<TextBlock Text="{Binding Name}"
|
|
FontSize="16"
|
|
FontWeight="SemiBold"/>
|
|
<Border Background="{Binding IsConnected, Converter={x:Static converters:StringConverters.BoolToBrushConverter}}"
|
|
CornerRadius="4"
|
|
Padding="6,2">
|
|
<TextBlock Text="{Binding ConnectionStatus}"
|
|
FontSize="10"
|
|
FontWeight="Bold"
|
|
Foreground="White"/>
|
|
</Border>
|
|
<Border Background="#E74C3C"
|
|
CornerRadius="4"
|
|
Padding="6,2"
|
|
IsVisible="{Binding !IsEnabled}">
|
|
<TextBlock Text="已禁用"
|
|
FontSize="10"
|
|
FontWeight="Bold"
|
|
Foreground="White"/>
|
|
</Border>
|
|
</StackPanel>
|
|
|
|
<!-- 描述 -->
|
|
<TextBlock Text="{Binding Description}"
|
|
FontSize="12"
|
|
Foreground="#666"
|
|
TextWrapping="Wrap"/>
|
|
|
|
<!-- 详细信息网格 -->
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- MAC 地址 -->
|
|
<TextBlock Grid.Row="0" Grid.Column="0"
|
|
Text="MAC 地址:"
|
|
FontSize="12"
|
|
Foreground="#999"
|
|
Margin="0,0,8,4"/>
|
|
<TextBlock Grid.Row="0" Grid.Column="1"
|
|
Text="{Binding MacAddress}"
|
|
FontSize="12"
|
|
Margin="0,0,16,4"/>
|
|
|
|
<!-- IP 地址 -->
|
|
<TextBlock Grid.Row="0" Grid.Column="2"
|
|
Text="IP 地址:"
|
|
FontSize="12"
|
|
Foreground="#999"
|
|
Margin="0,0,8,4"/>
|
|
<TextBlock Grid.Row="0" Grid.Column="3"
|
|
Text="{Binding IpAddress}"
|
|
FontSize="12"
|
|
Margin="0,0,0,4"/>
|
|
|
|
<!-- 子网掩码 -->
|
|
<TextBlock Grid.Row="1" Grid.Column="0"
|
|
Text="子网掩码:"
|
|
FontSize="12"
|
|
Foreground="#999"
|
|
Margin="0,0,8,4"/>
|
|
<TextBlock Grid.Row="1" Grid.Column="1"
|
|
Text="{Binding SubnetMask}"
|
|
FontSize="12"
|
|
Margin="0,0,16,4"/>
|
|
|
|
<!-- 网关 -->
|
|
<TextBlock Grid.Row="1" Grid.Column="2"
|
|
Text="网关:"
|
|
FontSize="12"
|
|
Foreground="#999"
|
|
Margin="0,0,8,4"/>
|
|
<TextBlock Grid.Row="1" Grid.Column="3"
|
|
Text="{Binding Gateway}"
|
|
FontSize="12"
|
|
Margin="0,0,0,4"/>
|
|
|
|
<!-- DNS 服务器 -->
|
|
<TextBlock Grid.Row="2" Grid.Column="0"
|
|
Text="DNS 服务器:"
|
|
FontSize="12"
|
|
Foreground="#999"
|
|
Margin="0,0,8,4"/>
|
|
<TextBlock Grid.Row="2" Grid.Column="1"
|
|
Text="{Binding DnsServers}"
|
|
FontSize="12"
|
|
TextWrapping="Wrap"
|
|
Margin="0,0,16,4"/>
|
|
|
|
<!-- SSID -->
|
|
<TextBlock Grid.Row="2" Grid.Column="2"
|
|
Text="SSID:"
|
|
FontSize="12"
|
|
Foreground="#999"
|
|
Margin="0,0,8,4"/>
|
|
<TextBlock Grid.Row="2" Grid.Column="3"
|
|
Text="{Binding Ssid}"
|
|
FontSize="12"
|
|
Margin="0,0,0,4"/>
|
|
|
|
<!-- 信号强度 -->
|
|
<TextBlock Grid.Row="3" Grid.Column="0"
|
|
Text="信号强度:"
|
|
FontSize="12"
|
|
Foreground="#999"
|
|
Margin="0,0,8,4"/>
|
|
<TextBlock Grid.Row="3" Grid.Column="1"
|
|
Text="{Binding SignalStrength}"
|
|
FontSize="12"
|
|
Margin="0,0,16,4"/>
|
|
|
|
<!-- 频道 -->
|
|
<TextBlock Grid.Row="3" Grid.Column="2"
|
|
Text="频道:"
|
|
FontSize="12"
|
|
Foreground="#999"
|
|
Margin="0,0,8,4"/>
|
|
<TextBlock Grid.Row="3" Grid.Column="3"
|
|
Text="{Binding Channel}"
|
|
FontSize="12"
|
|
Margin="0,0,0,4"/>
|
|
</Grid>
|
|
|
|
<!-- 网络命名空间(仅 Linux) -->
|
|
<StackPanel Orientation="Horizontal"
|
|
Spacing="8"
|
|
IsVisible="{Binding NetworkNamespace, Converter={x:Static converters:StringConverters.StringToVisibilityConverter}}">
|
|
<TextBlock Text="网络命名空间:"
|
|
FontSize="12"
|
|
Foreground="#999"/>
|
|
<Border Background="#E3F2FD"
|
|
CornerRadius="4"
|
|
Padding="6,2">
|
|
<TextBlock Text="{Binding NetworkNamespace}"
|
|
FontSize="11"
|
|
FontWeight="SemiBold"
|
|
Foreground="#1976D2"/>
|
|
</Border>
|
|
</StackPanel>
|
|
|
|
<!-- 其他信息 -->
|
|
<StackPanel Orientation="Horizontal" Spacing="16" Margin="0,4,0,0">
|
|
<TextBlock FontSize="11" Foreground="#999">
|
|
<Run Text="认证类型: "/>
|
|
<Run Text="{Binding AuthenticationType, TargetNullValue='未知'}"/>
|
|
</TextBlock>
|
|
<TextBlock FontSize="11" Foreground="#999">
|
|
<Run Text="加密类型: "/>
|
|
<Run Text="{Binding EncryptionType, TargetNullValue='未知'}"/>
|
|
</TextBlock>
|
|
<TextBlock FontSize="11" Foreground="#999">
|
|
<Run Text="无线电类型: "/>
|
|
<Run Text="{Binding RadioType, TargetNullValue='未知'}"/>
|
|
</TextBlock>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Grid>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</ScrollViewer>
|
|
|
|
<!-- 空状态提示 -->
|
|
<TextBlock Grid.Row="1"
|
|
Text="暂无无线网卡信息"
|
|
FontSize="14"
|
|
Foreground="#999"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
IsVisible="{Binding Adapters.Count, Converter={x:Static converters:StringConverters.IntToVisibilityConverter}}"/>
|
|
</Grid>
|
|
</Border>
|
|
</Grid>
|
|
</reactive:ReactiveUserControl>
|
|
|
|
|