Skip to content

Commit bd7f482

Browse files
committed
Update
1 parent 2f1d4bf commit bd7f482

10 files changed

Lines changed: 23 additions & 84 deletions

Source/NETworkManager.Models/EventSystem.cs renamed to Source/NETworkManager.Models/EventSystem/EventSystem.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
using System;
22

3-
namespace NETworkManager.Models
3+
namespace NETworkManager.Models.EventSystem
44
{
55
public class EventSystem
66
{
77
// This will notify the mail window, to change the view to another application and redirect some data (hostname, ip)
88
public static event EventHandler RedirectDataToApplicationEvent;
99

10-
public static void RedirectDataToApplication(ApplicationName application, string data)
10+
public static void RedirectToApplication(ApplicationName application, string data)
1111
{
12-
RedirectDataToApplicationEvent?.Invoke(null, new EventSystemRedirectDataApplicationArgs(application, data));
12+
RedirectDataToApplicationEvent?.Invoke(null, new EventSystemRedirectArgs(application, data));
1313
}
1414

1515
// This will notify the main window, to change the view to the settings...

Source/NETworkManager.Models/EventSystemRedirectDataApplicationArgs.cs renamed to Source/NETworkManager.Models/EventSystem/EventSystemRedirectArgs.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
using System;
22

3-
namespace NETworkManager.Models
3+
namespace NETworkManager.Models.EventSystem
44
{
5-
public class EventSystemRedirectDataApplicationArgs : EventArgs
5+
public class EventSystemRedirectArgs : EventArgs
66
{
77
public ApplicationName Application { get; set; }
88
public string Args { get; set; }
99

1010

11-
public EventSystemRedirectDataApplicationArgs(ApplicationName application, string args)
11+
public EventSystemRedirectArgs(ApplicationName application, string args)
1212
{
1313
Application = application;
1414
Args = args;

Source/NETworkManager.Models/NETworkManager.Models.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
<Compile Include="ApplicationManager.cs" />
5050
<Compile Include="ApplicationName.cs" />
5151
<Compile Include="ApplicationInfo.cs" />
52-
<Compile Include="EventSystem.cs" />
53-
<Compile Include="EventSystemRedirectDataApplicationArgs.cs" />
52+
<Compile Include="EventSystem\EventSystem.cs" />
53+
<Compile Include="EventSystem\EventSystemRedirectArgs.cs" />
5454
<Compile Include="Export\ExportManager.cs" />
5555
<Compile Include="Export\ExportManager.ExportFileType.cs" />
5656
<Compile Include="Lookup\OUIInfo.cs" />

Source/NETworkManager/MainWindow.xaml.cs

Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
using NETworkManager.Localization.Translators;
2727
using NETworkManager.Update;
2828
using NETworkManager.Models;
29+
using NETworkManager.Models.EventSystem;
2930

3031
namespace NETworkManager
3132
{
@@ -791,78 +792,9 @@ private void ClearSearchOnApplicationListMinimize()
791792
ListViewApplication.ScrollIntoView(SelectedApplication);
792793
}
793794

794-
// This works, but is currently not used :)
795-
/*
796-
private void EventSystem_RedirectProfileToApplicationEvent(object sender, EventArgs e)
797-
{
798-
if (!(e is EventSystemRedirectProfileApplicationArgs profile))
799-
return;
800-
801-
// Change view
802-
SelectedApplication = Applications.SourceCollection.Cast<ApplicationViewInfo>().FirstOrDefault(x => x.Name == profile.Application);
803-
804-
// Crate a new tab / perform action
805-
switch (profile.Application)
806-
{
807-
case Models.Application.Name.None:
808-
break;
809-
case Models.Application.Name.Dashboard:
810-
break;
811-
case Models.Application.Name.NetworkInterface:
812-
break;
813-
case Models.Application.Name.WiFi:
814-
break;
815-
case Models.Application.Name.IPScanner:
816-
_ipScannerHostView.AddTab(profile.Profile);
817-
break;
818-
case Models.Application.Name.PortScanner:
819-
_portScannerHostView.AddTab(profile.Profile);
820-
break;
821-
case Models.Application.Name.Ping:
822-
_pingHostView.AddTab(profile.Profile);
823-
break;
824-
case Models.Application.Name.PingMonitor:
825-
break;
826-
case Models.Application.Name.Traceroute:
827-
_tracerouteHostView.AddTab(profile.Profile);
828-
break;
829-
case Models.Application.Name.DNSLookup:
830-
break;
831-
case Models.Application.Name.RemoteDesktop:
832-
break;
833-
case Models.Application.Name.PowerShell:
834-
break;
835-
case Models.Application.Name.PuTTY:
836-
break;
837-
case Models.Application.Name.TigerVNC:
838-
break;
839-
case Models.Application.Name.SNMP:
840-
break;
841-
case Models.Application.Name.WakeOnLAN:
842-
break;
843-
case Models.Application.Name.HTTPHeaders:
844-
break;
845-
case Models.Application.Name.Whois:
846-
break;
847-
case Models.Application.Name.SubnetCalculator:
848-
break;
849-
case Models.Application.Name.Lookup:
850-
break;
851-
case Models.Application.Name.Connections:
852-
break;
853-
case Models.Application.Name.Listeners:
854-
break;
855-
case Models.Application.Name.ARPTable:
856-
break;
857-
default:
858-
throw new ArgumentOutOfRangeException();
859-
}
860-
}
861-
*/
862-
863795
private void EventSystem_RedirectDataToApplicationEvent(object sender, EventArgs e)
864796
{
865-
if (!(e is EventSystemRedirectDataApplicationArgs data))
797+
if (!(e is EventSystemRedirectArgs data))
866798
return;
867799

868800
// Change view

Source/NETworkManager/ViewModels/IPScannerViewModel.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
using NETworkManager.Localization;
2626
using NETworkManager.Localization.Translators;
2727
using NETworkManager.Models;
28+
using NETworkManager.Models.EventSystem;
2829

2930
namespace NETworkManager.ViewModels
3031
{
@@ -376,21 +377,21 @@ private void RedirectDataToApplicationAction(object name)
376377

377378
var host = !string.IsNullOrEmpty(SelectedHostResult.Hostname) ? SelectedHostResult.Hostname : SelectedHostResult.PingInfo.IPAddress.ToString();
378379

379-
EventSystem.RedirectDataToApplication(applicationName, host);
380+
EventSystem.RedirectToApplication(applicationName, host);
380381
}
381382

382383
public ICommand PerformDNSLookupIPAddressCommand => new RelayCommand(p => PerformDNSLookupIPAddressAction());
383384

384385
private void PerformDNSLookupIPAddressAction()
385386
{
386-
EventSystem.RedirectDataToApplication(ApplicationName.DNSLookup, SelectedHostResult.PingInfo.IPAddress.ToString());
387+
EventSystem.RedirectToApplication(ApplicationName.DNSLookup, SelectedHostResult.PingInfo.IPAddress.ToString());
387388
}
388389

389390
public ICommand PerformDNSLookupHostnameCommand => new RelayCommand(p => PerformDNSLookupHostnameAction());
390391

391392
private void PerformDNSLookupHostnameAction()
392393
{
393-
EventSystem.RedirectDataToApplication(ApplicationName.DNSLookup, SelectedHostResult.Hostname);
394+
EventSystem.RedirectToApplication(ApplicationName.DNSLookup, SelectedHostResult.Hostname);
394395
}
395396

396397
public ICommand CustomCommandCommand => new RelayCommand(CustomCommandAction);
@@ -401,6 +402,7 @@ private void CustomCommandAction(object guid)
401402
}
402403

403404
public ICommand AddProfileSelectedHostCommand => new RelayCommand(p => AddProfileSelectedHostAction());
405+
404406
private async void AddProfileSelectedHostAction()
405407
{
406408
ProfileInfo profileInfo = new ProfileInfo()

Source/NETworkManager/ViewModels/PowerShellHostViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using NETworkManager.Profiles;
1818
using System.Windows.Threading;
1919
using NETworkManager.Models;
20+
using NETworkManager.Models.EventSystem;
2021

2122
namespace NETworkManager.ViewModels
2223
{

Source/NETworkManager/ViewModels/PuTTYHostViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using NETworkManager.Profiles;
1818
using System.Windows.Threading;
1919
using NETworkManager.Models;
20+
using NETworkManager.Models.EventSystem;
2021

2122
namespace NETworkManager.ViewModels
2223
{

Source/NETworkManager/ViewModels/TigerVNCHostViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using System.Windows.Threading;
1919
using NETworkManager.Settings;
2020
using NETworkManager.Models;
21+
using NETworkManager.Models.EventSystem;
2122

2223
namespace NETworkManager.ViewModels
2324
{

Source/NETworkManager/ViewModels/TracerouteViewModel.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
using NETworkManager.Models.Export;
2222
using NETworkManager.Views;
2323
using NETworkManager.Models;
24+
using NETworkManager.Models.EventSystem;
2425

2526
namespace NETworkManager.ViewModels
2627
{
@@ -299,21 +300,21 @@ private void RedirectDataToApplicationAction(object name)
299300

300301
var host = !string.IsNullOrEmpty(SelectedTraceResult.Hostname) ? SelectedTraceResult.Hostname : SelectedTraceResult.IPAddress.ToString();
301302

302-
EventSystem.RedirectDataToApplication(app, host);
303+
EventSystem.RedirectToApplication(app, host);
303304
}
304305

305306
public ICommand PerformDNSLookupIPAddressCommand => new RelayCommand(p => PerformDNSLookupIPAddressAction());
306307

307308
private void PerformDNSLookupIPAddressAction()
308309
{
309-
EventSystem.RedirectDataToApplication(ApplicationName.DNSLookup, SelectedTraceResult.IPAddress.ToString());
310+
EventSystem.RedirectToApplication(ApplicationName.DNSLookup, SelectedTraceResult.IPAddress.ToString());
310311
}
311312

312313
public ICommand PerformDNSLookupHostnameCommand => new RelayCommand(p => PerformDNSLookupHostnameAction());
313314

314315
private void PerformDNSLookupHostnameAction()
315316
{
316-
EventSystem.RedirectDataToApplication(ApplicationName.DNSLookup, SelectedTraceResult.Hostname);
317+
EventSystem.RedirectToApplication(ApplicationName.DNSLookup, SelectedTraceResult.Hostname);
317318
}
318319

319320
public ICommand CopySelectedHopCommand => new RelayCommand(p => CopySelectedHopAction());

Source/NETworkManager/ViewModels/WebConsoleHostViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using NETworkManager.Models.WebConsole;
1616
using System.Windows.Threading;
1717
using NETworkManager.Models;
18+
using NETworkManager.Models.EventSystem;
1819

1920
namespace NETworkManager.ViewModels
2021
{

0 commit comments

Comments
 (0)