Repository navigation
Expand file tree
/
Copy pathNotificationWindow.xaml
More file actions
158 lines (155 loc) · 7.66 KB
/
Copy pathNotificationWindow.xaml
File metadata and controls
158 lines (155 loc) · 7.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<Window x:Class="HttpPing.NotificationWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="HttpPing"
UseLayoutRounding="True"
Height="95"
MinWidth="500"
SizeToContent="Width"
ResizeMode="NoResize"
WindowStyle="None"
ShowInTaskbar="False"
Background="#282829"
BorderBrush="#636363"
BorderThickness="1"
Topmost="True"
ShowActivated="False"
AllowsTransparency="True"
MouseLeftButtonUp="Window_MouseLeftButtonUp"
SizeChanged="Window_SizeChanged"
RenderTransformOrigin="1,1">
<Window.RenderTransform>
<ScaleTransform x:Name="scaleTransform" ScaleX="1" ScaleY="1"/>
</Window.RenderTransform>
<Window.Triggers>
<EventTrigger RoutedEvent="Window.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Duration="00:00:00.3" Storyboard.TargetProperty="Opacity" From="0" To="0.99" />
<DoubleAnimation Duration="00:00:00.2" Storyboard.TargetName="scaleTransform" Storyboard.TargetProperty="ScaleX" From="0" To="1" />
<DoubleAnimation Duration="00:00:00.2" Storyboard.TargetName="scaleTransform" Storyboard.TargetProperty="ScaleY" From="0" To="1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Window.Triggers>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Close button (top-right, shows on hover) -->
<Grid HorizontalAlignment="Right">
<Button Padding="6" Margin="0,1,3,0" Background="Transparent"
HorizontalAlignment="Right" IsTabStop="False"
ToolTip="关闭" Click="Close_Click">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Name="btnBorder" BorderThickness="1" BorderBrush="Transparent"
CornerRadius="4" Opacity="0.5" Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}">
<TextBlock Text="✕" FontSize="12" Foreground="White"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="btnBorder" Property="Background" Value="#000"/>
<Setter TargetName="btnBorder" Property="Opacity" Value="1"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="btnBorder" Property="BorderBrush" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
<Button.Style>
<Style TargetType="{x:Type Button}">
<Setter Property="Visibility" Value="Hidden"/>
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=IsMouseOver}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</Grid>
<!-- Status change list -->
<ListBox Name="StatusList"
Grid.Row="1"
Background="Transparent"
SelectionMode="Single"
BorderThickness="0"
IsTabStop="False"
MaxWidth="1200"
FocusVisualStyle="{x:Null}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
VerticalAlignment="Top"
MouseLeftButtonUp="Window_MouseLeftButtonUp">
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<ContentPresenter/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<DockPanel LastChildFill="True" HorizontalAlignment="Stretch">
<!-- Status glyph -->
<TextBlock DockPanel.Dock="Left"
Text="{Binding Glyph}"
FontSize="18"
VerticalAlignment="Center"
Padding="5,0,0,0">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding IsUp}" Value="True">
<Setter Property="Foreground" Value="#859900"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsUp}" Value="False">
<Setter Property="Foreground" Value="#dc322f"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<!-- Timestamp -->
<TextBlock DockPanel.Dock="Left"
Text="{Binding TimestampText}"
FontSize="15"
Foreground="White"
VerticalAlignment="Center"
Opacity="0.6"
Padding="6,0,0,0"/>
<!-- Hostname -->
<TextBlock DockPanel.Dock="Left"
Text="{Binding DisplayName}"
FontSize="17"
Foreground="White"
VerticalAlignment="Center"
Padding="9,0,0,0"/>
<!-- Arrow -->
<TextBlock DockPanel.Dock="Left"
Text="➡"
FontSize="17"
Foreground="White"
VerticalAlignment="Center"
Opacity="0.6"
Padding="5,0"/>
<!-- Status text -->
<TextBlock DockPanel.Dock="Left"
Text="{Binding StatusText}"
FontSize="17"
VerticalAlignment="Center"
Foreground="{Binding StatusColor}"/>
</DockPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Window>