Skip to content

Commit bdfa718

Browse files
committed
Some cleanup
1 parent bc9a06d commit bdfa718

File tree

7 files changed

+43
-91
lines changed

7 files changed

+43
-91
lines changed

Source/NETworkManager/ViewModels/Applications/LookupOUILookupViewModel.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ public List<string> MACAddressOrVendorHistory
6363
}
6464
}
6565

66-
private bool _isOUILookupRunning;
67-
public bool IsOUILookupRunning
66+
private bool _isLookupRunning;
67+
public bool IsLookupRunning
6868
{
69-
get { return _isOUILookupRunning; }
69+
get { return _isLookupRunning; }
7070
set
7171
{
72-
if (value == _isOUILookupRunning)
72+
if (value == _isLookupRunning)
7373
return;
7474

75-
_isOUILookupRunning = value;
75+
_isLookupRunning = value;
7676
OnPropertyChanged();
7777
}
7878
}
@@ -155,7 +155,7 @@ private bool OUILookup_CanExecute(object parameter)
155155

156156
private async void OUILookupAction()
157157
{
158-
IsOUILookupRunning = true;
158+
IsLookupRunning = true;
159159

160160
OUILookupResult.Clear();
161161

@@ -193,7 +193,7 @@ private async void OUILookupAction()
193193
NoVendorFound = false;
194194
}
195195

196-
IsOUILookupRunning = false;
196+
IsLookupRunning = false;
197197
}
198198

199199
public ICommand CopySelectedMACAddressCommand

Source/NETworkManager/ViewModels/Applications/LookupPortViewModel.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.ObjectModel;
33
using NETworkManager.Models.Settings;
44
using System.Collections.Generic;
5-
using NETworkManager.Models.Network;
65
using NETworkManager.Helpers;
76
using System.ComponentModel;
87
using System.Windows.Data;
@@ -60,16 +59,16 @@ public List<string> PortsHistory
6059
}
6160
}
6261

63-
private bool _isPortLookupRunning;
64-
public bool IsPortLookupRunning
62+
private bool _isLookupRunning;
63+
public bool IsLookupRunning
6564
{
66-
get { return _isPortLookupRunning; }
65+
get { return _isLookupRunning; }
6766
set
6867
{
69-
if (value == _isPortLookupRunning)
68+
if (value == _isLookupRunning)
7069
return;
7170

72-
_isPortLookupRunning = value;
71+
_isLookupRunning = value;
7372
OnPropertyChanged();
7473
}
7574
}
@@ -152,7 +151,7 @@ private bool PortLookup_CanExecute(object parameter)
152151

153152
private async void PortLookupAction()
154153
{
155-
IsPortLookupRunning = true;
154+
IsLookupRunning = true;
156155

157156
PortLookupResult.Clear();
158157

@@ -227,7 +226,7 @@ private async void PortLookupAction()
227226
NoPortsFound = false;
228227
}
229228

230-
IsPortLookupRunning = false;
229+
IsLookupRunning = false;
231230
}
232231

233232
public ICommand CopySelectedPortCommand

Source/NETworkManager/Views/ApplicationViewManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public static List<ApplicationViewInfo> List
2323
new ApplicationViewInfo(Name.WakeOnLAN, new PackIconMaterial() { Kind = PackIconMaterialKind.Power }),
2424
new ApplicationViewInfo(Name.HTTPHeaders, new PackIconModern() {Kind = PackIconModernKind.CodeXml }),
2525
new ApplicationViewInfo(Name.SubnetCalculator, new PackIconFontAwesome() { Kind = PackIconFontAwesomeKind.Calculator }),
26-
new ApplicationViewInfo(Name.ARPTable, new PackIconMaterial() { Kind = PackIconMaterialKind.Matrix}),
27-
new ApplicationViewInfo(Name.Lookup, new PackIconMaterial() { Kind = PackIconMaterialKind.Magnify })
26+
new ApplicationViewInfo(Name.Lookup, new PackIconMaterial() { Kind = PackIconMaterialKind.Magnify }),
27+
new ApplicationViewInfo(Name.ARPTable, new PackIconMaterial() { Kind = PackIconMaterialKind.Matrix})
2828
};
2929
}
3030
}
@@ -47,8 +47,8 @@ public enum Name
4747
WakeOnLAN,
4848
HTTPHeaders,
4949
SubnetCalculator,
50-
ARPTable,
51-
Lookup
50+
Lookup,
51+
ARPTable
5252
}
5353
}
5454
}

