Exemplo n.º 1
0
 public FlowLink(FlowElement Source, FlowElement Destination, bool fromrunTab = false)
 {
     this.Source      = Source;
     this.Destination = Destination;
     if (!fromrunTab)
     {
         this.MouseLeftButtonDown += GraphEdge_MouseLeftButtonDown;
     }
 }
Exemplo n.º 2
0
        private void MainCanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            FlowElement FE = GetFlowElemFromMosuePosition();

            if (FE != null)
            {
                if (mCurrentFlowElem != null)
                {
                    mCurrentFlowElem.SetHighLight(false);
                }

                FE.SetHighLight(SetHighLight);
                // if Rect connector
                var UIElement = Mouse.DirectlyOver as UIElement;

                if (UIElement is FrameworkElement)
                {
                    FrameworkElement F1 = (FrameworkElement)UIElement;
                    mCurrnetFlowElemControl = F1.Name;
                    if (F1.Name == "TopLeftResizer")
                    {
                        mCurrentFlowElem               = FE;
                        mRelativeMousePoint            = Mouse.GetPosition(this.MainCanvas);
                        mCurrentFlowElemOriginalMargin = mCurrentFlowElem.Margin;
                        mCurrentFlowElemOriginalWidth  = FE.Width;
                        mCurrentFlowElemOriginalHeight = FE.Height;
                        mCurrentAction = CurrentAction.Resize;
                        return;
                    }

                    if (F1.Name == "LeftConnector" || F1.Name == "RightConnector" || F1.Name == "TopConnector" || F1.Name == "BottomConnector")
                    {
                        // For Drag Drop
                        UIElement element = sender as UIElement;
                        if (element == null)
                        {
                            return;
                        }
                        DragDrop.DoDragDrop(element, new DataObject(FE), DragDropEffects.Link);
                        mCurrentAction   = CurrentAction.Link;
                        mCurrentFlowElem = FE;
                        return;
                    }
                }

                // else we move the FE
                mCurrentFlowElem               = FE;
                mRelativeMousePoint            = Mouse.GetPosition(this.MainCanvas);
                mCurrentAction                 = CurrentAction.Move;
                mCurrentFlowElemOriginalMargin = mCurrentFlowElem.Margin;
            }

            //TODO: IF we are on canvas and no FE then move the scroll bar like map move
        }
Exemplo n.º 3
0
 internal void LinkFlowElement(FlowElement Prev, FlowElement Next, int index, int marginRight)
 {
     foreach (FlowLink child in GEList)
     {
         if (GEList.IndexOf(child) == index)
         {
             child.Source      = Prev;
             child.Destination = Next;
             child.Tag         = Prev.Tag;
             child.Margin      = new Thickness(0, 0, marginRight, 0);
             MainCanvas.Children.Add(child);
         }
     }
 }
Exemplo n.º 4
0
        public void AddFlowElem(FlowElement FE, int index = -1)
        {
            List <FlowElement> fe = new List <FlowElement>();

            fe = GetAllFlowElements();
            MainCanvas.Children.Clear();

            if (index != -1)
            {
                fe.Insert(index, FE);
            }
            else
            {
                fe.Add(FE);
            }
            ArrangeLinks(fe);
        }
Exemplo n.º 5
0
        public void MoveFlowElement(int oldindex, int newindex)
        {
            FlowElement        ue = null;
            List <FlowElement> fe = new List <FlowElement>();

            fe = GetAllFlowElements();
            MainCanvas.Children.Clear();
            foreach (FlowElement child in fe)
            {
                if (fe.IndexOf(child) == oldindex)
                {
                    ue = child;
                }
            }
            if (ue != null)
            {
                fe.RemoveAt(oldindex);
            }
            fe.Insert(newindex, ue);
            ArrangeLinks(fe);
        }
Exemplo n.º 6
0
 public void ClearAllFlowElement()
 {
     MainCanvas.Children.Clear();
     GEList.Clear();
     mCurrentFlowElem = null;
 }