Skip to content

Commit 93b75e9

Browse files
committed
1 parent 85dc5a3 commit 93b75e9

34 files changed

Lines changed: 285 additions & 141 deletions

‎Source/NETworkManager.sln.DotSettings‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MVVM/@EntryIndexedValue">MVVM</s:String>
1616
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OID/@EntryIndexedValue">OID</s:String>
1717
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OK/@EntryIndexedValue">OK</s:String>
18+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OS/@EntryIndexedValue">OS</s:String>
1819
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OUI/@EntryIndexedValue">OUI</s:String>
1920
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PS/@EntryIndexedValue">PS</s:String>
2021
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PTR/@EntryIndexedValue">PTR</s:String>

‎Source/NETworkManager/Controls/PowerShellControl.xaml.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,12 @@ private async void Connect()
190190
var settings = AppearanceManager.MetroDialog;
191191
settings.AffirmativeButtonText = NETworkManager.Resources.Localization.Strings.OK;
192192

193-
ConfigurationManager.Current.IsDialogOpen = true;
193+
ConfigurationManager.Current.FixAirspace = true;
194194

195195
await _dialogCoordinator.ShowMessageAsync(this, NETworkManager.Resources.Localization.Strings.Error,
196196
ex.Message, MessageDialogStyle.Affirmative, settings);
197197

198-
ConfigurationManager.Current.IsDialogOpen = false;
198+
ConfigurationManager.Current.FixAirspace = false;
199199
}
200200
}
201201

‎Source/NETworkManager/Controls/PuTTYControl.xaml.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,12 @@ private async void Connect()
198198
var settings = AppearanceManager.MetroDialog;
199199
settings.AffirmativeButtonText = NETworkManager.Resources.Localization.Strings.OK;
200200

201-
ConfigurationManager.Current.IsDialogOpen = true;
201+
ConfigurationManager.Current.FixAirspace = true;
202202

203203
await _dialogCoordinator.ShowMessageAsync(this, NETworkManager.Resources.Localization.Strings.Error,
204204
ex.Message, MessageDialogStyle.Affirmative, settings);
205205

206-
ConfigurationManager.Current.IsDialogOpen = false;
206+
ConfigurationManager.Current.FixAirspace = false;
207207
}
208208
}
209209

‎Source/NETworkManager/Controls/TightVNCControl.xaml.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ private async void Connect()
200200
{
201201
var settings = AppearanceManager.MetroDialog;
202202
settings.AffirmativeButtonText = NETworkManager.Resources.Localization.Strings.OK;
203-
ConfigurationManager.Current.IsDialogOpen = true;
203+
ConfigurationManager.Current.FixAirspace = true;
204204

205205
await _dialogCoordinator.ShowMessageAsync(this, NETworkManager.Resources.Localization.Strings.Error,
206206
ex.Message, MessageDialogStyle.Affirmative, settings);
207207

208-
ConfigurationManager.Current.IsDialogOpen = false;
208+
ConfigurationManager.Current.FixAirspace = false;
209209
}
210210
}
211211

‎Source/NETworkManager/MainWindow.xaml.cs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,11 @@ protected override async void OnContentRendered(EventArgs e)
295295
var settings = AppearanceManager.MetroDialog;
296296
settings.AffirmativeButtonText = NETworkManager.Resources.Localization.Strings.OK;
297297

298-
ConfigurationManager.Current.IsDialogOpen = true;
298+
ConfigurationManager.Current.FixAirspace = true;
299299

300300
await this.ShowMessageAsync(NETworkManager.Resources.Localization.Strings.SettingsHaveBeenReset, NETworkManager.Resources.Localization.Strings.SettingsFileFoundWasCorruptOrNotCompatibleMessage, MessageDialogStyle.Affirmative, settings);
301301

302-
ConfigurationManager.Current.IsDialogOpen = false;
302+
ConfigurationManager.Current.FixAirspace = false;
303303
}
304304

305305
// Hide to tray...
@@ -382,11 +382,11 @@ private async void MetroWindowMain_Closing(object sender, CancelEventArgs e)
382382
settings.DefaultButtonFocus = MessageDialogResult.Affirmative;
383383

384384
// Fix airspace issues
385-
ConfigurationManager.Current.IsDialogOpen = true;
385+
ConfigurationManager.Current.FixAirspace = true;
386386

387387
var result = await this.ShowMessageAsync(NETworkManager.Resources.Localization.Strings.Confirm, NETworkManager.Resources.Localization.Strings.ConfirmCloseMessage, MessageDialogStyle.AffirmativeAndNegative, settings);
388388

389-
ConfigurationManager.Current.IsDialogOpen = false;
389+
ConfigurationManager.Current.FixAirspace = false;
390390

391391
if (result != MessageDialogResult.Affirmative)
392392
return;
@@ -755,15 +755,15 @@ private async void CloseSettings()
755755
settings.NegativeButtonText = NETworkManager.Resources.Localization.Strings.OK;
756756
settings.DefaultButtonFocus = MessageDialogResult.Affirmative;
757757

758-
ConfigurationManager.Current.IsDialogOpen = true;
758+
ConfigurationManager.Current.FixAirspace = true;
759759

760760
if (await this.ShowMessageAsync(NETworkManager.Resources.Localization.Strings.RestartRequired, NETworkManager.Resources.Localization.Strings.RestartRequiredSettingsChangedMessage, MessageDialogStyle.AffirmativeAndNegative, settings) == MessageDialogResult.Affirmative)
761761
{
762762
RestartApplication();
763763
return;
764764
}
765765