Source/NETworkManager/Views/Applications/HTTPHeadersView.xaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,7 @@
7777
</Style>
7878
</Rectangle.Style>
7979
</Rectangle>
80-
<TextBlock Grid.Column="1" Margin="10,5" TextAlignment="Center">
81-
<TextBlock.Style>
82-
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource DefaultTextBlock}">
83-
<Setter Property="Text" Value="{DynamicResource String_Button_Check}"/>
84-
</Style>
85-
</TextBlock.Style>
86-
</TextBlock>
80+
<TextBlock Grid.Column="1" Margin="10,5" TextAlignment="Center" Text="{DynamicResource String_Button_Check}" />
8781
</Grid>
8882
</Button.Content>
8983
</Button>

Source/NETworkManager/Views/Applications/LookupOUILookupView.xaml

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<ColumnDefinition Width="10" />
3636
<ColumnDefinition Width="Auto" />
3737
</Grid.ColumnDefinitions>
38-
<ComboBox Grid.Column="0" x:Name="txtMACAddressOrVendor" ItemsSource="{Binding MACAddressOrVendorHistory}" WpfHelper:ProtocolSettingsLayout.MVVMHasError="{Binding MACAddressOrVendorHasError}" mah:TextBoxHelper.Watermark="{DynamicResource String_Watermark_ExampleMACAddressesOrVendor}" IsEnabled="{Binding IsOUILookupRunning, Converter={StaticResource BooleanReverseConverter}}" Style="{StaticResource HistoryComboBox}">
38+
<ComboBox Grid.Column="0" x:Name="txtMACAddressOrVendor" ItemsSource="{Binding MACAddressOrVendorHistory}" WpfHelper:ProtocolSettingsLayout.MVVMHasError="{Binding MACAddressOrVendorHasError}" mah:TextBoxHelper.Watermark="{DynamicResource String_Watermark_ExampleMACAddressesOrVendor}" IsEnabled="{Binding IsLookupRunning, Converter={StaticResource BooleanReverseConverter}}" Style="{StaticResource HistoryComboBox}">
3939
<ComboBox.InputBindings>
4040
<KeyBinding Command="{Binding OUILookupCommand}" Key="Return" />
4141
</ComboBox.InputBindings>
@@ -55,6 +55,9 @@
5555
<DataTrigger Binding="{Binding Path=(Validation.HasError), ElementName=txtMACAddressOrVendor}" Value="True" >
5656
<Setter Property="IsEnabled" Value="False" />
5757
</DataTrigger>
58+
<DataTrigger Binding="{Binding IsLookupRunning}" Value="True">
59+
<Setter Property="IsEnabled" Value="False" />
60+
</DataTrigger>
5861
</Style.Triggers>
5962
</Style>
6063
</Button.Resources>
@@ -64,40 +67,17 @@
6467
<ColumnDefinition Width="Auto" />
6568
<ColumnDefinition Width="*" />
6669
</Grid.ColumnDefinitions>
67-
<Rectangle Width="20" Height="20" Margin="10,5,0,5">
68-
<Rectangle.Resources>
69-
<VisualBrush x:Key="VisualMagnify" Stretch="Uniform" Visual="{IconPacks:PackIconMaterial Kind=Magnify}" />
70-
<VisualBrush x:Key="VisualClose" Stretch="Uniform" Visual="{IconPacks:PackIconMaterial Kind=Close}" />
71-
</Rectangle.Resources>
72-
<Rectangle.Style>
73-
<Style TargetType="{x:Type Rectangle}">
74-
<Setter Property="OpacityMask" Value="{StaticResource VisualMagnify}" />
75-
<Setter Property="Fill" Value="{DynamicResource GrayBrush3}" />
76-
<Style.Triggers>
77-
<DataTrigger Binding="{Binding IsOUILookupRunning}" Value="True">
78-
<Setter Property="OpacityMask" Value="{StaticResource VisualClose}" />
79-
</DataTrigger>
80-
</Style.Triggers>
81-
</Style>
82-
</Rectangle.Style>
70+
<Rectangle Width="20" Height="20" Margin="10,5,0,5" Fill="{DynamicResource GrayBrush3}">
71+
<Rectangle.OpacityMask>
72+
<VisualBrush Stretch="Uniform" Visual="{IconPacks:PackIconMaterial Kind=Magnify}" />
73+
</Rectangle.OpacityMask>
8374
</Rectangle>
84-
<TextBlock Grid.Column="1" FontSize="14" Margin="10,5" TextAlignment="Center">
85-
<TextBlock.Style>
86-
<Style TargetType="{x:Type TextBlock}">
87-
<Setter Property="Text" Value="{DynamicResource String_Button_Lookup}"/>
88-
<Style.Triggers>
89-
<DataTrigger Binding="{Binding IsOUILookupRunning}" Value="True" >
90-
<Setter Property="Text" Value="{DynamicResource String_Button_Cancel}"/>
91-
</DataTrigger>
92-
</Style.Triggers>
93-
</Style>
94-
</TextBlock.Style>
95-
</TextBlock>
75+
<TextBlock Grid.Column="1" Margin="10,5" TextAlignment="Center" Text="{DynamicResource String_Button_Lookup}" />
9676
</Grid>
9777
</Button.Content>
9878
</Button>
9979
</Grid>
100-
<Controls:MetroProgressBar Grid.Row="1" Foreground="{DynamicResource AccentColorBrush}" IsIndeterminate="True" Visibility="{Binding IsOUILookupRunning, Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0,10,0,0" />
80+
<Controls:MetroProgressBar Grid.Row="1" Foreground="{DynamicResource AccentColorBrush}" IsIndeterminate="True" Visibility="{Binding IsLookupRunning, Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0,10,0,0" />
10181
<TextBlock Grid.Row="2" Foreground="{DynamicResource AccentColorBrush}" Text="{DynamicResource String_NoVendorFoundCheckYourInput}" Visibility="{Binding NoVendorFound, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{DynamicResource DefaultTextBlock}" Margin="0,10,0,0" />
10282
</Grid>
10383
<TextBlock Grid.Row="2" Text="{DynamicResource String_Header_Result}" Style="{StaticResource HeaderTextBlock}" />

