internal void AddOneProcess(TreeNode subNode) { if (subNode.Tag is DELProcessClass) { DELProcessClass tag = (DELProcessClass)subNode.Tag; this.lvwNavigater.Items.Add(tag.Name, subNode.ImageIndex).Tag = subNode; } else { DELProcessDefProperty property = (DELProcessDefProperty)subNode.Tag; PLUser user = new PLUser(); ListViewItem item2 = this.lvwNavigater.Items.Add(subNode.Text, subNode.ImageIndex); try { item2.SubItems.Add(user.GetUserByOid(property.CreatorID).Name); } catch (Exception) { item2.SubItems.Add(""); } item2.SubItems.Add(property.CreationDate.ToString("yyyy-MM-dd HH:mm:ss")); item2.SubItems.Add(property.UpdateDate.ToString("yyyy-MM-dd HH:mm:ss")); item2.SubItems.Add(property.Duration.ToString() + property.DurationUnit); item2.SubItems.Add(property.Description); item2.Tag = subNode; } }
private void tvwProcess_AfterSelect(object sender, TreeViewEventArgs e) { this.lvProcess.Items.Clear(); foreach (TreeNode node in e.Node.Nodes) { if (node.Tag is DELProcessClass) { DELProcessClass tag = (DELProcessClass)node.Tag; this.lvProcess.Items.Add(tag.Name, node.ImageIndex).Tag = tag; } else { DELProcessDefProperty property = (DELProcessDefProperty)node.Tag; ListViewItem item2 = this.lvProcess.Items.Add(property.Name, node.SelectedImageIndex); item2.SubItems.Add(property.UpdateDate.ToString("yyyy-MM-dd HH:mm:ss")); item2.Tag = property; } } }
private void lvwNavigator_DragDrop(object sender, DragEventArgs e) { bool flag = false; bool flag2 = false; IEnumerator enumerator = ((CLCopyData)e.Data.GetData(typeof(CLCopyData))).GetEnumerator(); Point p = new Point(e.X, e.Y); p = base.PointToClient(p); ListViewItem itemAt = this.lvwNavigater.GetItemAt(p.X, p.Y); if (itemAt != null) { TreeNode tag = (TreeNode)itemAt.Tag; while (enumerator.MoveNext()) { TreeNode current = (TreeNode)enumerator.Current; this.frmMain.setTheDragingNode(current); if (this.frmMain.getTheDragingNode().Parent == tag) { break; } if (this.frmMain.getTheCuttingNode() == current) { flag2 = true; } BPMProcessor processor2 = new BPMProcessor(); TreeNode parent = this.frmMain.getTheDragingNode().Parent; DELProcessDefProperty proDef = this.frmMain.getTheDragingNode().Tag as DELProcessDefProperty; if (tag == TagForTiModeler.TreeNode_BPM) { DELProcessClass class5 = parent.Tag as DELProcessClass; if (processor2.MoveProcessBetweenClass(proDef.ID, class5.ID, Guid.Empty)) { class5.RemoveProcess(proDef.ID); parent.Nodes.Remove(this.frmMain.getTheDragingNode()); int index = this.frmMain.FindPosition(TagForTiModeler.TreeNode_BPM, proDef); TagForTiModeler.TreeNode_BPM.Nodes.Insert(index, this.frmMain.getTheDragingNode()); flag = true; } } else { if ((tag.Parent == TagForTiModeler.TreeNode_BPM) && !(tag.Tag is DELProcessClass)) { DELProcessClass class6 = parent.Tag as DELProcessClass; if (processor2.MoveProcessBetweenClass(proDef.ID, class6.ID, Guid.Empty)) { class6.RemoveProcess(proDef.ID); parent.Nodes.Remove(this.frmMain.getTheDragingNode()); int num5 = this.frmMain.FindPosition(TagForTiModeler.TreeNode_BPM, proDef); TagForTiModeler.TreeNode_BPM.Nodes.Insert(num5, this.frmMain.getTheDragingNode()); flag = true; } continue; } if (tag.Tag is DELProcessClass) { DELProcessClass class7 = tag.Tag as DELProcessClass; if (parent == TagForTiModeler.TreeNode_BPM) { if (processor2.MoveProcessBetweenClass(proDef.ID, Guid.Empty, class7.ID)) { parent.Nodes.Remove(this.frmMain.getTheDragingNode()); int num6 = this.frmMain.FindPosition(tag, proDef); tag.Nodes.Insert(num6, this.frmMain.getTheDragingNode()); class7.AddProcess(proDef.ID); flag = true; } } else { DELProcessClass class8 = parent.Tag as DELProcessClass; if (processor2.MoveProcessBetweenClass(proDef.ID, class8.ID, class7.ID)) { parent.Nodes.Remove(this.frmMain.getTheDragingNode()); class8.RemoveProcess(proDef.ID); int num7 = this.frmMain.FindPosition(tag, proDef); tag.Nodes.Insert(num7, this.frmMain.getTheDragingNode()); class7.AddProcess(proDef.ID); flag = true; } } continue; } if (tag.Parent.Tag is DELProcessClass) { DELProcessClass class9 = tag.Parent.Tag as DELProcessClass; if (parent == TagForTiModeler.TreeNode_BPM) { if (processor2.MoveProcessBetweenClass(proDef.ID, Guid.Empty, class9.ID)) { parent.Nodes.Remove(this.frmMain.getTheDragingNode()); int num8 = this.frmMain.FindPosition(tag.Parent, proDef); tag.Parent.Nodes.Insert(num8, this.frmMain.getTheDragingNode()); class9.AddProcess(proDef.ID); flag = true; } continue; } DELProcessClass class10 = parent.Tag as DELProcessClass; if (processor2.MoveProcessBetweenClass(proDef.ID, class10.ID, class9.ID)) { parent.Nodes.Remove(this.frmMain.getTheDragingNode()); class10.RemoveProcess(proDef.ID); int num9 = this.frmMain.FindPosition(tag.Parent, proDef); tag.Parent.Nodes.Insert(num9, this.frmMain.getTheDragingNode()); class9.AddProcess(proDef.ID); flag = true; } } } } } else if ((this.frmMain.frmBPNavigator != null) && !this.frmMain.frmBPNavigator.IsDisposed) { while (enumerator.MoveNext()) { TreeNode aNode = (TreeNode)enumerator.Current; this.frmMain.setTheDragingNode(aNode); if (this.frmMain.getTheDragingNode().Parent == this.frmMain.getopenedDELProcessClass()) { break; } if (this.frmMain.getTheCuttingNode() == aNode) { flag2 = true; } BPMProcessor processor = new BPMProcessor(); TreeNode node2 = this.frmMain.getTheDragingNode().Parent; DELProcessDefProperty property = this.frmMain.getTheDragingNode().Tag as DELProcessDefProperty; if (this.frmMain.getopenedDELProcessClass() == TagForTiModeler.TreeNode_BPM) { DELProcessClass class2 = node2.Tag as DELProcessClass; if (processor.MoveProcessBetweenClass(property.ID, class2.ID, Guid.Empty)) { class2.RemoveProcess(property.ID); node2.Nodes.Remove(this.frmMain.getTheDragingNode()); int num = this.frmMain.FindPosition(TagForTiModeler.TreeNode_BPM, property); TagForTiModeler.TreeNode_BPM.Nodes.Insert(num, this.frmMain.getTheDragingNode()); flag = true; } } else if (this.frmMain.getopenedDELProcessClass().Tag is DELProcessClass) { DELProcessClass class3 = this.frmMain.getopenedDELProcessClass().Tag as DELProcessClass; if (node2 == TagForTiModeler.TreeNode_BPM) { if (processor.MoveProcessBetweenClass(property.ID, Guid.Empty, class3.ID)) { node2.Nodes.Remove(this.frmMain.getTheDragingNode()); int num2 = this.frmMain.FindPosition(this.frmMain.getopenedDELProcessClass(), property); this.frmMain.getopenedDELProcessClass().Nodes.Insert(num2, this.frmMain.getTheDragingNode()); class3.AddProcess(property.ID); flag = true; } continue; } DELProcessClass class4 = node2.Tag as DELProcessClass; if (processor.MoveProcessBetweenClass(property.ID, class4.ID, class3.ID)) { node2.Nodes.Remove(this.frmMain.getTheDragingNode()); class4.RemoveProcess(property.ID); int num3 = this.frmMain.FindPosition(this.frmMain.getopenedDELProcessClass(), property); this.frmMain.getopenedDELProcessClass().Nodes.Insert(num3, this.frmMain.getTheDragingNode()); class3.AddProcess(property.ID); flag = true; } } } } if (flag2) { this.frmMain.setTheCuttingNode(null); } this.frmMain.tvwNavigator.SelectedNode = this.frmMain.getTheDragingNode(); if (flag) { this.frmMain.frmBPNavigator.UpdateListView(this.frmMain.getTheDragingNode().Parent); } }
private void lvwNavigater_AfterLabelEdit(object sender, LabelEditEventArgs e) { TreeNode tag = (TreeNode)this.lvwNavigater.Items[e.Item].Tag; string str = tag.Text.Trim(); if (e.Label != null) { str = e.Label.Trim(); } if ((str.Length == 0) || (str.Length > 0x20)) { MessageBox.Show("过程分类名称长度必须为1到32之间。", ConstCommon.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); e.CancelEdit = true; } foreach (TreeNode node2 in this.frmMain.TheProClsNodeList.Values) { DELProcessClass class2 = node2.Tag as DELProcessClass; if ((str.ToUpper() == class2.Name.ToUpper()) && (tag != node2)) { MessageBox.Show("已存在重名的过程分类。", ConstCommon.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); e.CancelEdit = true; } } if (!e.CancelEdit) { tag.Text = str; } else { this.lvwNavigater.LabelEdit = true; this.lvwNavigater.SelectedItems[0].BeginEdit(); return; } DELProcessClass processClass = tag.Tag as DELProcessClass; processClass.Name = str; BPMProcessor processor = new BPMProcessor(); try { if (!processor.ModifyOneProcessClass(processClass)) { MessageBox.Show("过程分类重命名失败!"); processClass.Name = tag.Text; e.CancelEdit = true; return; } } catch (Exception) { MessageBox.Show("过程分类重命名失败!"); processClass.Name = tag.Text; e.CancelEdit = true; return; } int index = this.frmMain.FindPosition(processClass); if (tag.Index != index) { TagForTiModeler.TreeNode_BPM.Nodes.Remove(tag); TagForTiModeler.TreeNode_BPM.Nodes.Insert(index, tag); } e.CancelEdit = true; this.lvwNavigater.LabelEdit = false; Cursor.Current = Cursors.Default; this.frmMain.ShowProcessPropertyList(); if ((this.frmMain.frmBPNavigator != null) && !this.frmMain.frmBPNavigator.IsDisposed) { this.frmMain.frmBPNavigator.UpdateListView(); } }