public static ConnectorState GetCurrentState(this SfConnectorViewModel connector)
 {
     return(new ConnectorState()
     {
         Stroke = connector.StrokeColor
     });
 }
        private SfConnectorViewModel CreateConnector(SfNodeViewModel sourcenode, SfNodeViewModel targetnode, string content)
        {
            var con = new SfConnectorViewModel()
            {
                SourceNode      = sourcenode,
                TargetNode      = targetnode,
                Annotations     = null,
                TargetDecorator = resourceDictionary["ClosedSharp"],
            };

            if (targetnode.Ports != null && (targetnode.Ports as PortCollection).Count > 0 && content != "")
            {
                con.TargetPort = (targetnode.Ports as PortCollection).First() as NodePortViewModel;
            }

            if (sourcenode.Ports != null && (sourcenode.Ports as PortCollection).Count > 0 && content != "" && content == "Yes")
            {
                con.SourcePort = (sourcenode.Ports as PortCollection).First() as NodePortViewModel;
            }

            if (content != "")
            {
                if (content == "Yes")
                {
                    con.Annotations = new AnnotationCollection()
                    {
                        new TextAnnotationViewModel()
                        {
                            Text  = content,
                            Pivot = new Point(0.5, 0),
                        },
                    };
                }

                else if (content == "No" && ((targetnode.Annotations as AnnotationCollection).First() as TextAnnotationViewModel).Text == "End")
                {
                    con.Annotations = new AnnotationCollection()
                    {
                        new TextAnnotationViewModel()
                        {
                            Text        = content,
                            Pivot       = new Point(0, 1),
                            Margin      = new Thickness(0, 0, 0, 10),
                            RotateAngle = -90,
                        },
                    };
                }

                else if (content == "No")
                {
                    con.Annotations = new AnnotationCollection()
                    {
                        new TextAnnotationViewModel()
                        {
                            Text  = content,
                            Pivot = new Point(0.5, 0)
                        },
                    };
                }
            }

            (Connectors as ObservableCollection <SfConnectorViewModel>).Add(con);

            return(con);
        }
 public static void UpdateState(this SfConnectorViewModel connector, ConnectorState state)
 {
     connector.StrokeColor = state.Stroke;
 }