Source/NETworkManager/Views/Applications/LookupPortLookupView.xaml

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<ColumnDefinition Width="10" />
3535
<ColumnDefinition Width="Auto" />
3636
</Grid.ColumnDefinitions>
37-
<ComboBox Grid.Column="0" x:Name="txtPortsOrService" ItemsSource="{Binding PortsHistory}" WpfHelper:ProtocolSettingsLayout.MVVMHasError="{Binding PortsOrServiceHasError}" mah:TextBoxHelper.Watermark="{DynamicResource String_Watermark_EamplePortPortRangeOrService}" IsEnabled="{Binding IsPortLookupRunning, Converter={StaticResource BooleanReverseConverter}}" Style="{StaticResource HistoryComboBox}">
37+
<ComboBox Grid.Column="0" x:Name="txtPortsOrService" ItemsSource="{Binding PortsHistory}" WpfHelper:ProtocolSettingsLayout.MVVMHasError="{Binding PortsOrServiceHasError}" mah:TextBoxHelper.Watermark="{DynamicResource String_Watermark_EamplePortPortRangeOrService}" IsEnabled="{Binding IsLookupRunning, Converter={StaticResource BooleanReverseConverter}}" Style="{StaticResource HistoryComboBox}">
3838
<ComboBox.InputBindings>
3939
<KeyBinding Command="{Binding PortLookupCommand}" Key="Return" />
4040
</ComboBox.InputBindings>
@@ -54,6 +54,9 @@
5454
<DataTrigger Binding="{Binding Path=(Validation.HasError), ElementName=txtPortsOrService}" Value="True" >
5555
<Setter Property="IsEnabled" Value="False" />
5656
</DataTrigger>
57+
<DataTrigger Binding="{Binding IsLookupRunning}" Value="True">
58+
<Setter Property="IsEnabled" Value="False" />
59+
</DataTrigger>
5760
</Style.Triggers>
5861
</Style>
5962
</Button.Resources>
@@ -63,40 +66,17 @@
6366
<ColumnDefinition Width="Auto" />
6467
<ColumnDefinition Width="*" />
6568
</Grid.ColumnDefinitions>
66-
<Rectangle Width="20" Height="20" Margin="10,5,0,5">
67-
<Rectangle.Resources>
68-
<VisualBrush x:Key="VisualMagnify" Stretch="Uniform" Visual="{IconPacks:PackIconMaterial Kind=Magnify}" />
69-
<VisualBrush x:Key="VisualClose" Stretch="Uniform" Visual="{IconPacks:PackIconMaterial Kind=Close}" />
70-
</Rectangle.Resources>
71-
<Rectangle.Style>
72-
<Style TargetType="{x:Type Rectangle}">
73-
<Setter Property="OpacityMask" Value="{StaticResource VisualMagnify}" />
74-
<Setter Property="Fill" Value="{DynamicResource GrayBrush3}" />
75-
<Style.Triggers>
76-
<DataTrigger Binding="{Binding IsPortLookupRunning}" Value="True">
77-
<Setter Property="OpacityMask" Value="{StaticResource VisualClose}" />
78-
</DataTrigger>
79-
</Style.Triggers>
80-
</Style>
81-
</Rectangle.Style>
69+
<Rectangle Width="20" Height="20" Margin="10,5,0,5" Fill="{DynamicResource GrayBrush3}">
70+
<Rectangle.OpacityMask>
71+
<VisualBrush Stretch="Uniform" Visual="{IconPacks:PackIconMaterial Kind=Magnify}" />
72+
</Rectangle.OpacityMask>
8273
</Rectangle>
83-
<TextBlock Grid.Column="1" FontSize="14" Margin="10,5" TextAlignment="Center">
84-
<TextBlock.Style>
85-
<Style TargetType="{x:Type TextBlock}">
86-
<Setter Property="Text" Value="{DynamicResource String_Button_Lookup}"/>
87-
<Style.Triggers>
88-
<DataTrigger Binding="{Binding IsPortLookupRunning}" Value="True" >
89-
<Setter Property="Text" Value="{DynamicResource String_Button_Cancel}"/>
90-
</DataTrigger>
91-
</Style.Triggers>
92-
</Style>
93-
</TextBlock.Style>
94-
</TextBlock>
74+
<TextBlock Grid.Column="1" Margin="10,5" TextAlignment="Center" Text="{DynamicResource String_Button_Lookup}" />
9575
</Grid>
9676
</Button.Content>
9777
</Button>
9878
</Grid>
99-
<Controls:MetroProgressBar Grid.Row="1" Foreground="{DynamicResource AccentColorBrush}" IsIndeterminate="True" Visibility="{Binding IsPortLookupRunning, Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0,10,0,0"/>
79+
<Controls:MetroProgressBar Grid.Row="1" Foreground="{DynamicResource AccentColorBrush}" IsIndeterminate="True" Visibility="{Binding IsLookupRunning, Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0,10,0,0"/>
10080
<TextBlock Grid.Row="2" Foreground="{DynamicResource AccentColorBrush}" Text="{DynamicResource String_NoPortsFoundCheckYourInput}" Visibility="{Binding NoPortsFound, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{DynamicResource DefaultTextBlock}" Margin="0,10,0,0" />
10181
</Grid>
10282
<TextBlock Grid.Row="2" Text="{DynamicResource String_Header_Result}" Style="{StaticResource HeaderTextBlock}" />

