Ejemplo n.º 1
0
        private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            // if (e.Button == MouseButtons.Right) return;
            TreeListNode node = treeList1.FocusedNode;

            if (node == null)
            {
                return;
            }
            string deviceid = node["DeviceID"].ToString();
            string strID    = node["devicetype"].ToString();
            string dtype    = DeviceTypeHelper.DeviceClassbyType(strID);

            if (string.IsNullOrEmpty(dtype))
            {
                if (curDevice != null)
                {
                    curDevice.Hide();
                }
                return;
            }

            UCDeviceBase device = null;

            if (devicTypes.ContainsKey(dtype))
            {
                device    = devicTypes[dtype];
                device.ID = strID;
                try
                {
                    device.Show();
                }
                catch { }
            }
            else
            {
                device           = createInstance(dtype);
                device.ID        = strID;
                device.ProjectID = Itop.Client.MIS.ProgUID;
                devicTypes.Add(dtype, device);
                showDevice(device);
            }

            if (curDevice != null && curDevice != device)
            {
                curDevice.Hide();
            }
            curDevice = device;
            if (curDevice != null)
            {
                curDevice.strCon = " where 1=1 and suid='" + deviceid + "'and ";
                curDevice.Init();
            }
        }
Ejemplo n.º 2
0
        //添加元件所关联的设备
        private void adducdevice(string Devicetype)
        {
            string dtype = DeviceTypeHelper.DeviceClassbyType(Devicetype);

            if (string.IsNullOrEmpty(dtype))
            {
                if (curDevice != null)
                {
                    curDevice.Hide();
                }
                return;
            }

            UCDeviceBase device = null;

            if (devicTypes.ContainsKey(dtype))
            {
                device    = devicTypes[dtype];
                device.ID = Devicetype;
                try
                {
                    device.Show();
                }
                catch { }
            }
            else
            {
                device           = createInstance(dtype);
                device.ID        = Devicetype;
                device.ProjectID = Itop.Client.MIS.ProgUID;
                devicTypes.Add(dtype, device);
                showDevice(device);
            }

            if (curDevice != null && curDevice != device)
            {
                curDevice.Hide();
            }
            curDevice = device;
            if (curDevice != null)
            {
                //给一个空的选择
                curDevice.strCon = " where 1=1 and suid='1111' and";
                curDevice.Init();
            }
        }