Files
notify/Notify/Views/ToastWindow.axaml
T
chuan f390bcd133 feat: 提示音、调用方图标与消息清洗(P2)
- 提示音:winmm 从内存异步播放打包 wav,可在设置开关,带防连环音
- 调用方图标:进程树上溯识别编辑器/终端,ExtractIconEx + GDI 转 Avalonia 位图显示
- 进程树跳过 shell/运行时,取不到图标回退默认 Claude 图标
- 消息清洗:折叠换行/多余空白为单行,避免撑乱 toast 布局
- 全程 LibraryImport/源生成,AOT 友好
2026-06-22 16:00:59 +08:00

60 lines
2.2 KiB
XML

<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:Notify.ViewModels"
x:Class="Notify.Views.ToastWindow"
x:DataType="vm:ToastViewModel"
Width="340"
Height="92"
CanResize="False"
ShowInTaskbar="False"
ShowActivated="False"
Topmost="True"
WindowDecorations="None"
Background="Transparent"
TransparencyLevelHint="Transparent">
<Border x:Name="Root"
Background="#FF2B2B2B"
CornerRadius="10"
BorderThickness="2"
BorderBrush="#FF4B64B2"
BoxShadow="0 6 24 0 #80000000"
Padding="14"
PointerEntered="OnPointerEntered"
PointerExited="OnPointerExited"
PointerPressed="OnBodyPressed">
<Grid ColumnDefinitions="Auto,*,Auto" VerticalAlignment="Center">
<Image Grid.Column="0"
x:Name="IconImage"
Width="44" Height="44"
VerticalAlignment="Center"
Source="/Assets/claude.ico" />
<StackPanel Grid.Column="1" Margin="12,0,8,0" VerticalAlignment="Center" Spacing="2">
<TextBlock Text="{Binding Title}"
FontWeight="Bold"
FontSize="14"
Foreground="#FFFFFFFF"
TextTrimming="CharacterEllipsis" />
<TextBlock Text="{Binding Message}"
FontSize="12"
Foreground="#FFCCCCCC"
TextWrapping="Wrap"
MaxLines="2"
TextTrimming="CharacterEllipsis" />
</StackPanel>
<Button Grid.Column="2"
Content="✕"
VerticalAlignment="Top"
Padding="6,2"
FontSize="12"
Foreground="#FF888888"
Background="Transparent"
BorderThickness="0"
Click="OnCloseClick" />
</Grid>
</Border>
</Window>