Source/NETworkManager/Views/SettingsViewManager.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using MahApps.Metro.IconPacks;
22
using System.Collections.Generic;
3-
using System.Linq;
43
using System.Windows;
54

65
namespace NETworkManager.Views
@@ -24,11 +23,11 @@ public static List<SettingsViewInfo> List
2423
new SettingsViewInfo(Name.ImportExport, new PackIconMaterial() { Kind = PackIconMaterialKind.Import}, Group.General),
2524
new SettingsViewInfo(Name.IPScanner, new PackIconMaterial() {Kind = PackIconMaterialKind.Sitemap }, Group.Applications),
2625
new SettingsViewInfo(Name.PortScanner, new PackIconModern() {Kind = PackIconModernKind.NetworkPort }, Group.Applications),
27-
new SettingsViewInfo(Name.WakeOnLAN, new PackIconMaterial() {Kind = PackIconMaterialKind.Power} , Group.Applications),
2826
new SettingsViewInfo(Name.Ping, new PackIconMaterial() { Kind = PackIconMaterialKind.LanConnect }, Group.Applications),
2927
new SettingsViewInfo(Name.Traceroute, new PackIconModern() {Kind = PackIconModernKind.TransitConnection}, Group.Applications),
3028
new SettingsViewInfo(Name.DNSLookup, new PackIconMaterial() { Kind= PackIconMaterialKind.Dna }, Group.Applications ),
31-
new SettingsViewInfo(Name.RemoteDesktop, new PackIconFontAwesome() { Kind = PackIconFontAwesomeKind.Desktop}, Group.Applications)
29+
new SettingsViewInfo(Name.RemoteDesktop, new PackIconFontAwesome() { Kind = PackIconFontAwesomeKind.Desktop}, Group.Applications),
30+
new SettingsViewInfo(Name.WakeOnLAN, new PackIconMaterial() {Kind = PackIconMaterialKind.Power} , Group.Applications)
3231
};
3332
}
3433
}
@@ -45,11 +44,11 @@ public enum Name
4544
ImportExport,
4645
IPScanner,
4746
PortScanner,
48-
WakeOnLAN,
4947
Ping,
5048
Traceroute,
5149
DNSLookup,
52-
RemoteDesktop
50+
RemoteDesktop,
51+
WakeOnLAN
5352
}
5453

5554
public static string TranslateName(Name name, Group group)

0 commit comments

Comments
 (0)