Repository navigation
Expand file tree
/
Copy pathNotificationWindow.xaml
More file actions
142 lines (141 loc) · 7.86 KB
/
Copy pathNotificationWindow.xaml
File metadata and controls
142 lines (141 loc) · 7.86 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
<mah:MetroWindow x:Class="NETworkManager.NotificationWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:icons="clr-namespace:NETworkManager.Controls;assembly=NETworkManager.Controls"
xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization"
xmlns:networkManager="clr-namespace:NETworkManager"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance networkManager:NotificationWindow}"
Style="{DynamicResource DefaultWindow}"
Topmost="True"
ShowInTaskbar="False"
Width="360"
MinHeight="80"
SizeToContent="Height"
ResizeMode="NoResize"
IsWindowDraggable="False"
ShowTitleBar="False"
ShowMinButton="False"
ShowMaxRestoreButton="False"
ShowCloseButton="False"
Closing="MetroWindow_Closing">
<!-- Clicking anywhere on the popup (except the close button) opens the main window.
Background="Transparent" makes the empty areas hit-test visible. -->
<Grid x:Name="Root" Background="Transparent" Cursor="Hand"
ToolTip="{x:Static localization:Strings.Show}"
MouseLeftButtonUp="Root_MouseLeftButtonUp">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="3" />
</Grid.RowDefinitions>
<!-- Main content -->
<Grid Grid.Row="0" Margin="10" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="10" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Header: the tool that sent the notification (icon and name, like the application list) + time -->
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="6" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0"
Width="16" Height="16"
Fill="{DynamicResource MahApps.Brushes.Gray3}"
OpacityMask="{Binding ApplicationIconBrush}"
VerticalAlignment="Center" />
<TextBlock Grid.Column="2"
Text="{Binding ApplicationTitle}"
Style="{StaticResource DefaultTextBlock}"
Foreground="{DynamicResource MahApps.Brushes.Gray3}"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center" />
<TextBlock Grid.Column="3"
Text="{Binding Time}"
Margin="10,0,0,0"
VerticalAlignment="Center"
Style="{StaticResource DefaultTextBlock}"
Foreground="{DynamicResource MahApps.Brushes.Gray5}" />
<!-- Close [×] — gray, Gray5 on hover, NOT red -->
<Button Grid.Column="5"
Command="{Binding CloseCommand}"
ToolTip="{x:Static localization:Strings.Close}"
Style="{StaticResource CleanButton}"
VerticalAlignment="Top"
Margin="0,0,0,0">
<Rectangle Width="16" Height="16">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Fill" Visual="{icons:Lucide Kind=X}" />
</Rectangle.OpacityMask>
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="Fill" Value="{DynamicResource MahApps.Brushes.Gray3}" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
<Setter Property="Fill" Value="{DynamicResource MahApps.Brushes.Gray5}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
</Button>
</Grid>
<!-- Content: status icon (see NotificationWindow.GetStatusIcon) + title (the target) + one line per change
("10.0.0.5 (server) · New", the status in its color) -->
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0"
Width="32" Height="32"
VerticalAlignment="Top"
Fill="{Binding IconBrush}">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Uniform">
<VisualBrush.Visual>
<icons:LucideIcon Kind="{Binding IconKind}" />
</VisualBrush.Visual>
</VisualBrush>
</Rectangle.OpacityMask>
</Rectangle>
<StackPanel Grid.Column="2" VerticalAlignment="Top">
<TextBlock Text="{Binding NotificationTitle}"
Style="{StaticResource DefaultTextBlock}"
TextTrimming="CharacterEllipsis" />
<ItemsControl ItemsSource="{Binding Lines}"
Margin="0,5,0,0"
Focusable="False">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type networkManager:NotificationLineItem}">
<TextBlock Style="{StaticResource DefaultTextBlock}"
Foreground="{DynamicResource MahApps.Brushes.Gray5}"
TextWrapping="Wrap">
<Run Text="{Binding Prefix, Mode=OneWay}" /><Run Text="{Binding Status, Mode=OneWay}"
Foreground="{Binding StatusBrush, Mode=OneWay}" />
</TextBlock>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Grid>
</Grid>
<!-- Countdown (style of the progress bars, see ProgressBarStyles) -->
<mah:MetroProgressBar Grid.Row="1"
Minimum="0"
Maximum="{Binding TimeMax, Mode=OneWay}"
Value="{Binding TimeRemaining, Mode=OneWay}"
BorderThickness="0"
Padding="0" />
</Grid>
</mah:MetroWindow>