//排除设备 void barDeleteDevice_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (psp_proj.ID == null || curDevice == null) { MessageBox.Show("选择有问题!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (curDevice.SelectedDevice != null) { if (curDevice.SelectedDevice.GetType() == typeof(PSPDEV)) { PSPDEV dev = curDevice.SelectedDevice as PSPDEV; PSP_ElcDevice elcdevice = new PSP_ElcDevice(); elcdevice.ProjectSUID = psp_proj.ID; elcdevice.DeviceSUID = dev.SUID; Services.BaseService.Delete <PSP_ElcDevice>(elcdevice); } else if (curDevice.SelectedDevice.GetType() == typeof(PSP_Substation_Info)) { PSP_Substation_Info dev = curDevice.SelectedDevice as PSP_Substation_Info; PSP_ElcDevice elcdevice = new PSP_ElcDevice(); elcdevice.ProjectSUID = psp_proj.ID; elcdevice.DeviceSUID = dev.UID; Services.BaseService.Delete <PSP_ElcDevice>(elcdevice); } else if (curDevice.SelectedDevice.GetType() == typeof(PSP_PowerSubstation_Info)) { PSP_PowerSubstation_Info dev = curDevice.SelectedDevice as PSP_PowerSubstation_Info; PSP_ElcDevice elcdevice = new PSP_ElcDevice(); elcdevice.ProjectSUID = psp_proj.ID; elcdevice.DeviceSUID = dev.UID; Services.BaseService.Delete <PSP_ElcDevice>(elcdevice); } } if (curDevice != null) { if (curDevice.GetClassName() == "PSP_Substation_Info") { curDevice.proInit(psp_proj.ID); } else if (curDevice.GetClassName() == "PSP_PowerSubstation_Info") { curDevice.proInit(psp_proj.ID); } else if (curDevice.GetClassName() == "PSPDEV") { if (ParentObj is PSP_Substation_Info) { curDevice.strCon = ",psp_elcdevice where psp_elcdevice.devicesuid = pspdev.suid and psp_elcdevice.projectsuid = '" + psp_proj.ID + "' and pspdev.SvgUID='" + ((PSP_Substation_Info)ParentObj).UID + "'and"; } else if (ParentObj is PSP_PowerSubstation_Info) { curDevice.strCon = ",psp_elcdevice where psp_elcdevice.devicesuid = pspdev.suid and psp_elcdevice.projectsuid = '" + psp_proj.ID + "' and pspdev.SvgUID='" + ((PSP_PowerSubstation_Info)ParentObj).UID + "'and";; } else if (ParentObj is PSPDEV) { curDevice.strCon = ",psp_elcdevice where psp_elcdevice.devicesuid = pspdev.suid and psp_elcdevice.projectsuid = '" + psp_proj.ID + "' and pspdev.SvgUID='" + ((PSPDEV)ParentObj).SUID + "'and";; } curDevice.Init(); } } }
private void treeList2_MouseClick(object sender, MouseEventArgs e) { if (strID != null) { //TreeListNode node1 = treeList1.FocusedNode; //if (node1 == null) return; //strID = node1["ID"].ToString(); if (e.Button == MouseButtons.Right) return; TreeListNode node = treeList2.FocusedNode; if (node == null) return; string dtype = node["class"].ToString(); if (string.IsNullOrEmpty(dtype)) { return; } if (node["id"].ToString() == "20" || node["id"].ToString()=="30") { this.bardetail.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; this.barDeleteDevice.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; } UCDeviceBase device = null; if (devicTypes.ContainsKey(dtype)) { device = devicTypes[dtype]; try { device.Show(); } catch { } } else { device = createInstance(dtype); device.ProjectID = this.ProjectUID; devicTypes.Add(dtype, device); showDevice(device); } if (curDevice != null && curDevice != device) curDevice.Hide(); curDevice = device; if (curDevice != null) { if (curDevice.GetClassName() == "PSP_Substation_Info") { curDevice.proInit(parentobj.ID); } else if (curDevice.GetClassName() == "PSP_PowerSubstation_Info") { curDevice.proInit(parentobj.ID); } else if (curDevice.GetClassName() == "PSPDEV") { curDevice.strCon = ",psp_elcdevice where psp_elcdevice.devicesuid = pspdev.suid and psp_elcdevice.projectsuid = '" + strID + "' and "; curDevice.Init(); } } splitContainerControl2.Panel2.Text = node["name"].ToString(); } else { MessageBox.Show("����ѡ��������㷽����", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void treeList2_MouseClick(object sender, MouseEventArgs e) { if (strID != null) { //TreeListNode node1 = treeList1.FocusedNode; //if (node1 == null) return; //strID = node1["ID"].ToString(); if (e.Button == MouseButtons.Right) { return; } TreeListNode node = treeList2.FocusedNode; if (node == null) { return; } string dtype = node["class"].ToString(); if (string.IsNullOrEmpty(dtype)) { return; } UCDeviceBase device = null; if (devicTypes.ContainsKey(dtype)) { device = devicTypes[dtype]; try { device.Show(); } catch { } } else { device = createInstance(dtype); device.ProjectID = this.ProjectUID; devicTypes.Add(dtype, device); showDevice(device); } if (curDevice != null && curDevice != device) { curDevice.Hide(); } curDevice = device; if (curDevice != null) { if (curDevice.GetClassName() == "PSP_Substation_Info") { curDevice.proInit(parentobj.BelongYear); } else if (curDevice.GetClassName() == "PSP_PowerSubstation_Info") { curDevice.proInit(parentobj.BelongYear); } else if (curDevice.GetClassName() == "PSPDEV") { curDevice.strCon = ",psp_elcdevice where psp_elcdevice.devicesuid = pspdev.suid and psp_elcdevice.projectsuid = '" + strID + "' and "; curDevice.Init(); } } splitContainerControl2.Panel2.Text = node["name"].ToString(); } else { MessageBox.Show("请先选择电气计算方案!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }