private ConnectorEditor GetConnectorEditor(Point editPoint, System.Workflow.ComponentModel.Design.HitTestInfo messageContext) { Connector connectorEdited = null; ISelectionService service = base.GetService(typeof(ISelectionService)) as ISelectionService; if (service != null) { Connector connectorFromSelectedObject = Connector.GetConnectorFromSelectedObject(service.PrimarySelection); if (((connectorFromSelectedObject != null) && connectorFromSelectedObject.ParentDesigner.EnableUserDrawnConnectors) && new ConnectorEditor(connectorFromSelectedObject).HitTest(editPoint)) { connectorEdited = connectorFromSelectedObject; } } if (connectorEdited == null) { ConnectionPointHitTestInfo info = messageContext as ConnectionPointHitTestInfo; if ((info != null) && (info.ConnectionPoint != null)) { FreeformActivityDesigner connectorContainer = GetConnectorContainer(info.AssociatedDesigner); if ((connectorContainer != null) && connectorContainer.EnableUserDrawnConnectors) { connectorEdited = connectorContainer.CreateConnector(info.ConnectionPoint, info.ConnectionPoint); } } } if (connectorEdited == null) { return(null); } return(new ConnectorEditor(connectorEdited)); }
private static ConnectionPoint[] GetHighlightableConnectionPoints(Point currentPoint, ActivityDesigner activityDesigner) { List <ConnectionPoint> list = new List <ConnectionPoint>(); List <ActivityDesigner> list2 = new List <ActivityDesigner>(); FreeformActivityDesigner designer = activityDesigner as FreeformActivityDesigner; if (designer != null) { list2.AddRange(designer.ContainedDesigners); } list2.Add(activityDesigner); foreach (ActivityDesigner designer2 in list2) { bool flag = designer2.Bounds.Contains(currentPoint); ReadOnlyCollection <ConnectionPoint> connectionPoints = designer2.GetConnectionPoints(DesignerEdges.All); if (!flag) { foreach (ConnectionPoint point in connectionPoints) { if (point.Bounds.Contains(currentPoint)) { flag = true; break; } } } if (flag) { list.AddRange(connectionPoints); } } return(list.ToArray()); }
protected override void OnContainedActivitiesChanging(ActivityCollectionChangeEventArgs listChangeArgs) { base.OnContainedActivitiesChanging(listChangeArgs); if (listChangeArgs.Action == ActivityCollectionChangeAction.Remove) { FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(this); List <Connector> list = new List <Connector>(); for (ActivityDesigner designer2 = this; designer2 != null; designer2 = designer2.ParentDesigner) { FreeformActivityDesigner designer3 = designer2 as FreeformActivityDesigner; if ((designer3 != null) && (designer3.Connectors.Count > 0)) { foreach (Activity activity in listChangeArgs.RemovedItems) { ActivityDesigner designer = ActivityDesigner.GetDesigner(activity); if (!connectorContainer.MovingActivities.Contains(designer)) { foreach (Connector connector in designer3.Connectors) { if ((designer == connector.Source.AssociatedDesigner) || (designer == connector.Target.AssociatedDesigner)) { list.Add(connector); } } } } } } foreach (Connector connector2 in list) { connector2.ParentDesigner.RemoveConnector(connector2); ((IDisposable)connector2).Dispose(); } } }
protected override bool OnMouseMove(MouseEventArgs eventArgs) { Point empty = Point.Empty; WorkflowView parentView = base.ParentView; Point clientPoint = new Point(eventArgs.X, eventArgs.Y); if ((parentView != null) && parentView.IsClientPointInActiveLayout(clientPoint)) { Point editPoint = parentView.ClientPointToLogical(clientPoint); if ((eventArgs.Button & MouseButtons.Left) == MouseButtons.Left) { if ((!this.EditingInProgress && this.initialDragPoint.HasValue) && ((Math.Abs((int)(this.initialDragPoint.Value.X - editPoint.X)) > SystemInformation.DragSize.Width) || (Math.Abs((int)(this.initialDragPoint.Value.Y - editPoint.Y)) > SystemInformation.DragSize.Height))) { ConnectorEditor connectorEditor = this.GetConnectorEditor(this.initialDragPoint.Value, this.dragPointHitInfo); this.BeginEditing(connectorEditor, this.initialDragPoint.Value); } if (this.EditingInProgress) { this.ContinueEditing(editPoint); if (this.SnappedConnectionPoint != null) { editPoint = this.SnappedConnectionPoint.Location; } } } else { FreeformActivityDesigner connectorContainer = GetConnectorContainer(base.MessageHitTestContext.AssociatedDesigner); this.ConnectablePoints = ((connectorContainer != null) && connectorContainer.EnableUserDrawnConnectors) ? GetHighlightableConnectionPoints(editPoint, base.MessageHitTestContext.AssociatedDesigner) : null; } empty = editPoint; } return(this.EditingInProgress | this.UpdateCursor(new Point?(empty))); }
protected internal override PropertyInfo[] GetProperties(WorkflowMarkupSerializationManager serializationManager, object obj) { if (serializationManager == null) { throw new ArgumentNullException("serializationManager"); } if (obj == null) { throw new ArgumentNullException("obj"); } XmlWriter writer = serializationManager.WorkflowMarkupStack[typeof(XmlWriter)] as XmlWriter; PropertyInfo[] properties = base.GetProperties(serializationManager, obj); FreeformActivityDesigner designer = obj as FreeformActivityDesigner; if (designer == null) { return(properties); } List <PropertyInfo> list = new List <PropertyInfo>(); foreach (PropertyInfo info in properties) { if (((writer == null) || !info.Name.Equals("AutoSizeMargin", StringComparison.Ordinal)) || (designer.AutoSizeMargin != FreeformActivityDesigner.DefaultAutoSizeMargin)) { list.Add(info); } } list.Add(typeof(FreeformActivityDesigner).GetProperty("DesignerConnectors", BindingFlags.NonPublic | BindingFlags.Instance)); return(list.ToArray()); }
public override void MoveActivities(System.Workflow.ComponentModel.Design.HitTestInfo moveLocation, ReadOnlyCollection <Activity> activitiesToMove) { if (moveLocation == null) { throw new ArgumentNullException("moveLocation"); } if (activitiesToMove == null) { throw new ArgumentNullException("activitiesToMove"); } FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(this); try { connectorContainer.MovingActivities.Clear(); if ((connectorContainer != null) && (connectorContainer.Connectors.Count > 0)) { foreach (Activity activity in activitiesToMove) { ActivityDesigner designer = ActivityDesigner.GetDesigner(activity); if (ConnectionManager.GetConnectorContainer(designer) == connectorContainer) { connectorContainer.MovingActivities.Add(designer); } } } base.MoveActivities(moveLocation, activitiesToMove); } finally { connectorContainer.MovingActivities.Clear(); } }
private bool CanBeginEditing(Point editPoint, HitTestInfo messageContext) { ISelectionService selectionService = GetService(typeof(ISelectionService)) as ISelectionService; if (selectionService != null) { Connector selectedConnector = Connector.GetConnectorFromSelectedObject(selectionService.PrimarySelection); if (selectedConnector != null && selectedConnector.ParentDesigner.EnableUserDrawnConnectors && new ConnectorEditor(selectedConnector).HitTest(editPoint)) { return(true); } } ConnectionPointHitTestInfo connectionPointHitTestInfo = messageContext as ConnectionPointHitTestInfo; if (connectionPointHitTestInfo != null && connectionPointHitTestInfo.ConnectionPoint != null) { FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(connectionPointHitTestInfo.AssociatedDesigner); if (connectorContainer != null && connectorContainer.EnableUserDrawnConnectors) { return(true); } } return(false); }
private ConnectorEditor GetConnectorEditor(Point editPoint, HitTestInfo messageContext) { Connector connector = null; //First check if we are editing a existing selected connector ISelectionService selectionService = GetService(typeof(ISelectionService)) as ISelectionService; if (selectionService != null) { Connector selectedConnector = Connector.GetConnectorFromSelectedObject(selectionService.PrimarySelection); if (selectedConnector != null && selectedConnector.ParentDesigner.EnableUserDrawnConnectors && new ConnectorEditor(selectedConnector).HitTest(editPoint)) { connector = selectedConnector; } } //Then check if the hit is on a ConnectionPoint for drawing new connectors if (connector == null) { ConnectionPointHitTestInfo connectionPointHitTestInfo = messageContext as ConnectionPointHitTestInfo; if (connectionPointHitTestInfo != null && connectionPointHitTestInfo.ConnectionPoint != null) { FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(connectionPointHitTestInfo.AssociatedDesigner); if (connectorContainer != null && connectorContainer.EnableUserDrawnConnectors) { connector = connectorContainer.CreateConnector(connectionPointHitTestInfo.ConnectionPoint, connectionPointHitTestInfo.ConnectionPoint); } } } return((connector != null) ? new ConnectorEditor(connector) : null); }
protected override bool OnPaint(PaintEventArgs e, Rectangle viewPort, AmbientTheme ambientTheme) { //Draw the selected connectors at top of the z level Connector selectedConnector = null; ISelectionService selectionService = GetService(typeof(ISelectionService)) as ISelectionService; foreach (object selectedComponents in selectionService.GetSelectedComponents()) { Connector connector = Connector.GetConnectorFromSelectedObject(selectedComponents); if (connector != null) { connector.OnPaintSelected(new ActivityDesignerPaintEventArgs(e.Graphics, connector.ParentDesigner.Bounds, viewPort, connector.ParentDesigner.DesignerTheme), (selectedComponents == selectionService.PrimarySelection), new Point[] { }); if (selectedComponents == selectionService.PrimarySelection) { selectedConnector = connector; } } } //Draw selected connector adorned with the edit points if (selectedConnector != null) { ConnectorEditor editableConnector = new ConnectorEditor(selectedConnector); editableConnector.OnPaint(new ActivityDesignerPaintEventArgs(e.Graphics, selectedConnector.ParentDesigner.Bounds, viewPort, selectedConnector.ParentDesigner.DesignerTheme), true, true); } //If editing is in progress then draw the connector being edited if (EditingInProgress) { FreeformActivityDesigner designer = (this.connectorEditor.EditedConnector.ParentDesigner != null) ? this.connectorEditor.EditedConnector.ParentDesigner : ConnectionManager.GetConnectorContainer(this.connectorEditor.EditedConnector.Source.AssociatedDesigner); this.connectorEditor.OnPaint(new ActivityDesignerPaintEventArgs(e.Graphics, designer.Bounds, viewPort, designer.DesignerTheme), false, false); } return(false); }
protected override bool OnPaint(PaintEventArgs e, Rectangle viewPort, AmbientTheme ambientTheme) { Connector connectorEdited = null; ISelectionService service = base.GetService(typeof(ISelectionService)) as ISelectionService; foreach (object obj2 in service.GetSelectedComponents()) { Connector connectorFromSelectedObject = Connector.GetConnectorFromSelectedObject(obj2); if (connectorFromSelectedObject != null) { connectorFromSelectedObject.OnPaintSelected(new ActivityDesignerPaintEventArgs(e.Graphics, connectorFromSelectedObject.ParentDesigner.Bounds, viewPort, connectorFromSelectedObject.ParentDesigner.DesignerTheme), obj2 == service.PrimarySelection, new Point[0]); if (obj2 == service.PrimarySelection) { connectorEdited = connectorFromSelectedObject; } } } if (connectorEdited != null) { new ConnectorEditor(connectorEdited).OnPaint(new ActivityDesignerPaintEventArgs(e.Graphics, connectorEdited.ParentDesigner.Bounds, viewPort, connectorEdited.ParentDesigner.DesignerTheme), true, true); } if (this.EditingInProgress) { FreeformActivityDesigner designer = (this.connectorEditor.EditedConnector.ParentDesigner != null) ? this.connectorEditor.EditedConnector.ParentDesigner : GetConnectorContainer(this.connectorEditor.EditedConnector.Source.AssociatedDesigner); this.connectorEditor.OnPaint(new ActivityDesignerPaintEventArgs(e.Graphics, designer.Bounds, viewPort, designer.DesignerTheme), false, false); } return(false); }
private static ConnectionPoint[] GetSnappableConnectionPoints(Point currentPoint, ConnectionPoint sourceConnectionPoint, ConnectionPoint activeConnectionPoint, ActivityDesigner activityDesigner, out ConnectionPoint snappedConnectionPoint) { snappedConnectionPoint = null; List <ConnectionPoint> list = new List <ConnectionPoint>(); FreeformActivityDesigner connectorContainer = GetConnectorContainer(activeConnectionPoint.AssociatedDesigner); if (connectorContainer != null) { FreeformActivityDesigner designer2 = activityDesigner as FreeformActivityDesigner; List <ActivityDesigner> list2 = new List <ActivityDesigner> { activityDesigner }; if (designer2 != null) { list2.AddRange(designer2.ContainedDesigners); } double num = 20.0; foreach (ActivityDesigner designer3 in list2) { if (GetConnectorContainer(designer3) == connectorContainer) { bool flag = false; List <ConnectionPoint> collection = new List <ConnectionPoint>(); foreach (ConnectionPoint point in designer3.GetConnectionPoints(DesignerEdges.All)) { if (!point.Equals(activeConnectionPoint) && connectorContainer.CanConnectContainedDesigners(sourceConnectionPoint, point)) { collection.Add(point); double num2 = DesignerGeometryHelper.DistanceFromPointToRectangle(currentPoint, point.Bounds); if (num2 <= 20.0) { flag = true; if (num2 < num) { snappedConnectionPoint = point; num = num2; } } } } if (flag) { list.AddRange(collection); } } } if (snappedConnectionPoint != null) { foreach (ConnectionPoint point2 in snappedConnectionPoint.AssociatedDesigner.GetConnectionPoints(DesignerEdges.All)) { if (!list.Contains(point2)) { list.Add(point2); } } } } return(list.ToArray()); }
protected override object CreateInstance(WorkflowMarkupSerializationManager serializationManager, Type type) { if (serializationManager == null) { throw new ArgumentNullException("serializationManager"); } if (type == null) { throw new ArgumentNullException("type"); } Connector connector = null; IReferenceService service = serializationManager.GetService(typeof(IReferenceService)) as IReferenceService; FreeformActivityDesigner designer = serializationManager.Context[typeof(FreeformActivityDesigner)] as FreeformActivityDesigner; if ((designer != null) && (service != null)) { ConnectionPoint source = null; ConnectionPoint target = null; try { Dictionary <string, string> connectorConstructionArguments = this.GetConnectorConstructionArguments(serializationManager, type); if ((connectorConstructionArguments.ContainsKey("SourceActivity") && connectorConstructionArguments.ContainsKey("SourceConnectionIndex")) && connectorConstructionArguments.ContainsKey("SourceConnectionEdge")) { ActivityDesigner associatedDesigner = ActivityDesigner.GetDesigner(service.GetReference(connectorConstructionArguments["SourceActivity"]) as Activity); DesignerEdges designerEdge = (DesignerEdges)Enum.Parse(typeof(DesignerEdges), connectorConstructionArguments["SourceConnectionEdge"]); int connectionIndex = Convert.ToInt32(connectorConstructionArguments["SourceConnectionIndex"], CultureInfo.InvariantCulture); if (((associatedDesigner != null) && (designerEdge != DesignerEdges.None)) && (connectionIndex >= 0)) { source = new ConnectionPoint(associatedDesigner, designerEdge, connectionIndex); } } if ((connectorConstructionArguments.ContainsKey("TargetActivity") && connectorConstructionArguments.ContainsKey("TargetConnectionIndex")) && connectorConstructionArguments.ContainsKey("TargetConnectionEdge")) { ActivityDesigner designer3 = ActivityDesigner.GetDesigner(service.GetReference(connectorConstructionArguments["TargetActivity"]) as Activity); DesignerEdges edges2 = (DesignerEdges)Enum.Parse(typeof(DesignerEdges), connectorConstructionArguments["TargetConnectionEdge"]); int num2 = Convert.ToInt32(connectorConstructionArguments["TargetConnectionIndex"], CultureInfo.InvariantCulture); if (((designer3 != null) && (edges2 != DesignerEdges.None)) && (num2 >= 0)) { target = new ConnectionPoint(designer3, edges2, num2); } } } catch { } if ((source != null) && (target != null)) { connector = designer.AddConnector(source, target); } } return(connector); }
private void OnZOrderStatusUpdate(object sender, EventArgs e) { ActivityDesignerVerb verb = sender as ActivityDesignerVerb; if ((verb != null) && verb.Properties.Contains(DesignerUserDataKeys.ZOrderKey)) { FreeformActivityDesigner parentDesigner = verb.ActivityDesigner.ParentDesigner as FreeformActivityDesigner; if (parentDesigner != null) { verb.Enabled = parentDesigner.CanUpdateZOrder(verb.ActivityDesigner, (ZOrder)verb.Properties[DesignerUserDataKeys.ZOrderKey]); } } }
private bool CanResizeDesigner(ActivityDesigner designer) { if (!designer.EnableVisualResizing) { return(false); } if (designer.ParentDesigner == null) { return(true); } FreeformActivityDesigner parentDesigner = designer.ParentDesigner as FreeformActivityDesigner; return((parentDesigner != null) && parentDesigner.CanResizeContainedDesigner(designer)); }
internal void SetParent(FreeformActivityDesigner parentDesigner) { WorkflowView parentView = this.ParentView; if ((this.parentDesigner != null) && (parentView != null)) { parentView.InvalidateLogicalRectangle(this.parentDesigner.Bounds); } this.parentDesigner = parentDesigner; if ((this.parentDesigner != null) && (parentView != null)) { parentView.InvalidateLogicalRectangle(this.parentDesigner.Bounds); } }
internal static Connector GetConnectorFromSelectedObject(object selectedObject) { Connector connector = null; ConnectorHitTestInfo info = selectedObject as ConnectorHitTestInfo; if (info != null) { FreeformActivityDesigner associatedDesigner = info.AssociatedDesigner as FreeformActivityDesigner; int num = info.MapToIndex(); if (((associatedDesigner != null) && (num >= 0)) && (num < associatedDesigner.Connectors.Count)) { connector = associatedDesigner.Connectors[num]; } } return(connector); }
public void SetSize(Activity activity, Size size) { ActivityDesigner designer = ActivityDesigner.GetDesigner(activity); if (designer != null) { FreeformActivityDesigner designer2 = (designer.ParentDesigner != null) ? (designer.ParentDesigner as FreeformActivityDesigner) : (designer as FreeformActivityDesigner); if (designer2 != null) { designer.Size = size; if (designer2.AutoSize) { designer2.PerformLayout(); } } } }
public void SetLocation(Activity activity, Point location) { ActivityDesigner designer = ActivityDesigner.GetDesigner(activity); if (designer != null) { FreeformActivityDesigner designer2 = (designer.ParentDesigner != null) ? (designer.ParentDesigner as FreeformActivityDesigner) : (designer as FreeformActivityDesigner); if (designer2 != null) { designer.Location = location; if (designer2.AutoSize) { designer2.PerformLayout(); } } } }
protected override bool OnMouseMove(MouseEventArgs eventArgs) { Point cursorPoint = Point.Empty; WorkflowView workflowView = ParentView; Point clientPoint = new Point(eventArgs.X, eventArgs.Y); if (workflowView != null && workflowView.IsClientPointInActiveLayout(clientPoint)) { Point logicalPoint = workflowView.ClientPointToLogical(clientPoint); if ((eventArgs.Button & MouseButtons.Left) == MouseButtons.Left) { //Check if we can start editing a connector if (!EditingInProgress && this.initialDragPoint != null && (Math.Abs(this.initialDragPoint.Value.X - logicalPoint.X) > SystemInformation.DragSize.Width || Math.Abs(this.initialDragPoint.Value.Y - logicalPoint.Y) > SystemInformation.DragSize.Height)) { BeginEditing(GetConnectorEditor(this.initialDragPoint.Value, this.dragPointHitInfo), this.initialDragPoint.Value); } //If the editing is in progress then pump the messages to the edited connector if (EditingInProgress) { ContinueEditing(logicalPoint); if (SnappedConnectionPoint != null) { logicalPoint = SnappedConnectionPoint.Location; } } } else { //Show the points from where we can start drawing connectors FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(MessageHitTestContext.AssociatedDesigner); ConnectablePoints = (connectorContainer != null && connectorContainer.EnableUserDrawnConnectors) ? GetHighlightableConnectionPoints(logicalPoint, MessageHitTestContext.AssociatedDesigner) : null; } cursorPoint = logicalPoint; } bool processedMessage = EditingInProgress; processedMessage |= UpdateCursor(cursorPoint); return(processedMessage); }
protected override bool OnMouseEnter(MouseEventArgs eventArgs) { Point empty = Point.Empty; Point clientPoint = new Point(eventArgs.X, eventArgs.Y); WorkflowView parentView = base.ParentView; if (((parentView != null) && parentView.IsClientPointInActiveLayout(clientPoint)) && !this.EditingInProgress) { FreeformActivityDesigner connectorContainer = GetConnectorContainer(base.MessageHitTestContext.AssociatedDesigner); if ((connectorContainer != null) && connectorContainer.EnableUserDrawnConnectors) { Point currentPoint = parentView.ClientPointToLogical(clientPoint); this.ConnectablePoints = GetHighlightableConnectionPoints(currentPoint, base.MessageHitTestContext.AssociatedDesigner); empty = currentPoint; } } return(this.UpdateCursor(new Point?(empty))); }
public Connector AddConnector(ConnectionPoint source, ConnectionPoint target) { if (source == null) { throw new ArgumentNullException("source"); } if (source.AssociatedDesigner == null) { throw new ArgumentException("source", SR.GetString("Error_AssociatedDesignerMissing")); } if (target == null) { throw new ArgumentNullException("target"); } if (target.AssociatedDesigner == null) { throw new ArgumentException("target", SR.GetString("Error_AssociatedDesignerMissing")); } FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(source.AssociatedDesigner); if (this != connectorContainer) { throw new InvalidOperationException(DR.GetString("Error_AddConnector1", new object[0])); } if (((base.Activity != source.AssociatedDesigner.Activity) && !Helpers.IsChildActivity(base.Activity as CompositeActivity, source.AssociatedDesigner.Activity)) || ((base.Activity != target.AssociatedDesigner.Activity) && !Helpers.IsChildActivity(base.Activity as CompositeActivity, target.AssociatedDesigner.Activity))) { throw new ArgumentException(DR.GetString("Error_AddConnector2", new object[0])); } Connector item = this.CreateConnector(source, target); if (item != null) { if (this.connectors.Contains(item)) { throw new InvalidOperationException(DR.GetString("Error_AddConnector3", new object[0])); } this.connectors.Add(item); item.SetParent(this); this.OnConnectorAdded(new ConnectorEventArgs(item)); } base.PerformLayout(); return(item); }
internal override void OnPaintContainedDesigners(ActivityDesignerPaintEventArgs e) { if (this.ShowConnectorsInForeground) { base.OnPaintContainedDesigners(e); } FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(this); if (((connectorContainer != null) && (base.Activity != null)) && (base.Activity.Site != null)) { Region region = null; Region clip = e.Graphics.Clip; try { if (clip != null) { region = new Region(connectorContainer.Bounds); region.Intersect(e.ViewPort); e.Graphics.Clip = region; } foreach (Connector connector in connectorContainer.Connectors) { if (this == connector.RenderingOwner) { connector.OnPaint(e); } } } finally { if (clip != null) { e.Graphics.Clip = clip; region.Dispose(); } } } if (!this.ShowConnectorsInForeground) { base.OnPaintContainedDesigners(e); } }
internal static FreeformActivityDesigner GetConnectorContainer(ActivityDesigner associatedDesigner) { FreeformActivityDesigner designer = null; if (associatedDesigner != null) { for (ActivityDesigner designer2 = associatedDesigner; designer2 != null; designer2 = designer2.ParentDesigner) { if (designer2 is FreeformActivityDesigner) { designer = designer2 as FreeformActivityDesigner; } else if (designer2 is InvokeWorkflowDesigner) { return(designer); } } } return(designer); }
private void OnZOrderChanged(object sender, EventArgs e) { ActivityDesignerVerb verb = sender as ActivityDesignerVerb; if ((verb != null) && verb.Properties.Contains(DesignerUserDataKeys.ZOrderKey)) { FreeformActivityDesigner parentDesigner = verb.ActivityDesigner.ParentDesigner as FreeformActivityDesigner; if (parentDesigner != null) { if (((ZOrder)verb.Properties[DesignerUserDataKeys.ZOrderKey]) == ZOrder.Foreground) { parentDesigner.BringToFront(verb.ActivityDesigner); } else if (((ZOrder)verb.Properties[DesignerUserDataKeys.ZOrderKey]) == ZOrder.Background) { parentDesigner.SendToBack(verb.ActivityDesigner); } } } }
public override AccessibleObject GetChild(int index) { FreeformActivityDesigner activityDesigner = (FreeformActivityDesigner)base.ActivityDesigner; if (activityDesigner.ShowConnectorsInForeground) { int num = activityDesigner.Connectors.Count; if (index < num) { return(activityDesigner.Connectors[index].AccessibilityObject); } return(activityDesigner.ContainedDesigners[index - num].AccessibilityObject); } int count = activityDesigner.ContainedDesigners.Count; if (index < count) { return(activityDesigner.ContainedDesigners[index].AccessibilityObject); } return(activityDesigner.Connectors[index - count].AccessibilityObject); }
protected override bool OnMouseEnter(MouseEventArgs eventArgs) { Point cursorPoint = Point.Empty; Point clientPoint = new Point(eventArgs.X, eventArgs.Y); WorkflowView workflowView = ParentView; if (workflowView != null && workflowView.IsClientPointInActiveLayout(clientPoint) && !EditingInProgress) { //Highlight the connection points to indicate where user can start drawing connectors FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(MessageHitTestContext.AssociatedDesigner); if (connectorContainer != null && connectorContainer.EnableUserDrawnConnectors) { Point logicalPoint = workflowView.ClientPointToLogical(clientPoint); ConnectablePoints = GetHighlightableConnectionPoints(logicalPoint, MessageHitTestContext.AssociatedDesigner); cursorPoint = logicalPoint; } } bool processedMessage = UpdateCursor(cursorPoint); return(processedMessage); }
private bool CanResizeDesigner(ActivityDesigner designer) { if (!designer.EnableVisualResizing) { return(false); } if (designer.ParentDesigner != null) { FreeformActivityDesigner freeFormDesigner = designer.ParentDesigner as FreeformActivityDesigner; if (freeFormDesigner != null) { return(freeFormDesigner.CanResizeContainedDesigner(designer)); } else { return(false); } } return(true); }
private static ConnectionPoint[] GetHighlightableConnectionPoints(Point currentPoint, ActivityDesigner activityDesigner) { List <ConnectionPoint> highlightablePoints = new List <ConnectionPoint>(); List <ActivityDesigner> designersToCheck = new List <ActivityDesigner>(); FreeformActivityDesigner freeFormDesigner = activityDesigner as FreeformActivityDesigner; if (freeFormDesigner != null) { designersToCheck.AddRange(freeFormDesigner.ContainedDesigners); } designersToCheck.Add(activityDesigner); foreach (ActivityDesigner designer in designersToCheck) { bool addSnapPoints = (designer.Bounds.Contains(currentPoint)); ReadOnlyCollection <ConnectionPoint> snapPoints = designer.GetConnectionPoints(DesignerEdges.All); if (!addSnapPoints) { foreach (ConnectionPoint snapPoint in snapPoints) { if (snapPoint.Bounds.Contains(currentPoint)) { addSnapPoints = true; break; } } } if (addSnapPoints) { highlightablePoints.AddRange(snapPoints); } } return(highlightablePoints.ToArray()); }
protected internal override PropertyInfo[] GetProperties(WorkflowMarkupSerializationManager serializationManager, object obj) { if (serializationManager == null) { throw new ArgumentNullException("serializationManager"); } if (obj == null) { throw new ArgumentNullException("obj"); } XmlWriter writer = serializationManager.WorkflowMarkupStack[typeof(XmlWriter)] as XmlWriter; PropertyInfo[] properties = base.GetProperties(serializationManager, obj); FreeformActivityDesigner freeformDesigner = obj as FreeformActivityDesigner; if (freeformDesigner != null) { List <PropertyInfo> serializableProperties = new List <PropertyInfo>(); foreach (PropertyInfo property in properties) { //Only filter this property out when we are writting if (writer != null && property.Name.Equals("AutoSizeMargin", StringComparison.Ordinal) && freeformDesigner.AutoSizeMargin == FreeformActivityDesigner.DefaultAutoSizeMargin) { continue; } serializableProperties.Add(property); } serializableProperties.Add(typeof(FreeformActivityDesigner).GetProperty("DesignerConnectors", BindingFlags.Instance | BindingFlags.NonPublic)); properties = serializableProperties.ToArray(); } return(properties); }
internal static FreeformActivityDesigner GetConnectorContainer(ActivityDesigner associatedDesigner) { //This function will walk up the parent chain of the designers and give the topmost container of connectors FreeformActivityDesigner connectorContainer = null; if (associatedDesigner != null) { ActivityDesigner connectedDesigner = associatedDesigner; while (connectedDesigner != null) { if (connectedDesigner is FreeformActivityDesigner) { connectorContainer = connectedDesigner as FreeformActivityDesigner; } else if (connectedDesigner is InvokeWorkflowDesigner) { break; //state machine withing invoke workflow activity is the root } connectedDesigner = connectedDesigner.ParentDesigner; } } return(connectorContainer); }
public FreeformDesignerAccessibleObject(FreeformActivityDesigner activityDesigner) : base(activityDesigner) { }