Ejemplo n.º 1
0
        public bool DisconnectDevice(DeviceForm devForm)
        {
            bool        flag        = false;
            ConnectInfo connectInfo = devForm.disconnectInfo;

            if (devForm != null)
            {
                foreach (TreeNode treeNode in tvPorts.Nodes)
                {
                    if (((DeviceInfo)treeNode.Tag).ComPortInfo.ComPort == devForm.devInfo.ComPortInfo.ComPort)
                    {
                        string target = string.Format("Handle: 0x{0:X4}", connectInfo.Handle);
                        SharedObjects.Log.Write(Logging.MsgType.Debug, ComPortTreeForm.moduleName, "Disconnecting Device " + target);
                        if (flag = treeViewUtils.TreeNodeTextSearchAndDestroy(treeNode, target))
                        {
                            break;
                        }
                    }
                    if (flag)
                    {
                        break;
                    }
                }
            }
            else
            {
                flag = false;
            }
            return(flag);
        }