internal void fireItemPasted(ChartObject item) { switch (item.getType()) { case ItemType.Box: if (BoxPasted != null) { Box box = item as Box; BoxEventArgs args = new BoxEventArgs(box); BoxPasted(this, args); } break; case ItemType.ControlHost: if (ControlHostPasted != null) { ControlHost host = item as ControlHost; ControlHostEventArgs args = new ControlHostEventArgs(host); ControlHostPasted(this, args); } break; case ItemType.Table: if (TablePasted != null) { Table table = item as Table; TableEventArgs args = new TableEventArgs(table); TablePasted(this, args); } break; case ItemType.Arrow: if (ArrowPasted != null) { Arrow arrow = item as Arrow; ArrowEventArgs args = new ArrowEventArgs(arrow); ArrowPasted(this, args); } break; } }
private void flowChart1_ArrowDeleted(object sender, ArrowEventArgs e) { flowChart1_Click(this.propertyGrid1, new EventArgs()); }
internal void raiseInitEvent(ChartObject item) { switch (item.getType()) { case ItemType.Box: if (InitializeBox != null) { BoxEventArgs args = new BoxEventArgs(item as Box); InitializeBox(this, args); } break; case ItemType.ControlHost: if (InitializeControlHost != null) { ControlHostEventArgs args = new ControlHostEventArgs(item as ControlHost); InitializeControlHost(this, args); } break; case ItemType.Table: if (InitializeTable != null) { TableEventArgs args = new TableEventArgs(item as Table); InitializeTable(this, args); } break; case ItemType.Arrow: if (InitializeArrow != null) { ArrowEventArgs args = new ArrowEventArgs(item as Arrow); InitializeArrow(this, args); } break; } }
private void fcFlowChart_ArrowCreated(object sender, ArrowEventArgs e) { tempArrowKey++; String newLinkTag = "A_" + tempArrowKey.ToString(CultureInfo.InvariantCulture); e.Arrow.Text = newLinkTag; GraphicNode origin = null; GraphicNode destination = null; ModelNode modelOrigin = null; ModelNode modelDestination = null; String originPort = ""; String destinationPort = ""; Int16 originPortID = -1; Int16 destinationPortID = -1; List<SysCAD.Protocol.Point> controlPoints; SysCAD.Protocol.Rectangle textArea; if (newDestinationBox != null) { if (!((state.ClientProtocol.graphic.Nodes.TryGetValue((newDestinationBox.Tag as EditorNode).Guid, out destination)) && (state.ClientProtocol.model.Nodes.TryGetValue(destination.ModelGuid, out modelDestination)))) { state.ClientProtocol.LogMessage(out requestId, "Node missing for destination Box " + newDestinationBox.Tag, SysCAD.Log.MessageType.Error); return; } if (newDestinationAnchor != -1) { String fullAnchor = (newDestinationBox.Tag as EditorNode).anchorIntToTag[newDestinationAnchor]; String anchorName = fullAnchor.TrimEnd(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }); Int16 anchorID = Convert.ToInt16(fullAnchor.Substring(anchorName.Length), CultureInfo.InvariantCulture); destinationPort = anchorName; destinationPortID = anchorID; } } if (oldOriginBox != null) { if (!((state.ClientProtocol.graphic.Nodes.TryGetValue((newOriginBox.Tag as EditorNode).Guid, out origin)) && (state.ClientProtocol.model.Nodes.TryGetValue(origin.ModelGuid, out modelOrigin)))) { state.ClientProtocol.LogMessage(out requestId, "Node missing for origin Box " + newDestinationBox.Tag, SysCAD.Log.MessageType.Error); return; } if (oldOriginAnchor != -1) { String fullAnchor = (oldOriginBox.Tag as EditorNode).anchorIntToTag[oldOriginAnchor]; String anchorName = fullAnchor.TrimEnd(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }); Int16 anchorID = Convert.ToInt16(fullAnchor.Substring(anchorName.Length), CultureInfo.InvariantCulture); originPort = anchorName; originPortID = anchorID; } } controlPoints = State.GetControlPoints(e.Arrow.ControlPoints); textArea = new SysCAD.Protocol.Rectangle(0.0, 0.0, 0.0, 0.0); fcFlowChart.DeleteObject(e.Arrow); form1.ToolStripStatusLabel.Text = ""; //arrowBeingModified.CustomDraw = CustomDraw.None; arrowBeingModifiedSelectionHandle = -1; arrowBeingModified = null; originAnchorChosen = null; destinationAnchorChosen = null; ModelLink modelLink = new ModelLink(new Guid(), string.Empty, "Pipe-1", modelOrigin.Guid, modelDestination.Guid, originPort, destinationPort); GraphicLink graphicLink = new GraphicLink(new Guid(), modelLink.Guid, string.Empty, origin.Guid, originPortID, destination.Guid, destinationPortID, controlPoints, 1.0, textArea, 0.0, new SysCAD.Protocol.Font(), true); SysCAD.Protocol.Action action = new SysCAD.Protocol.Action(); action.Create.Add(modelLink); action.Create.Add(graphicLink); AddAction(action); }