it is a container node with two children 1) a Control Node that has a TextBlock and 2) a shapenode.
These are the properties that are used. public TaskNode(Diagram diagram, Task task, Flow flow, UserMapPreferences preferences) { const int SUBSCRIPTIONID = -1; const bool ISPROPERTIESEDITABLE = true;
Preferences = preferences; FlowDiagram = diagram; FlowTask = task; Flow = flow; Brush anchorBrush = Brushes.White; AnchorPattern anchorPattern = new AnchorPattern(new AnchorPoint[] { new AnchorPoint(50, 0, true, true, anchorBrush, 1), new AnchorPoint(100, 50, true, true, anchorBrush, 2), new AnchorPoint(50, 100, true, true, anchorBrush, 3), new AnchorPoint(0, 50, true, true, anchorBrush, 4) }); TextBlock taskText = new TextBlock { FontSize = 12, Text = TaskHelper.GetTaskText(FlowTask, Preferences), TextAlignment = TextAlignment.Center, Margin = new Thickness(0, 0, 0, 0), TextWrapping = TextWrapping.Wrap, UseLayoutRounding = true, }; ControlNode cn = new ControlNode(FlowDiagram, taskText) { Bounds = new Rect(FlowTask.XLocation - 100 + 16, FlowTask.YLocation + 30, 200, 25), EnabledHandles = AdjustmentHandles.None, Locked = true, }; string imageUri = task.Image > 0 ? string.Format(DiagramHelper.GetBaseUrl() + CustomImageHandler, task.Image) : TaskHelper.GetImageUrl(FlowTask); ShapeNode node = new ShapeNode(FlowDiagram) { Bounds = new Rect(FlowTask.XLocation, FlowTask.YLocation, 32, 32), Image = new BitmapImage(new Uri(imageUri, UriKind.RelativeOrAbsolute)), ImageAlign = ImageAlign.Center, Transparent = true, Pen = new Pen(Brushes.Black), Tag = new TaskNodeTag(FlowTask, SUBSCRIPTIONID, flow, ISPROPERTIESEDITABLE, cn), BorderBrush = new SolidColorBrush(Colors.Black), BorderThickness = new Thickness(1, 1, 1, 1), AnchorPattern = anchorPattern, Locked = true, }; TaskImageNode = node; TaskTextNode = cn; var transparent = new SolidColorBrush(Colors.Transparent); Node = new ContainerNode(diagram) { Bounds = new Rect(FlowTask.XLocation, FlowTask.YLocation, 32, 32), Transparent = false, BorderThickness = new Thickness(0, 0, 0, 0), AllowIncomingLinks = true, AllowOutgoingLinks = true, Pen = new Pen(transparent, 1), EnabledHandles = AdjustmentHandles.Move, AllowAddChildren = true, AllowRemoveChildren = false }; if (task.Type == TaskType.Start) { Node.AllowIncomingLinks = false; Node.AllowOutgoingLinks = true; } Node.Children.Add(TaskImageNode); Node.Children.Add(TaskTextNode); }
|