Repository navigation
Expand file tree
/
Copy pathPingHostView.xaml
More file actions
331 lines (329 loc) · 23.7 KB
/
Copy pathPingHostView.xaml
File metadata and controls
331 lines (329 loc) · 23.7 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<UserControl x:Class="NETworkManager.Views.PingHostView"
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:dragablz="clr-namespace:Dragablz;assembly=Dragablz"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:converters="clr-namespace:NETworkManager.Converters"
xmlns:dialog="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
xmlns:viewModels="clr-namespace:NETworkManager.ViewModels"
xmlns:localization="clr-namespace:NETworkManager.Resources.Localization"
xmlns:networkManager="clr-namespace:NETworkManager"
dialog:DialogParticipation.Register="{Binding}"
mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:PingHostViewModel}">
<UserControl.Resources>
<converters:BooleanToVisibilityCollapsedConverter x:Key="BooleanToVisibilityCollapsedConverter" />
<converters:NullOrEmptyToBoolConverter x:Key="NullOrEmptyToBoolConverter" />
</UserControl.Resources>
<UserControl.InputBindings>
<KeyBinding Key="T" Modifiers="Ctrl" Command="{Binding AddTabCommand}" />
</UserControl.InputBindings>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition MinWidth="{x:Static networkManager:GlobalStaticConfiguration.Profile_WidthCollapsed}" Width="{Binding ProfileWidth, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" MaxWidth="{x:Static networkManager:GlobalStaticConfiguration.Profile_MaxWidthExpanded}" />
</Grid.ColumnDefinitions>
<dragablz:TabablzControl Grid.Column="0" Grid.Row="0" ClosingItemCallback="{Binding CloseItemCommand}" ItemsSource="{Binding TabItems}" SelectedIndex="{Binding SelectedTabIndex}">
<dragablz:TabablzControl.InterTabController>
<dragablz:InterTabController InterTabClient="{Binding InterTabClient}" MoveWindowWithSolitaryTabs="False" x:Name="InterTabController" />
</dragablz:TabablzControl.InterTabController>
<dragablz:TabablzControl.HeaderSuffixContent>
<Grid HorizontalAlignment="Right" Width="40" Height="44">
<Button Style="{StaticResource CleanButton}" Command="{Binding AddTabCommand}" ToolTip="{x:Static localization:Strings.NewTab}" Focusable="False">
<Rectangle Width="20" Height="20">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Fill" Visual="{iconPacks:Material Kind=Plus}" />
</Rectangle.OpacityMask>
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="Fill" Value="{DynamicResource GrayBrush3}" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
<Setter Property="Fill" Value="{DynamicResource GrayBrush5}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
</Button>
</Grid>
</dragablz:TabablzControl.HeaderSuffixContent>
</dragablz:TabablzControl>
<Grid Grid.Column="0" Grid.Row="0" VerticalAlignment="Center">
<Grid.Style>
<Style TargetType="{x:Type Grid}">
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<DataTrigger Binding="{Binding TabItems.Count}" Value="0">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
<Button HorizontalAlignment="Center" Command="{Binding AddTabCommand}" Style="{StaticResource CleanButton}">
<Button.Content>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Rectangle Width="20" Height="20">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Fill" Visual="{iconPacks:Material Kind=Plus}" />
</Rectangle.OpacityMask>
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="Fill" Value="{DynamicResource GrayBrush3}" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
<Setter Property="Fill" Value="{DynamicResource GrayBrush5}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
<TextBlock Grid.Column="1" Text="{x:Static localization:Strings.AddATabToPerformAPing}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource MessageTextBlock}">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
<Setter Property="Foreground" Value="{DynamicResource GrayBrush5}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</Button.Content>
</Button>
</Grid>
<GridSplitter Grid.Column="1" Style="{StaticResource ProfileGridSplitter}" />
<Expander Grid.Column="2" Header="{x:Static localization:Strings.Profiles}" Style="{StaticResource RightExpander}" IsExpanded="{Binding ExpandProfileView}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="10" />
<RowDefinition Height="*" />
<RowDefinition Height="10" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBox x:Name="TextBoxSearch" Grid.Column="0" VerticalAlignment="Center" Text="{Binding Search, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource SearchTextBox}"/>
<ListBox Grid.Row="2" ItemsSource="{Binding Profiles}" DisplayMemberPath="Name" SelectedItem="{Binding SelectedProfile}" Style="{StaticResource ProfileListBox}">
<ListBox.Resources>
<ContextMenu x:Key="ListBoxItemContextMenu" Opened="ContextMenu_Opened" MinWidth="150">
<MenuItem Header="{x:Static localization:Strings.Ping}" Command="{Binding PingProfileCommand}">
<MenuItem.Icon>
<Rectangle Width="16" Height="16" Fill="{DynamicResource BlackColorBrush}">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Uniform" Visual="{iconPacks:Material Kind=Play}" />
</Rectangle.OpacityMask>
</Rectangle>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{x:Static localization:Strings.EditDots}" Command="{Binding EditProfileCommand}">
<MenuItem.Icon>
<Rectangle Width="16" Height="16" Fill="{DynamicResource BlackColorBrush}">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Uniform" Visual="{iconPacks:Modern Kind=Edit}" />
</Rectangle.OpacityMask>
</Rectangle>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{x:Static localization:Strings.CopyAsDots}" Command="{Binding CopyAsProfileCommand}">
<MenuItem.Icon>
<Rectangle Width="16" Height="16" Fill="{DynamicResource BlackColorBrush}">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Uniform" Visual="{iconPacks:Material Kind=ContentDuplicate}" />
</Rectangle.OpacityMask>
</Rectangle>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{x:Static localization:Strings.Delete}" Command="{Binding DeleteProfileCommand}">
<MenuItem.Icon>
<Rectangle Width="16" Height="16" Fill="{DynamicResource BlackColorBrush}">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Uniform" Visual="{iconPacks:Material Kind=Close}" />
</Rectangle.OpacityMask>
</Rectangle>
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</ListBox.Resources>
<ListBox.InputBindings>
<KeyBinding Command="{Binding EditProfileCommand}" Key="F2" />
<KeyBinding Command="{Binding DeleteProfileCommand}" Key="Delete" />
</ListBox.InputBindings>
<ListBox.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Expander IsExpanded="True" Style="{StaticResource DefaultExpander}">
<Expander.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding (CollectionViewGroup.Name)}" Style="{DynamicResource DefaultTextBlock}"/>
<Button Grid.Column="1" ToolTip="{x:Static localization:Strings.EditGroup}" Command="{Binding DataContext.EditGroupCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBox}}}" CommandParameter="{Binding (CollectionViewGroup.Name)}" Visibility="{Binding IsMouseOver, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" Style="{StaticResource CleanButton}">
<Rectangle Width="16" Height="16">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Uniform" Visual="{iconPacks:Modern Kind=Edit}" />
</Rectangle.OpacityMask>
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="Fill" Value="{DynamicResource GrayBrush3}" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
<Setter Property="Fill" Value="{DynamicResource GrayBrush5}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
</Button>
</Grid>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</ListBox.GroupStyle>
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource MetroListBoxItem}">
<Setter Property="ContextMenu" Value="{StaticResource ListBoxItemContextMenu}" />
<EventSetter Event="MouseDoubleClick" Handler="ListBoxItem_MouseDoubleClick" />
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
<Grid Grid.Row="2" VerticalAlignment="Center">
<Grid.Style>
<Style TargetType="{x:Type Grid}">
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<DataTrigger Binding="{Binding Profiles.Count}" Value="0">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
<Button HorizontalAlignment="Center" Focusable="False" Margin="0,0,0,10">
<Button.Style>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource CleanButton}">
<Setter Property="Command" Value="{Binding AddProfileCommand}" />
<Style.Triggers>
<DataTrigger Binding="{Binding Search, Converter={StaticResource NullOrEmptyToBoolConverter}}" Value="False">
<Setter Property="Command" Value="{Binding ClearSearchCommand}" />
<Setter Property="ToolTip" Value="{x:Static localization:Strings.ClearFilter}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Width="20" Height="20">
<Rectangle.Resources>
<VisualBrush x:Key="VisualPlus" Stretch="Uniform" Visual="{iconPacks:Material Kind=Plus}"/>
<VisualBrush x:Key="VisualClear" Stretch="Uniform" Visual="{iconPacks:Material Kind=FilterRemoveOutline}" />
</Rectangle.Resources>
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="OpacityMask" Value="{StaticResource VisualPlus}" />
<Setter Property="Fill" Value="{DynamicResource GrayBrush3}" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
<Setter Property="Fill" Value="{DynamicResource GrayBrush5}" />
</DataTrigger>
<DataTrigger Binding="{Binding Search, Converter={StaticResource NullOrEmptyToBoolConverter}}" Value="False">
<Setter Property="OpacityMask" Value="{StaticResource VisualClear}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
<TextBlock Grid.Column="1">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource MessageTextBlock}">
<Setter Property="Text" Value="{x:Static localization:Strings.NoProfilesFoundCreateOne}" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
<Setter Property="Foreground" Value="{DynamicResource GrayBrush5}" />
</DataTrigger>
<DataTrigger Binding="{Binding Search, Converter={StaticResource NullOrEmptyToBoolConverter}}" Value="False">
<Setter Property="Text" Value="{x:Static localization:Strings.NothingFound}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</Button>
</Grid>
<Border Grid.Column="0" Grid.Row="4" BorderBrush="{DynamicResource GrayBrush8}" Margin="-10" BorderThickness="0,1,0,0" Background="Transparent">
<Border.Style>
<Style TargetType="{x:Type Border}">
<Style.Triggers>
<DataTrigger Binding="{Binding Profiles.Count}" Value="0">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<Button Height="48" Margin="10,0" Focusable="False">
<Button.Style>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource CleanButton}">
<Setter Property="Command" Value="{Binding AddProfileCommand}" />
</Style>
</Button.Style>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Width="20" Height="20">
<Rectangle.Resources>
<VisualBrush x:Key="VisualPlus" Stretch="Uniform" Visual="{iconPacks:Material Kind=Plus}"/>
</Rectangle.Resources>
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="OpacityMask" Value="{StaticResource VisualPlus}" />
<Setter Property="Fill" Value="{DynamicResource GrayBrush3}" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
<Setter Property="Fill" Value="{DynamicResource GrayBrush5}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
<TextBlock Grid.Column="1" TextWrapping="NoWrap" TextTrimming="WordEllipsis">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource MessageTextBlock}">
<Setter Property="Text" Value="{x:Static localization:Strings.AddProfileDots}" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
<Setter Property="Foreground" Value="{DynamicResource GrayBrush5}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</Button>
</Border>
</Grid>
</Expander>
</Grid>
</UserControl>