Example #1
0
 public override void UpdateEdge(bool updateLabel = true)
 {
     if (!ShowArrows)
     {
         if (EdgePointerForTarget != null)
         {
             EdgePointerForTarget?.Hide();
             EdgePointerForTarget = null;
         }
         if (EdgePointerForSource != null)
         {
             EdgePointerForSource?.Hide();
             EdgePointerForSource = null;
         }
     }
     base.UpdateEdge(updateLabel);
     if (((VisualEdge)Edge).Edge.Weight == null)
     {
         EdgeLabelControl?.Hide();
     }
     else
     {
         EdgeLabelControl?.Show();
     }
 }
Example #2
0
        public override void Clean()
        {
            Source   = null;
            Target   = null;
            Edge     = null;
            RootArea = null;
            HighlightBehaviour.SetIsHighlightEnabled(this, false);
            DragBehaviour.SetIsDragEnabled(this, false);
            Linegeometry      = null;
            LinePathObject    = null;
            SelfLoopIndicator = null;
            EdgeLabelControls.ForEach(l => l.Dispose());
            EdgeLabelControls.Clear();

            if (EdgePointerForSource != null)
            {
                EdgePointerForSource.Dispose();
                EdgePointerForSource = null;
            }
            if (EdgePointerForTarget != null)
            {
                EdgePointerForTarget.Dispose();
                EdgePointerForTarget = null;
            }
            EventOptions?.Clean();
        }
        public override void Clean()
        {
            //TODO rename to _sourceWatcher _targetWatcher
            if (_sourceWatcher != null)
            {
                _sourceWatcher.Dispose();
            }
            if (_targetWatcher != null)
            {
                _targetWatcher.Dispose();
            }
            if (Source != null)
            {
                Source.PositionChanged -= source_PositionChanged;
            }
            if (Target != null)
            {
                Target.PositionChanged -= source_PositionChanged;
            }
            _oldSource = _oldTarget = null;
            Source     = null;
            Target     = null;
            Edge       = null;
            RootArea   = null;
            HighlightBehaviour.SetIsHighlightEnabled(this, false);
            DragBehaviour.SetIsDragEnabled(this, false);
            _linegeometry     = null;
            LinePathObject    = null;
            SelfLoopIndicator = null;
            if (EdgeLabelControl != null)
            {
                EdgeLabelControl.Dispose();
                EdgeLabelControl = null;
            }

            if (EdgePointerForSource != null)
            {
                EdgePointerForSource.Dispose();
                EdgePointerForSource = null;
            }
            if (EdgePointerForTarget != null)
            {
                EdgePointerForTarget.Dispose();
                EdgePointerForTarget = null;
            }
            if (EventOptions != null)
            {
                EventOptions.Clean();
            }
        }
Example #4
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (!ShowArrows)
            {
                // Hide arrow
                EdgePointerForSource?.Hide();
                EdgePointerForTarget?.Hide();

                // Force line length to connect source/target
                _linegeometry = new PathGeometry(new[]
                {
                    new PathFigure(Source.GetCenterPosition(), new [] {
                        new LineSegment(Target.GetCenterPosition(), isStroked: true)
                    }, closed: false)
                });

                LinePathObject.Data = _linegeometry;
            }
        }