Exemplo n.º 1
0
 internal void deviceAdded(Device device)
 {
     try {
         DeviceNode node = new DeviceNode(form, device);
         devices.Add(device, node);
         if (!form.Visible)
         {
             Nodes.Add(node);
         }
         else
         {
             form.BeginInvoke(new MethodInvoker(() => {
                 form.tree.BeginUpdate();
                 Nodes.Add(node);
                 form.tree.EndUpdate();
             }));
         }
         foreach (Property property in device.Properties)
         {
             node.propertyAdded(property);
         }
     } catch (Exception exception) {
         Console.WriteLine(exception);
     }
 }
Exemplo n.º 2
0
 internal void propertyAdded(Property property)
 {
     if (property.Name == "INFO")
     {
         foreach (Item item in property.Items)
         {
             if (item.Name == "DEVICE_INTERFACE")
             {
                 int interfaceMask = Convert.ToInt32(((TextItem)item).Value);
                 if ((interfaceMask & form.interfaceMask) == form.interfaceMask)
                 {
                     if (!form.Visible)
                     {
                         ForeColor = DefaultForeColor;
                         Parent.Expand();
                         if (form.driver.deviceName == property.DeviceName)
                         {
                             form.tree.SelectedNode = this;
                             form.tree.Focus();
                         }
                     }
                     else
                     {
                         form.BeginInvoke(new MethodInvoker(() => {
                             ForeColor = DefaultForeColor;
                             Parent.Expand();
                             if (form.driver.deviceName == property.DeviceName)
                             {
                                 form.tree.SelectedNode = this;
                                 form.tree.Focus();
                             }
                         }));
                     }
                 }
                 break;
             }
         }
     }
 }