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.
559 lines
33 KiB
559 lines
33 KiB
|
1 month ago
|
<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:converters="using:AuroraDesk.Presentation.Converters"
|
||
|
|
mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="800"
|
||
|
|
x:Class="AuroraDesk.Presentation.Views.Pages.UdpServerPageView"
|
||
|
|
x:DataType="vm:UdpServerPageViewModel">
|
||
|
|
|
||
|
|
<reactive:ReactiveUserControl.Resources>
|
||
|
|
<converters:InvertedBoolConverter x:Key="InvertedBoolConverter"/>
|
||
|
|
</reactive:ReactiveUserControl.Resources>
|
||
|
|
|
||
|
|
<Design.DataContext>
|
||
|
|
<vm:UdpServerPageViewModel />
|
||
|
|
</Design.DataContext>
|
||
|
|
|
||
|
|
<Grid Margin="16">
|
||
|
|
<Grid.RowDefinitions>
|
||
|
|
<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="{Binding IsListening, Converter={StaticResource InvertedBoolConverter}}">
|
||
|
|
<Border.Background>
|
||
|
|
<SolidColorBrush Color="#E74C3C"/>
|
||
|
|
</Border.Background>
|
||
|
|
<Border Background="{Binding IsListening}">
|
||
|
|
<Border.Background>
|
||
|
|
<SolidColorBrush Color="#27AE60"/>
|
||
|
|
</Border.Background>
|
||
|
|
<Border CornerRadius="12"
|
||
|
|
Margin="0,0,8,0"
|
||
|
|
Padding="20">
|
||
|
|
<StackPanel>
|
||
|
|
<heroicons:HeroIcon Type="Server"
|
||
|
|
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"
|
||
|
|
Margin="0,0,0,6"/>
|
||
|
|
<Border Background="White"
|
||
|
|
CornerRadius="12"
|
||
|
|
Padding="6,3"
|
||
|
|
HorizontalAlignment="Center"
|
||
|
|
IsVisible="{Binding IsListening}">
|
||
|
|
<TextBlock Text="运行中"
|
||
|
|
FontSize="10"
|
||
|
|
FontWeight="Bold"
|
||
|
|
Foreground="#27AE60"/>
|
||
|
|
</Border>
|
||
|
|
<Border Background="White"
|
||
|
|
CornerRadius="12"
|
||
|
|
Padding="6,3"
|
||
|
|
HorizontalAlignment="Center"
|
||
|
|
IsVisible="{Binding IsListening, Converter={StaticResource InvertedBoolConverter}}">
|
||
|
|
<TextBlock Text="已停止"
|
||
|
|
FontSize="10"
|
||
|
|
FontWeight="Bold"
|
||
|
|
Foreground="#E74C3C"/>
|
||
|
|
</Border>
|
||
|
|
</StackPanel>
|
||
|
|
</Border>
|
||
|
|
</Border>
|
||
|
|
</Border>
|
||
|
|
|
||
|
|
<!-- 客户端数 -->
|
||
|
|
<Border Grid.Column="1"
|
||
|
|
Background="#3498DB"
|
||
|
|
CornerRadius="12"
|
||
|
|
Margin="4,0,4,0"
|
||
|
|
Padding="20">
|
||
|
|
<StackPanel>
|
||
|
|
<heroicons:HeroIcon Type="UserGroup"
|
||
|
|
Width="28" Height="28"
|
||
|
|
Foreground="White"
|
||
|
|
HorizontalAlignment="Center"
|
||
|
|
Margin="0,0,0,8"/>
|
||
|
|
<TextBlock Text="{Binding Clients.Count}"
|
||
|
|
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="#F39C12"
|
||
|
|
CornerRadius="12"
|
||
|
|
Margin="8,0,0,0"
|
||
|
|
Padding="20">
|
||
|
|
<StackPanel>
|
||
|
|
<heroicons:HeroIcon Type="Envelope"
|
||
|
|
Width="28" Height="28"
|
||
|
|
Foreground="White"
|
||
|
|
HorizontalAlignment="Center"
|
||
|
|
Margin="0,0,0,8"/>
|
||
|
|
<TextBlock Text="{Binding ReceivedMessages.Count}"
|
||
|
|
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>
|
||
|
|
</Grid>
|
||
|
|
|
||
|
|
<!-- 主要内容 -->
|
||
|
|
<Grid Grid.Row="1">
|
||
|
|
<Grid.RowDefinitions>
|
||
|
|
<RowDefinition Height="Auto"/>
|
||
|
|
<RowDefinition Height="*"/>
|
||
|
|
</Grid.RowDefinitions>
|
||
|
|
|
||
|
|
<!-- 第一行:服务器配置 -->
|
||
|
|
<Border Grid.Row="0"
|
||
|
|
Background="White"
|
||
|
|
BorderBrush="#E5E7EB"
|
||
|
|
BorderThickness="1"
|
||
|
|
CornerRadius="10"
|
||
|
|
Padding="0"
|
||
|
|
Margin="0,0,0,12"
|
||
|
|
HorizontalAlignment="Stretch">
|
||
|
|
<Expander Header="服务器控制"
|
||
|
|
IsExpanded="True"
|
||
|
|
HorizontalAlignment="Stretch"
|
||
|
|
HorizontalContentAlignment="Stretch">
|
||
|
|
<Expander.HeaderTemplate>
|
||
|
|
<DataTemplate>
|
||
|
|
<Grid HorizontalAlignment="Stretch">
|
||
|
|
<StackPanel Orientation="Horizontal" Spacing="8" Margin="16,12">
|
||
|
|
<heroicons:HeroIcon Type="Cog6Tooth"
|
||
|
|
Width="18" Height="18"
|
||
|
|
Foreground="#1F2937"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
<TextBlock Text="服务器控制"
|
||
|
|
FontSize="14"
|
||
|
|
FontWeight="SemiBold"
|
||
|
|
Foreground="#1F2937"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
</StackPanel>
|
||
|
|
</Grid>
|
||
|
|
</DataTemplate>
|
||
|
|
</Expander.HeaderTemplate>
|
||
|
|
<StackPanel Spacing="10" Margin="16,0,16,16">
|
||
|
|
<!-- 配置行 -->
|
||
|
|
<Grid ColumnDefinitions="Auto,200,Auto,*" ColumnSpacing="12">
|
||
|
|
<TextBlock Grid.Column="0"
|
||
|
|
Text="监听端口"
|
||
|
|
FontSize="12"
|
||
|
|
Foreground="#6B7280"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
<NumericUpDown Grid.Column="1"
|
||
|
|
Value="{Binding ListenPort}"
|
||
|
|
Minimum="1" Maximum="65535"
|
||
|
|
FontSize="12"
|
||
|
|
Padding="8,6"
|
||
|
|
CornerRadius="6"
|
||
|
|
BorderBrush="#D1D5DB"
|
||
|
|
Background="#FAFAFA"
|
||
|
|
IsEnabled="{Binding IsListening, Converter={StaticResource InvertedBoolConverter}}"/>
|
||
|
|
|
||
|
|
<!-- 按钮 -->
|
||
|
|
<StackPanel Grid.Column="3"
|
||
|
|
Orientation="Horizontal"
|
||
|
|
HorizontalAlignment="Right"
|
||
|
|
Spacing="8">
|
||
|
|
<Button Command="{Binding StartListeningCommand}"
|
||
|
|
Background="#27AE60"
|
||
|
|
Foreground="White"
|
||
|
|
BorderThickness="0"
|
||
|
|
CornerRadius="8"
|
||
|
|
Padding="20,9"
|
||
|
|
FontSize="13"
|
||
|
|
FontWeight="SemiBold"
|
||
|
|
Cursor="Hand"
|
||
|
|
IsEnabled="{Binding IsListening, Converter={StaticResource InvertedBoolConverter}}">
|
||
|
|
<Button.Content>
|
||
|
|
<StackPanel Orientation="Horizontal"
|
||
|
|
HorizontalAlignment="Center"
|
||
|
|
Spacing="6">
|
||
|
|
<heroicons:HeroIcon Type="PlayCircle"
|
||
|
|
Width="16" Height="16"
|
||
|
|
Foreground="White"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
<TextBlock Text="启动"
|
||
|
|
FontSize="13"
|
||
|
|
FontWeight="SemiBold"
|
||
|
|
Foreground="White"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
</StackPanel>
|
||
|
|
</Button.Content>
|
||
|
|
<Button.Styles>
|
||
|
|
<Style Selector="Button:pointerover">
|
||
|
|
<Setter Property="Background" Value="#229954"/>
|
||
|
|
</Style>
|
||
|
|
<Style Selector="Button:disabled">
|
||
|
|
<Setter Property="Background" Value="#E5E7EB"/>
|
||
|
|
<Setter Property="Foreground" Value="#9CA3AF"/>
|
||
|
|
</Style>
|
||
|
|
</Button.Styles>
|
||
|
|
</Button>
|
||
|
|
|
||
|
|
<Button Command="{Binding StopListeningCommand}"
|
||
|
|
Background="#E74C3C"
|
||
|
|
Foreground="White"
|
||
|
|
BorderThickness="0"
|
||
|
|
CornerRadius="8"
|
||
|
|
Padding="20,9"
|
||
|
|
FontSize="13"
|
||
|
|
FontWeight="SemiBold"
|
||
|
|
Cursor="Hand"
|
||
|
|
IsEnabled="{Binding IsListening}">
|
||
|
|
<Button.Content>
|
||
|
|
<StackPanel Orientation="Horizontal"
|
||
|
|
HorizontalAlignment="Center"
|
||
|
|
Spacing="6">
|
||
|
|
<heroicons:HeroIcon Type="StopCircle"
|
||
|
|
Width="16" Height="16"
|
||
|
|
Foreground="White"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
<TextBlock Text="停止"
|
||
|
|
FontSize="13"
|
||
|
|
FontWeight="SemiBold"
|
||
|
|
Foreground="White"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
</StackPanel>
|
||
|
|
</Button.Content>
|
||
|
|
<Button.Styles>
|
||
|
|
<Style Selector="Button:pointerover">
|
||
|
|
<Setter Property="Background" Value="#C0392B"/>
|
||
|
|
</Style>
|
||
|
|
<Style Selector="Button:disabled">
|
||
|
|
<Setter Property="Background" Value="#E5E7EB"/>
|
||
|
|
<Setter Property="Foreground" Value="#9CA3AF"/>
|
||
|
|
</Style>
|
||
|
|
</Button.Styles>
|
||
|
|
</Button>
|
||
|
|
</StackPanel>
|
||
|
|
</Grid>
|
||
|
|
</StackPanel>
|
||
|
|
</Expander>
|
||
|
|
</Border>
|
||
|
|
|
||
|
|
<!-- 第二行:左右分栏 -->
|
||
|
|
<Grid Grid.Row="1">
|
||
|
|
<Grid.ColumnDefinitions>
|
||
|
|
<ColumnDefinition Width="*"/>
|
||
|
|
<ColumnDefinition Width="2*"/>
|
||
|
|
</Grid.ColumnDefinitions>
|
||
|
|
|
||
|
|
<!-- 左边:客户端列表(支持折叠) -->
|
||
|
|
<Border Grid.Column="0"
|
||
|
|
Background="White"
|
||
|
|
BorderBrush="#E5E7EB"
|
||
|
|
BorderThickness="1"
|
||
|
|
CornerRadius="10"
|
||
|
|
Padding="0"
|
||
|
|
Margin="0,0,12,0"
|
||
|
|
HorizontalAlignment="Stretch"
|
||
|
|
VerticalAlignment="Stretch">
|
||
|
|
<Grid RowDefinitions="Auto,*"
|
||
|
|
VerticalAlignment="Stretch">
|
||
|
|
<Border Grid.Row="0"
|
||
|
|
Background="#F9FAFB"
|
||
|
|
BorderBrush="#E5E7EB"
|
||
|
|
BorderThickness="0,0,0,1"
|
||
|
|
CornerRadius="10,10,0,0"
|
||
|
|
Padding="0,12">
|
||
|
|
<Grid HorizontalAlignment="Stretch" ColumnDefinitions="Auto,*,Auto">
|
||
|
|
<!-- 左侧折叠按钮 -->
|
||
|
|
<Button Name="ToggleButton"
|
||
|
|
Grid.Column="0"
|
||
|
|
Background="Transparent"
|
||
|
|
Foreground="#6B7280"
|
||
|
|
BorderThickness="0"
|
||
|
|
Padding="16,0,12,0"
|
||
|
|
Cursor="Hand"
|
||
|
|
Width="40"
|
||
|
|
HorizontalAlignment="Left"
|
||
|
|
VerticalAlignment="Center">
|
||
|
|
<Button.Content>
|
||
|
|
<heroicons:HeroIcon Name="ToggleIcon"
|
||
|
|
Type="ChevronDown"
|
||
|
|
Width="16" Height="16"
|
||
|
|
Foreground="#6B7280"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
</Button.Content>
|
||
|
|
<Button.Styles>
|
||
|
|
<Style Selector="Button:pointerover">
|
||
|
|
<Setter Property="Background" Value="#F3F4F6"/>
|
||
|
|
</Style>
|
||
|
|
</Button.Styles>
|
||
|
|
</Button>
|
||
|
|
|
||
|
|
<!-- 中间内容 -->
|
||
|
|
<StackPanel Grid.Column="1"
|
||
|
|
Orientation="Horizontal"
|
||
|
|
Spacing="8"
|
||
|
|
VerticalAlignment="Center">
|
||
|
|
<heroicons:HeroIcon Type="UserGroup"
|
||
|
|
Width="18" Height="18"
|
||
|
|
Foreground="#1F2937"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
<TextBlock Text="客户端列表"
|
||
|
|
FontSize="14"
|
||
|
|
FontWeight="SemiBold"
|
||
|
|
Foreground="#1F2937"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
<Border Background="#3498DB"
|
||
|
|
CornerRadius="8"
|
||
|
|
Padding="4,2"
|
||
|
|
VerticalAlignment="Center">
|
||
|
|
<TextBlock Text="{Binding Clients.Count}"
|
||
|
|
FontSize="10"
|
||
|
|
FontWeight="Bold"
|
||
|
|
Foreground="White"/>
|
||
|
|
</Border>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<!-- 右侧清空按钮 -->
|
||
|
|
<Button Grid.Column="2"
|
||
|
|
Command="{Binding ClearClientsCommand}"
|
||
|
|
HorizontalAlignment="Right"
|
||
|
|
Background="Transparent"
|
||
|
|
Foreground="#6B7280"
|
||
|
|
BorderThickness="0"
|
||
|
|
CornerRadius="6"
|
||
|
|
Padding="8,4"
|
||
|
|
Margin="0,0,16,0"
|
||
|
|
FontSize="12"
|
||
|
|
Cursor="Hand">
|
||
|
|
<Button.Content>
|
||
|
|
<StackPanel Orientation="Horizontal" Spacing="4">
|
||
|
|
<heroicons:HeroIcon Type="Trash"
|
||
|
|
Width="14" Height="14"
|
||
|
|
Foreground="#6B7280"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
<TextBlock Text="清空"
|
||
|
|
FontSize="12"
|
||
|
|
Foreground="#6B7280"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
</StackPanel>
|
||
|
|
</Button.Content>
|
||
|
|
<Button.Styles>
|
||
|
|
<Style Selector="Button:pointerover">
|
||
|
|
<Setter Property="Background" Value="#F3F4F6"/>
|
||
|
|
<Setter Property="Foreground" Value="#1F2937"/>
|
||
|
|
</Style>
|
||
|
|
</Button.Styles>
|
||
|
|
</Button>
|
||
|
|
</Grid>
|
||
|
|
</Border>
|
||
|
|
|
||
|
|
<Expander Name="ClientListExpander"
|
||
|
|
Grid.Row="1"
|
||
|
|
IsExpanded="True"
|
||
|
|
HorizontalAlignment="Stretch"
|
||
|
|
HorizontalContentAlignment="Stretch"
|
||
|
|
VerticalAlignment="Stretch"
|
||
|
|
Padding="0">
|
||
|
|
<Expander.HeaderTemplate>
|
||
|
|
<DataTemplate>
|
||
|
|
<Border Height="0"/>
|
||
|
|
</DataTemplate>
|
||
|
|
</Expander.HeaderTemplate>
|
||
|
|
<Expander.Styles>
|
||
|
|
<Style Selector="Expander /template/ ToggleButton">
|
||
|
|
<Setter Property="IsVisible" Value="False"/>
|
||
|
|
</Style>
|
||
|
|
</Expander.Styles>
|
||
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto"
|
||
|
|
Margin="16"
|
||
|
|
VerticalAlignment="Stretch">
|
||
|
|
<ItemsControl ItemsSource="{Binding Clients}">
|
||
|
|
<ItemsControl.ItemTemplate>
|
||
|
|
<DataTemplate>
|
||
|
|
<Border Background="#FAFAFA"
|
||
|
|
Padding="14,10"
|
||
|
|
Margin="0,0,0,1"
|
||
|
|
BorderBrush="#E5E7EB"
|
||
|
|
BorderThickness="0,0,0,1">
|
||
|
|
<StackPanel Spacing="6">
|
||
|
|
<StackPanel Orientation="Horizontal" Spacing="6">
|
||
|
|
<heroicons:HeroIcon Type="ComputerDesktop"
|
||
|
|
Width="14" Height="14"
|
||
|
|
Foreground="#1F2937"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
<TextBlock Text="{Binding DisplayName}"
|
||
|
|
FontWeight="SemiBold"
|
||
|
|
FontSize="13"
|
||
|
|
Foreground="#1F2937"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
</StackPanel>
|
||
|
|
<Grid ColumnDefinitions="Auto,*,Auto" ColumnSpacing="8">
|
||
|
|
<StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="4">
|
||
|
|
<TextBlock Text="消息:"
|
||
|
|
FontSize="11"
|
||
|
|
Foreground="#6B7280"/>
|
||
|
|
<TextBlock Text="{Binding MessageCount}"
|
||
|
|
FontSize="11"
|
||
|
|
FontWeight="SemiBold"
|
||
|
|
Foreground="#3498DB"/>
|
||
|
|
</StackPanel>
|
||
|
|
<StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="4">
|
||
|
|
<TextBlock Text="首次:"
|
||
|
|
FontSize="10"
|
||
|
|
Foreground="#6B7280"/>
|
||
|
|
<TextBlock Text="{Binding FirstSeen, StringFormat='{}{0:HH:mm:ss}'}"
|
||
|
|
FontSize="10"
|
||
|
|
Foreground="#6B7280"/>
|
||
|
|
</StackPanel>
|
||
|
|
</Grid>
|
||
|
|
<TextBlock FontSize="10" Foreground="#6B7280">
|
||
|
|
<TextBlock.Text>
|
||
|
|
<MultiBinding StringFormat="最后活动: {0:HH:mm:ss}">
|
||
|
|
<Binding Path="LastSeen"/>
|
||
|
|
</MultiBinding>
|
||
|
|
</TextBlock.Text>
|
||
|
|
</TextBlock>
|
||
|
|
</StackPanel>
|
||
|
|
</Border>
|
||
|
|
</DataTemplate>
|
||
|
|
</ItemsControl.ItemTemplate>
|
||
|
|
</ItemsControl>
|
||
|
|
</ScrollViewer>
|
||
|
|
</Expander>
|
||
|
|
</Grid>
|
||
|
|
</Border>
|
||
|
|
|
||
|
|
<!-- 右边:接收消息(占2/3) -->
|
||
|
|
<Border Grid.Column="1"
|
||
|
|
Background="White"
|
||
|
|
BorderBrush="#E5E7EB"
|
||
|
|
BorderThickness="1"
|
||
|
|
CornerRadius="10"
|
||
|
|
Padding="0"
|
||
|
|
HorizontalAlignment="Stretch"
|
||
|
|
VerticalAlignment="Stretch">
|
||
|
|
<Grid RowDefinitions="Auto,*"
|
||
|
|
VerticalAlignment="Stretch">
|
||
|
|
<Border Grid.Row="0"
|
||
|
|
Background="#F9FAFB"
|
||
|
|
BorderBrush="#E5E7EB"
|
||
|
|
BorderThickness="0,0,0,1"
|
||
|
|
CornerRadius="10,10,0,0"
|
||
|
|
Padding="16,12">
|
||
|
|
<Grid>
|
||
|
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||
|
|
<heroicons:HeroIcon Type="Envelope"
|
||
|
|
Width="18" Height="18"
|
||
|
|
Foreground="#1F2937"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
<TextBlock Text="接收消息"
|
||
|
|
FontSize="14"
|
||
|
|
FontWeight="SemiBold"
|
||
|
|
Foreground="#1F2937"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
<Border Background="#F39C12"
|
||
|
|
CornerRadius="8"
|
||
|
|
Padding="4,2"
|
||
|
|
VerticalAlignment="Center">
|
||
|
|
<TextBlock Text="{Binding ReceivedMessages.Count}"
|
||
|
|
FontSize="10"
|
||
|
|
FontWeight="Bold"
|
||
|
|
Foreground="White"/>
|
||
|
|
</Border>
|
||
|
|
</StackPanel>
|
||
|
|
<Button Command="{Binding ClearMessagesCommand}"
|
||
|
|
HorizontalAlignment="Right"
|
||
|
|
Background="Transparent"
|
||
|
|
Foreground="#6B7280"
|
||
|
|
BorderThickness="0"
|
||
|
|
CornerRadius="6"
|
||
|
|
Padding="8,4"
|
||
|
|
FontSize="12"
|
||
|
|
Cursor="Hand">
|
||
|
|
<Button.Content>
|
||
|
|
<StackPanel Orientation="Horizontal" Spacing="4">
|
||
|
|
<heroicons:HeroIcon Type="Trash"
|
||
|
|
Width="14" Height="14"
|
||
|
|
Foreground="#6B7280"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
<TextBlock Text="清空"
|
||
|
|
FontSize="12"
|
||
|
|
Foreground="#6B7280"
|
||
|
|
VerticalAlignment="Center"/>
|
||
|
|
</StackPanel>
|
||
|
|
</Button.Content>
|
||
|
|
<Button.Styles>
|
||
|
|
<Style Selector="Button:pointerover">
|
||
|
|
<Setter Property="Background" Value="#F3F4F6"/>
|
||
|
|
<Setter Property="Foreground" Value="#1F2937"/>
|
||
|
|
</Style>
|
||
|
|
</Button.Styles>
|
||
|
|
</Button>
|
||
|
|
</Grid>
|
||
|
|
</Border>
|
||
|
|
|
||
|
|
<ScrollViewer Grid.Row="1"
|
||
|
|
VerticalScrollBarVisibility="Auto"
|
||
|
|
VerticalAlignment="Stretch">
|
||
|
|
<ItemsControl ItemsSource="{Binding ReceivedMessages}">
|
||
|
|
<ItemsControl.ItemTemplate>
|
||
|
|
<DataTemplate>
|
||
|
|
<Border Background="#F0FDF4"
|
||
|
|
Padding="14,10"
|
||
|
|
Margin="0,0,0,1"
|
||
|
|
BorderBrush="#D1FAE5"
|
||
|
|
BorderThickness="0,0,0,1">
|
||
|
|
<TextBlock Text="{Binding}"
|
||
|
|
TextWrapping="Wrap"
|
||
|
|
FontSize="12"
|
||
|
|
Foreground="#1F2937"
|
||
|
|
LineHeight="18"/>
|
||
|
|
</Border>
|
||
|
|
</DataTemplate>
|
||
|
|
</ItemsControl.ItemTemplate>
|
||
|
|
</ItemsControl>
|
||
|
|
</ScrollViewer>
|
||
|
|
</Grid>
|
||
|
|
</Border>
|
||
|
|
</Grid>
|
||
|
|
</Grid>
|
||
|
|
</Grid>
|
||
|
|
</reactive:ReactiveUserControl>
|