-
Notifications
You must be signed in to change notification settings - Fork 4
/
PipeExplorerMainWindow.xaml
171 lines (159 loc) · 9.74 KB
/
PipeExplorerMainWindow.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
<!-- Copyright (c) 2020 Vadim Zhukov <[email protected]>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -->
<metro:MetroWindow x:Class="PipeExplorer.PipeExplorerMainWindow"
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:metro="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:PipeExplorer"
xmlns:res="clr-namespace:PipeExplorer.Properties"
xmlns:vm="clr-namespace:PipeExplorer.ViewModels"
mc:Ignorable="d"
Title="Named Pipes Explorer" Height="450" Width="800"
ShowSystemMenu="True"
Icon="{Binding AppIcon}"
WindowButtonCommandsOverlayBehavior="Always"
>
<Window.DataContext>
<vm:PipeExplorerViewModel />
</Window.DataContext>
<metro:MetroWindow.LeftWindowCommands>
<metro:WindowCommands>
<Grid MinWidth="80">
<Button Command="{Binding StartCmd}"
Visibility="{Binding IsRunning, Converter={StaticResource InvertedBooleanToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"
Content="{x:Static res:Resources.StartButtonText}"
/>
<Button Command="{Binding StopCmd}"
Visibility="{Binding IsRunning, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"
Content="{x:Static res:Resources.StopButtonText}"
/>
</Grid>
</metro:WindowCommands>
</metro:MetroWindow.LeftWindowCommands>
<metro:MetroWindow.RightWindowCommands>
<metro:WindowCommands>
<TextBox Text="{Binding QuickFilter, UpdateSourceTrigger=PropertyChanged}"
metro:TextBoxHelper.Watermark="{x:Static res:Resources.QuickFilter}"
metro:TextBoxHelper.ClearTextButton="True"
metro:TextBoxHelper.SelectAllOnFocus="True"
MinWidth="160"
/>
<ToggleButton IsChecked="{Binding IsOpen, Source={x:Reference SettingsFlyout}}"
Content="{x:Static res:Resources.Settings}"
/>
</metro:WindowCommands>
</metro:MetroWindow.RightWindowCommands>
<metro:MetroWindow.Flyouts>
<metro:FlyoutsControl>
<metro:Flyout x:Name="SettingsFlyout"
Header="{x:Static res:Resources.Settings}"
Position="Right"
Width="400"
>
<StackPanel Margin="12">
<metro:ToggleSwitch IsOn="{Binding ReadAcls}"
Header="{x:Static res:Resources.SettingsReadAclsHeader}"
OnContent="{x:Static res:Resources.SettingsReadAclsOn}"
OffContent="{x:Static res:Resources.SettingsReadAclsOff}"
/>
<TextBlock Foreground="DarkOrange" Text="{x:Static res:Resources.SettingsReadAclsWarning}" TextWrapping="Wrap" Margin="0, 0, 0, 8" />
<metro:ToggleSwitch IsOn="{Binding StartImmediately}"
Header="{x:Static res:Resources.SettingsStartImmediatelyHeader}"
OnContent="{x:Static res:Resources.SettingsStartImmediatelyOn}"
OffContent="{x:Static res:Resources.SettingsStartImmediatelyOff}"
/>
<DockPanel Margin="0, 8">
<metro:NumericUpDown DockPanel.Dock="Right"
x:Name="RefereshIntervalBox"
Value="{Binding RefreshInterval}"
StringFormat="{x:Static res:Resources.SettingsRefreshIntervalStringFormat}"
Minimum="1" Maximum="99999"
ParsingNumberStyle="AllowThousands"
InterceptArrowKeys="True"
ButtonsAlignment="Opposite"
SwitchUpDownButtons="True"
MinWidth="100"
/>
<Label Target="{x:Reference RefereshIntervalBox}"
FontSize="14"
Content="{x:Static res:Resources.SettingsRefreshInterval}"
/>
</DockPanel>
<DockPanel Margin="0, 8">
<metro:NumericUpDown DockPanel.Dock="Right"
x:Name="HighlightDurationBox"
Value="{Binding HighlightDuration}"
StringFormat="{x:Static res:Resources.SettingsRefreshIntervalStringFormat}"
Minimum="0" Maximum="99999"
ParsingNumberStyle="AllowThousands"
InterceptArrowKeys="True"
ButtonsAlignment="Opposite"
SwitchUpDownButtons="True"
MinWidth="100"
/>
<Label Target="{x:Reference HighlightDurationBox}"
FontSize="14"
Content="{x:Static res:Resources.SettingsHighlightDuration}"
/>
</DockPanel>
</StackPanel>
</metro:Flyout>
</metro:FlyoutsControl>
</metro:MetroWindow.Flyouts>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<ListView Grid.Row="1" ItemsSource="{Binding Pipes}">
<ListView.View>
<GridView AllowsColumnReorder="True">
<GridViewColumn x:Name="ColumnPin" Width="24">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Pinned}">
<CheckBox.Template>
<ControlTemplate TargetType="CheckBox">
<Image Source="{Binding Pinned, Converter={StaticResource ChooseConverter}, ConverterParameter={StaticResource PinnedIcons}}" Margin="1" />
</ControlTemplate>
</CheckBox.Template>
</CheckBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn x:Name="ColumnName" DisplayMemberBinding="{Binding Name}" Header="{x:Static res:Resources.PipeListHeaderName}" />
<GridViewColumn x:Name="ColumnConnections" DisplayMemberBinding="{Binding Connections}" Header="{x:Static res:Resources.PipeListHeaderConnections}" />
<GridViewColumn x:Name="ColumnCreated" DisplayMemberBinding="{Binding Created}" Header="{x:Static res:Resources.PipeListHeaderCreated}" />
<GridViewColumn x:Name="ColumnHint" DisplayMemberBinding="{Binding Hint}" Header="{x:Static res:Resources.PipeListHeaderComment}" />
<GridViewColumn x:Name="ColumnAcl" DisplayMemberBinding="{Binding PlainAcl}" Header="{x:Static res:Resources.PipeListHeaderAcl}" />
</GridView>
</ListView.View>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Style.Triggers>
<DataTrigger Binding="{Binding BeingRemoved}" Value="True">
<Setter Property="Background" Value="Red" />
</DataTrigger>
<DataTrigger Binding="{Binding RecentlyUpdated}" Value="True">
<Setter Property="Background" Value="Yellow" />
</DataTrigger>
<DataTrigger Binding="{Binding RecentlyAdded}" Value="True">
<Setter Property="Background" Value="LightGreen" />
</DataTrigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
</ListView>
</Grid>
</metro:MetroWindow>