Exemplo n.º 1
0
        internal void UpdateConnectionBetween(VirtualArchivePanel startPanel, VirtualArchivePanel nextPanel)
        {
            Point startPanelPosition = new Point((double)startPanel.GetValue(System.Windows.Controls.Canvas.LeftProperty), (double)startPanel.GetValue(System.Windows.Controls.Canvas.TopProperty));
            Point nextPanelPosition  = new Point((double)nextPanel.GetValue(System.Windows.Controls.Canvas.LeftProperty), (double)nextPanel.GetValue(System.Windows.Controls.Canvas.TopProperty));

            LineGeometry line = null;

            // Change exsiting
            foreach (PanelConnection connection in Connections)
            {
                if (connection.StartPanel == startPanel)
                {
                    line = connection.Line;
                    break;
                }
            }
            // Extablish a new one
            if (line == null)
            {
                line = new LineGeometry(); Connectors.Children.Add(line); Connections.Add(new PanelConnection(startPanel, nextPanel, line));
            }

            // Update
            line.StartPoint = new Point(startPanelPosition.X + startPanel.ActualWidth, startPanelPosition.Y + startPanel.ActualHeight / 2);
            line.EndPoint   = new Point(nextPanelPosition.X, nextPanelPosition.Y + nextPanel.ActualHeight / 2);
        }
Exemplo n.º 2
0
        internal void AddNextPanelFor(VirtualArchivePanel startPanel, VirtualArchivePanel nextPanel)
        {
            // Get location
            double xPositionOffset    = startPanel.ActualWidth * 1.5;
            Point  startPanelPosition = new Point((double)startPanel.GetValue(System.Windows.Controls.Canvas.LeftProperty),
                                                  (double)startPanel.GetValue(System.Windows.Controls.Canvas.TopProperty));
            Point nextPanelPosition = new Point((double)startPanel.GetValue(System.Windows.Controls.Canvas.LeftProperty) + xPositionOffset,
                                                (double)startPanel.GetValue(System.Windows.Controls.Canvas.TopProperty));

            // Show next panel
            System.Windows.Controls.Canvas.SetLeft(nextPanel, nextPanelPosition.X);
            System.Windows.Controls.Canvas.SetTop(nextPanel, nextPanelPosition.Y);
            VirtualArchiveCanvas.Children.Add(nextPanel);

            // Update
            this.UpdateLayout();
            UpdateConnectionBetween(startPanel, nextPanel);
        }
Exemplo n.º 3
0
        //internal void RemovePanelsFor(VirtualArchivePanel nextPanel)  // Not working, and I don't think it's very userful
        //{
        //    // Find any exsiting
        //    PanelConnection connectionToRemove = null;
        //    foreach (PanelConnection connection in Connections)
        //    {
        //        if (connection.StartPanel == nextPanel)
        //        {
        //            connectionToRemove = connection;
        //            break; // We know there will only be one line so we can break now, but if we want there be more lines we can comment this line
        //        }
        //    }

        //    if (connectionToRemove != null)
        //    {
        //        Connectors.Children.Remove(connectionToRemove.Line);
        //        Connections.Remove(connectionToRemove);
        //        RemovePanelsFor(connectionToRemove.EndPanel);
        //    }
        //}
        internal void UpdateConnection(VirtualArchivePanel endPanel)
        {
            Point nextPanelPosition = new Point((double)endPanel.GetValue(System.Windows.Controls.Canvas.LeftProperty), (double)endPanel.GetValue(System.Windows.Controls.Canvas.TopProperty));

            // Find any exsiting
            foreach (PanelConnection connection in Connections)
            {
                if (connection.EndPanel == endPanel)
                {
                    Point startPanelPosition = new Point((double)connection.StartPanel.GetValue(System.Windows.Controls.Canvas.LeftProperty), (double)connection.StartPanel.GetValue(System.Windows.Controls.Canvas.TopProperty));

                    // Update
                    connection.Line.StartPoint = new Point(startPanelPosition.X + connection.StartPanel.ActualWidth, startPanelPosition.Y + connection.StartPanel.ActualHeight / 2);
                    connection.Line.EndPoint   = new Point(nextPanelPosition.X, nextPanelPosition.Y + endPanel.ActualHeight / 2);

                    break; // We know there will only be one line so we can break now, but if we want there be more lines we can comment this line
                }
            }
        }