private void EventSystem_RedirectToApplicationEvent(object sender, EventArgs e) { EventSystemRedirectApplicationArgs args = e as EventSystemRedirectApplicationArgs; // Change view SelectedApplication = Applications.SourceCollection.Cast <ApplicationViewInfo>().FirstOrDefault(x => x.Name == args.Application); // Crate a new tab / perform action switch (args.Application) { case ApplicationViewManager.Name.IPScanner: _ipScannerHostView.AddTab(args.Data); break; case ApplicationViewManager.Name.PortScanner: _portScannerHostView.AddTab(args.Data); break; case ApplicationViewManager.Name.Ping: _pingHostView.AddTab(args.Data); break; case ApplicationViewManager.Name.Traceroute: _tracerouteHostView.AddTab(args.Data); break; case ApplicationViewManager.Name.DNSLookup: _dnsLookupHostView.AddTab(args.Data); break; case ApplicationViewManager.Name.RemoteDesktop: _remoteDesktopHostView.AddTab(args.Data); break; case ApplicationViewManager.Name.PuTTY: _puTTYHostView.AddTab(args.Data); break; case ApplicationViewManager.Name.SNMP: _snmpHostView.AddTab(args.Data); break; } }
private void ChangeApplicationView(ApplicationViewManager.Name name, EventSystemRedirectApplicationArgs args = null) { if (currentApplicationViewName == name) { return; } switch (name) { case ApplicationViewManager.Name.NetworkInterface: if (networkInterfaceView == null) { networkInterfaceView = new NetworkInterfaceView(); } contentControlApplication.Content = networkInterfaceView; break; case ApplicationViewManager.Name.IPScanner: if (ipScannerHostView == null) { ipScannerHostView = new IPScannerHostView(); } contentControlApplication.Content = ipScannerHostView; break; case ApplicationViewManager.Name.PortScanner: if (portScannerHostView == null) { portScannerHostView = new PortScannerHostView(); } // Create a new tab if (args != null) { portScannerHostView.AddTab(args.Data); } contentControlApplication.Content = portScannerHostView; break; case ApplicationViewManager.Name.Ping: if (pingHostView == null) { pingHostView = new PingHostView(); } contentControlApplication.Content = pingHostView; break; case ApplicationViewManager.Name.Traceroute: if (tracerouteHostView == null) { tracerouteHostView = new TracerouteHostView(); } contentControlApplication.Content = tracerouteHostView; break; case ApplicationViewManager.Name.DNSLookup: if (dnsLookupHostView == null) { dnsLookupHostView = new DNSLookupHostView(); } contentControlApplication.Content = dnsLookupHostView; break; case ApplicationViewManager.Name.RemoteDesktop: if (remoteDesktopHostView == null) { remoteDesktopHostView = new RemoteDesktopHostView(); } contentControlApplication.Content = remoteDesktopHostView; break; case ApplicationViewManager.Name.PuTTY: if (puTTYHostView == null) { puTTYHostView = new PuTTYHostView(); } contentControlApplication.Content = puTTYHostView; break; case ApplicationViewManager.Name.SNMP: if (snmpHostView == null) { snmpHostView = new SNMPHostView(); } contentControlApplication.Content = snmpHostView; break; case ApplicationViewManager.Name.WakeOnLAN: if (wakeOnLANView == null) { wakeOnLANView = new WakeOnLANView(); } contentControlApplication.Content = wakeOnLANView; break; case ApplicationViewManager.Name.HTTPHeaders: if (httpHeadersHostView == null) { httpHeadersHostView = new HTTPHeadersHostView(); } contentControlApplication.Content = httpHeadersHostView; break; case ApplicationViewManager.Name.SubnetCalculator: if (subnetCalculatorHostView == null) { subnetCalculatorHostView = new SubnetCalculatorHostView(); } contentControlApplication.Content = subnetCalculatorHostView; break; case ApplicationViewManager.Name.Lookup: if (lookupHostView == null) { lookupHostView = new LookupHostView(); } contentControlApplication.Content = lookupHostView; break; case ApplicationViewManager.Name.ARPTable: if (arpTableView == null) { arpTableView = new ARPTableView(); } contentControlApplication.Content = arpTableView; break; } currentApplicationViewName = name; }