Esempio n. 1
0
        private void treeList1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                return;
            }
            TreeListNode node = treeList1.FocusedNode;

            if (node == null)
            {
                return;
            }
            string strID = node["id"].ToString();
            string dtype = node["class"].ToString();

            //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 = ProjectID;
                devicTypes.Add(dtype, device);
                showDevice(device);
            }
            if (!shortflag)
            {
                if (!pspflag)
                {
                    if (!wjghflag)
                    {
                        if (curDevice != null && curDevice != device)
                        {
                            curDevice.Hide();
                        }
                        curDevice = device;
                        if (curDevice != null)
                        {
                            if (xlwhere != "" || bdzwhere != "")
                            {
                                if (strID == "05")
                                {
                                    curDevice.strCon = xlwhere;
                                }
                                if (strID == "20")
                                {
                                    curDevice.strCon = bdzwhere;
                                }
                            }
                            else
                            {
                                curDevice.strCon = " where 1=1 and ";
                            }
                            curDevice.Init();
                        }
                    }
                    else
                    {
                        if (curDevice != null && curDevice != device)
                        {
                            curDevice.Hide();
                        }
                        curDevice = device;
                        if (curDevice != null)
                        {
                            curDevice.wjghuid = wjghuid;
                            curDevice.strCon  = " where 1=1 and ";
                            curDevice.WjghInit();
                        }
                    }
                }
                else
                {
                    if (curDevice != null && curDevice != device)
                    {
                        curDevice.Hide();
                    }
                    curDevice = device;
                    if (curDevice != null)
                    {
                        curDevice.strCon = " where 1=1 and";
                        curDevice.PspInit(listUID);
                    }
                }
            }
            else if (shortflag)
            {
                if (curDevice != null && curDevice != device)
                {
                    curDevice.Hide();
                }
                curDevice = device;
                if (curDevice != null)
                {
                    curDevice.strCon          = ",psp_elcdevice where psp_elcdevice.devicesuid = pspdev.suid and psp_elcdevice.projectsuid = '" + ProjectSuid + "'";
                    curDevice.shortselelement = shortselelement;
                    curDevice.SelshortDevices();
                    // IList list = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    // List<PSPDEV> delsum=new List<PSPDEV>();
                    // for (int i = 0; i < shortselelement.Count;i++ )
                    // {
                    //     if (shortselelement[i].selectflag)
                    //     {
                    //         PSPDEV psp = new PSPDEV();
                    //         psp.SUID = shortselelement[i].suid;
                    //         psp =(PSPDEV) UCDeviceBase.DataService.GetObject("SelectPSPDEVByKey", psp);
                    //         delsum.Add(psp);
                    //     }
                    // }
                    // for (int m = 0; m < delsum.Count; m++)
                    // {
                    //     list.Remove(delsum[m]);
                    // }
                    //DataTable datatable1 = Itop.Common.DataConverter.ToDataTable(list, typeof(PSPDEV));
                    //curDevice.gridControl1.Refresh();
                    //curDevice.gridControl1.DataSource = datatable1;
                }
            }
        }