Esempio n. 1
0
        /// <summary>
        /// Creates a LinkingLine that only has a source and can be linked to a new destination.
        /// </summary>
        /// <param name=""></param>
        public LinkingLine(WeightedNodeControl source)
        {
            InitializeComponent();

            this.source = source;

            RequiresDestination = true;

            source.AddLinkingLine(this);

            timer.Interval  = 5;
            timer.AutoReset = true;
            timer.Enabled   = true;
        }
Esempio n. 2
0
        private void LinkingLine_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (RequiresDestination)
            {
                if (ParentIsOfType((FrameworkElement)Mouse.DirectlyOver, typeof(WeightedNodeControl)))
                {
                    WeightedNodeControl node = (WeightedNodeControl)GetParentControl((FrameworkElement)Mouse.DirectlyOver, typeof(WeightedNodeControl));
                    node.WasLinkedTo = true;
                    node.AddLinkingLine(this);
                    this.destination    = node;
                    RequiresDestination = false;

                    ((UIElement)Parent).PreviewMouseLeftButtonDown -= LinkingLine_PreviewMouseLeftButtonDown;
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a LinkingLine that which already has a destination.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="destination"></param>
        public LinkingLine(WeightedNodeControl source, WeightedNodeControl destination)
        {
            InitializeComponent();

            this.source      = source;
            this.destination = destination;

            source.AddLinkingLine(this);
            destination.AddLinkingLine(this);

            destination.PreviewMouseLeftButtonDown += Destination_PreviewMouseLeftButtonDown;

            timer.Interval  = 5;
            timer.AutoReset = true;
            timer.Enabled   = true;
        }