forked from wokhan/WFN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.xaml
327 lines (327 loc) · 21.6 KB
/
App.xaml
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
<Application x:Class="Wokhan.WindowsFirewallNotifier.Console.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:BindingConverters="clr-namespace:Wokhan.WindowsFirewallNotifier.Console.Helpers.BindingConverters"
StartupUri="UI/Windows/MainWindow.xaml" Startup="Application_Startup">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Images.xaml" />
</ResourceDictionary.MergedDictionaries>
<BindingConverters:BooleanNegator x:Key="booleanNegator" />
<SolidColorBrush x:Key="AccentColorBrush" Color="Coral" />
<Style TargetType="DataGrid" BasedOn="{StaticResource {x:Type DataGrid}}">
<Setter Property="Background" Value="White" />
</Style>
<Style TargetType="CheckBox">
<Setter Property="Background" Value="White" />
</Style>
<Style TargetType="Button" x:Key="RoundedButton">
<Setter Property="Background" Value="White" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="FontSize" Value="12" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Padding" Value="5,2" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="0,0,5,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter Property="Background" Value="White" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="{DynamicResource AccentColorBrush}" />
</Trigger>
<Trigger Property="IsDefaulted" Value="true">
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" Value="{DynamicResource AccentColorBrush}" />
<Setter Property="RenderTransform">
<Setter.Value>
<TranslateTransform X="1" Y="1" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ToggleButton" x:Key="ToggleSwitch">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Background" Value="White"/>
<Setter Property="BorderThickness" Value="2" />
<Setter Property="BorderBrush" Value="{DynamicResource AccentColorBrush}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<StackPanel Margin="{TemplateBinding Padding}" Orientation="Horizontal" VerticalAlignment="Center">
<Border VerticalAlignment="Center" CornerRadius="10" Width="40" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<Grid>
<Ellipse Margin="2" Width="10" Height="10" Fill="{TemplateBinding Foreground}">
<Ellipse.Style>
<Style TargetType="Ellipse">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Opacity" Value="0.3" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked,RelativeSource={RelativeSource Mode=TemplatedParent}}" Value="True">
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Opacity" Value="1" />
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
</Grid>
</Border>
<ContentPresenter Margin="{TemplateBinding Padding}" />
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="BorderBrush" Value="LightGray" />
<Setter Property="Foreground" Value="Gray" />
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="RadioButton" x:Key="RadioButtonSlide">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Background" Value="White"/>
<Setter Property="BorderThickness" Value="2" />
<Setter Property="BorderBrush" Value="{DynamicResource AccentColorBrush}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Fill="{TemplateBinding BorderBrush}" HorizontalAlignment="Center" Width="5" />
<Border Grid.Column="0" Margin="{TemplateBinding Padding}" VerticalAlignment="Center" CornerRadius="10" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<Ellipse Margin="2" Width="10" Height="10" Fill="{TemplateBinding Foreground}">
<Ellipse.Style>
<Style TargetType="Ellipse">
<Setter Property="Visibility" Value="Hidden" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked,RelativeSource={RelativeSource Mode=TemplatedParent}}" Value="True">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
</Border>
<Grid Grid.Column="1" Margin="5,0">
<ContentPresenter Margin="{TemplateBinding Padding}" />
</Grid>
<!--</StackPanel>-->
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="InfoBlock" TargetType="Border">
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Margin" Value="30,5" />
<Setter Property="CornerRadius" Value="10" />
<Setter Property="BorderBrush" Value="LightGray" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.InfoBrushKey}}" />
<Setter Property="Padding" Value="10" />
<Setter Property="Width" Value="160" />
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked,ElementName=btnHelp}" Value="True">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
<Style.Resources>
<Style TargetType="TextBlock">
<Style.Setters>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InfoTextBrushKey}}" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="TextAlignment" Value="Justify" />
</Style.Setters>
</Style>
</Style.Resources>
</Style>
<Style x:Key="InfoPanel" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.InfoBrushKey}}" />
<Setter Property="BorderBrush" Value="LightGray" />
<Setter Property="BorderThickness" Value="0,0,0,1" />
<Style.Resources>
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="FontSize" Value="12" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Padding" Value="5,0,0,0" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Margin" Value="4" />
</Style>
<Style TargetType="Label" BasedOn="{StaticResource {x:Type Label}}">
<Setter Property="FontSize" Value="12" />
<Setter Property="Margin" Value="0,0,5,0" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</Style.Resources>
</Style>
<Style x:Key="MenuPanel" TargetType="Border">
<Setter Property="DockPanel.Dock" Value="Left" />
<Setter Property="BorderBrush" Value="LightGray" />
<Setter Property="BorderThickness" Value="0,0,1,0" />
<Setter Property="Background" Value="WhiteSmoke" />
<Style.Resources>
<Style TargetType="Button">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="FontSize" Value="24" />
<Setter Property="Padding" Value="4" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Padding="{TemplateBinding Padding}" TextElement.FontSize="{TemplateBinding FontSize}" Background="{TemplateBinding Background}">
<ContentPresenter />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="{DynamicResource AccentColorBrush}" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" Value="{DynamicResource AccentColorBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" Value="0.5" />
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="Label">
<Setter Property="Margin" Value="34,0,0,0" />
<Setter Property="FontSize" Value="12" />
</Style>
<Style TargetType="Border">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Padding" Value="4" />
<Setter Property="Height" Value="30" />
<Setter Property="Width" Value="30" />
<Setter Property="Background" Value="White" />
<Setter Property="CornerRadius" Value="30" />
</Style>
</Style.Resources>
</Style>
<Style x:Key="ToolBarPanel" TargetType="Border">
<Setter Property="Background" Value="LightGray" />
<Setter Property="DockPanel.Dock" Value="Top" />
<Setter Property="BorderBrush" Value="LightGray" />
<Setter Property="BorderThickness" Value="0,0,0,1" />
<Setter Property="Padding" Value="5" />
<Style.Resources>
<Style TargetType="Button" BasedOn="{StaticResource RoundedButton}">
</Style>
<Style TargetType="ToggleButton">
<Setter Property="Background" Value="White" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="FontSize" Value="12" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Padding" Value="5,2" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Margin" Value="0,0,5,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter Property="Background" Value="White" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="{DynamicResource AccentColorBrush}" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" Value="{DynamicResource AccentColorBrush}" />
<Setter Property="RenderTransform">
<Setter.Value>
<TranslateTransform X="1" Y="1" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsPressed" Value="false">
<Setter Property="Background" Value="White" />
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter Property="BorderBrush" Value="{DynamicResource AccentColorBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Background" Value="White" />
<Setter Property="FontSize" Value="12" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="0,0,5,0" />
<Setter Property="Padding" Value="4" />
</Style>
<Style TargetType="ComboBox" BasedOn="{StaticResource {x:Type ComboBox}}">
<Setter Property="Background" Value="WhiteSmoke" />
<Setter Property="BorderBrush" Value="WhiteSmoke" />
<Setter Property="FontSize" Value="12" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="0,0,5,0" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="{DynamicResource AccentColorBrush}" />
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="Label" BasedOn="{StaticResource {x:Type Label}}">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="0" />
</Style>
<Style TargetType="Path">
<Setter Property="Height" Value="16" />
<Setter Property="Stretch" Value="Uniform" />
<Setter Property="HorizontalAlignment" Value="Left" />
</Style>
</Style.Resources>
</Style>
<Style x:Key="NonAdminPanel" TargetType="Border" BasedOn="{StaticResource ToolBarPanel}">
<Setter Property="DockPanel.Dock" Value="Bottom" />
<Setter Property="Visibility" Value="Visible" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsElevated,Source={x:Static Application.Current}}" Value="True">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
<Style.Resources>
<Style TargetType="Label">
<Setter Property="Margin" Value="10,0" />
</Style>
</Style.Resources>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>