Inheritance: System.ComponentModel.PropertyChangedBase, IListItem
Beispiel #1
0
 /// <summary>
 /// Called whenever a process is added
 /// </summary>
 /// <param name="process">The process that was added</param>
 private void _processAdded(Process process)
 {
     // bad way to check if the process is a port
     var portIdProp = process.GetType().GetProperty("PortId");
     if(portIdProp != null)
     {
         byte portId = (byte)portIdProp.GetValue(process);
         var router = _session.Processes.OfType<RouterProcess>().FirstOrDefault();
         if (router != null)
         {
             router.PortMappings.Add(new PortMapping()
             {
                 PortId = portId,
                 Network = 0
             });
         }
     }
 }