766-
ConfigurationManager.Current.IsDialogOpen = false;
766+
ConfigurationManager.Current.FixAirspace = false;
767767
}
768768

769769
// Change the transparency

‎Source/NETworkManager/Models/Network/PortScanner.cs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ public void ScanAsync(IPAddress[] ipAddresses, int[] ports, CancellationToken ca
8484
{
8585
try
8686
{
87-
Task.Run(() => { hostname = Dns.GetHostEntryAsync(ipAddress).Result.HostName; },
88-
cancellationToken);
87+
Task.Run(() => { hostname = Dns.GetHostEntryAsync(ipAddress).Result.HostName; }, cancellationToken);
8988
}
9089
catch (SocketException)
9190
{

‎Source/NETworkManager/Models/Settings/ConfigurationInfo.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName
2222
public bool ShowSettingsResetNoteOnStartup { get; set; }
2323

2424
private bool _isDialogOpen;
25-
public bool IsDialogOpen
25+
public bool FixAirspace
2626
{
2727
get => _isDialogOpen;
2828
set

‎Source/NETworkManager/ViewModels/ARPTableViewModel.cs‎

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
using NETworkManager.Models.Settings;
1212
using System.Windows.Threading;
1313
using System.Linq;
14+
using System.Windows;
15+
using MahApps.Metro.Controls;
1416
using NETworkManager.Models.Export;
1517

1618
namespace NETworkManager.ViewModels
@@ -224,7 +226,12 @@ private void LoadSettings()
224226
#region ICommands & Actions
225227
public ICommand RefreshCommand
226228
{
227-
get { return new RelayCommand(p => RefreshAction()); }
229+
get { return new RelayCommand(p => RefreshAction(), Refresh_CanExecute); }
230+
}
231+
232+
private bool Refresh_CanExecute(object paramter)
233+
{
234+
return Application.Current.MainWindow != null && !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen;
228235
}
229236

230237
private void RefreshAction()
@@ -236,7 +243,12 @@ private void RefreshAction()
236243

237244
public ICommand DeleteTableCommand
238245
{
239-
get { return new RelayCommand(p => DeleteTableAction()); }
246+
get { return new RelayCommand(p => DeleteTableAction(), DeleteTable_CanExecute); }
247+
}
248+
249+
private bool DeleteTable_CanExecute(object paramter)
250+
{
251+
return Application.Current.MainWindow != null && !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen;
240252
}
241253

242254
private async void DeleteTableAction()
@@ -262,7 +274,12 @@ private async void DeleteTableAction()
262274

263275
public ICommand DeleteEntryCommand
264276
{
265-
get { return new RelayCommand(p => DeleteEntryAction()); }
277+
get { return new RelayCommand(p => DeleteEntryAction(), DeleteEntry_CanExecute); }
278+
}
279+
280+
private bool DeleteEntry_CanExecute(object paramter)
281+
{
282+
return Application.Current.MainWindow != null && !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen;
266283
}
267284

268285
private async void DeleteEntryAction()
@@ -288,7 +305,12 @@ private async void DeleteEntryAction()
288305

289306
public ICommand AddEntryCommand
290307
{
291-
get { return new RelayCommand(p => AddEntryAction()); }
308+
get { return new RelayCommand(p => AddEntryAction(), AddEntry_CanExecute); }
309+
}
310+
311+
private bool AddEntry_CanExecute(object paramter)
312+
{
313+
return Application.Current.MainWindow != null && !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen;
292314
}
293315

294316
private async void AddEntryAction()

‎Source/NETworkManager/ViewModels/ConnectionsViewModel.cs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
using NETworkManager.Models.Settings;
1010
using System.Windows.Threading;
1111
using System.Linq;
12+
using System.Windows;
13+
using MahApps.Metro.Controls;
1214
using MahApps.Metro.Controls.Dialogs;
1315
using NETworkManager.Models.Export;
1416
using NETworkManager.Views;
@@ -222,7 +224,12 @@ private void LoadSettings()
222224
#region ICommands & Actions
223225
public ICommand RefreshCommand
224226
{
225-
get { return new RelayCommand(p => RefreshAction()); }
227+
get { return new RelayCommand(p => RefreshAction(), Refresh_CanExecute); }
228+
}
229+
230+
private bool Refresh_CanExecute(object paramter)
231+
{
232+
return Application.Current.MainWindow != null && !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen;
226233
}
227234

228235
private void RefreshAction()

‎Source/NETworkManager/ViewModels/DNSLookupViewModel.cs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using System.Collections.ObjectModel;
1616
using NETworkManager.Controls;
1717
using Dragablz;
18+
using MahApps.Metro.Controls;
1819
using MahApps.Metro.Controls.Dialogs;
1920
using NETworkManager.Models.Export;
2021
using NETworkManager.Views;
@@ -314,7 +315,12 @@ private void LoadTypes()
314315
#region ICommands & Actions
315316
public ICommand LookupCommand
316317
{
317-
get { return new RelayCommand(p => LookupAction()); }
318+
get { return new RelayCommand(p => LookupAction(), Lookup_CanExecute); }
319+
}
320+
321+
private bool Lookup_CanExecute(object paramter)
322+
{
323+
return Application.Current.MainWindow != null && !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen;
318324
}
319325

320326
private void LookupAction()

0 commit comments

Comments
 (0)