public void NewView(object sender, EventArgs e) { int x = new Random().Next(0, 600); int y = new Random().Next(0, 600); Point startPoint = new Point(x, y); VMNode1 node = new VMNode1(Guid.NewGuid(), startPoint, "Node"); this.thePanal.addNode(node); }
public void AddSelectedOldView(ArrayList selectedViewList) { if ((selectedViewList != null) && (selectedViewList.Count != 0)) { for (int i = 0; i < selectedViewList.Count; i++) { DEView view = (DEView)selectedViewList[i]; ArrayList list = new ArrayList(); list.AddRange(this.dataDoc.nodeList); for (int j = 0; j < list.Count; j++) { VMNode1 node = (VMNode1)list[j]; Guid guid2 = new Guid(view.GetName()); if (guid2.Equals(node.OID)) { MessageBox.Show("视图“" + view.Label + "”在视图模型中已经存在,不用再添加了!", "添加原有视图", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); selectedViewList.RemoveAt(i); i--; list.RemoveAt(j); j--; break; } } } if ((selectedViewList != null) && (selectedViewList.Count != 0)) { foreach (DEView view2 in selectedViewList) { Guid oID = new Guid(view2.GetName()); int x = new Random().Next(0, 500); int y = new Random().Next(0, 400); Point startPoint = new Point(x, y); VMNode1 node2 = new VMNode1(oID, startPoint, view2.Label); this.AddOldNode(node2); } PLViewModel model = new PLViewModel(); try { this.dataDoc.TheDataSet = model.FillOldViewInfoToDataSet(this.dataDoc.TheDataSet, selectedViewList); } catch (Exception) { throw new ViewException("添加原有视图失败!"); } } } }
private void AddOldNode(VMNode1 node) { this.dataDoc.AddSelectedOldNode(node); }
public void addNode(VMNode1 node) { this.dataDoc.AddNode(node); }
private void VMView_MouseUp(object sender, MouseEventArgs e) { this.mousePosition = new Point(e.X, e.Y); if (e.Button == MouseButtons.Left) { this.isCaptured = false; if (this.wantLine) { this.endShape = this.inShape(this.mousePosition); if (((this.endShape != null) && !(this.endShape is VMText1)) && (this.startShape != this.endShape)) { ErrorDetective1 detective = new ErrorDetective1(this.dataDoc, this.startShape, this.endShape); if (detective.ErrorFree()) { VMLine1 line = new VMLine1(Guid.NewGuid(), this.startShape, this.endShape); this.addLine(line); } else { MessageBox.Show("逻辑错误!!!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand); } this.startShape = null; this.endShape = null; } this.wantLine = false; this.moveBase = this.mousePosition; } else if (this.RecFlag) { VMNode1 node = new VMNode1(Guid.NewGuid(), this.mousePosition); if (this.selectedShape != null) { this.selectedShape.isSelected = false; } this.selectedShape = node; this.addNode(node); this.RecFlag = false; this.mainWindow.controlTBButton(TagForViewWork.TOOLBAR_REC); this.moveBase = this.mousePosition; } else if (this.breakLine && (this.turningPosition != -2)) { this.addPoint(this.turningPosition, this.mousePosition); this.breakLine = false; this.turningPosition = -2; this.moveBase = this.mousePosition; } else if (this.wantMulSelect) { Rectangle rec = this.createRec(this.moveBase, this.mousePosition); this.multiSelected = this.getMulSelect(rec); this.setMulSelectSymbol(); if (this.multiSelected.Count == 1) { this.selectedShape = (VMNode1)this.multiSelected[0]; this.multiSelected.RemoveAt(0); } this.wantMulSelect = false; this.moveBase = this.mousePosition; this.mulSelRec = this.createRec(this.moveBase, this.mousePosition); } } this.wantMovePoint = -1; this.Refresh(); }