private void ShowResults(object sender, RoutedEventArgs e)
        {
            Financial_Tsunami_Followup_Window result = new Financial_Tsunami_Followup_Window();

            result.Presenter.Content = viewModel.graphModel.graph;
            result.Show();
        }
        public MainWindow()
        {
            InitializeComponent();
            viewModel   = new ViewModelVertexEdge();
            DataContext = viewModel;

            ViewModelVertexEdge.graphControl = monitor;
            FollowupWindow             = new Financial_Tsunami_Followup_Window();
            FollowupWindow.viewModel   = viewModel;
            FollowupWindow.DataContext = viewModel;

            UIElement cvs = monitor as UIElement;

            // These lambda functions are for draging Vertex nodes around.
            moveStart = (varMoved, args) =>
            {
                var element = varMoved as UIElement;
                dragStart = args.GetPosition(element);
                element.CaptureMouse();
            };
            moveEnd = (varMoved, args) =>
            {
                var element = varMoved as UIElement;
                dragStart = null;
                element.ReleaseMouseCapture();
            };
            moving = (varMoved, args) =>
            {
                if (dragStart != null && args.LeftButton == MouseButtonState.Pressed)
                {
                    var element = (UIElement)varMoved;
                    var p2      = args.GetPosition(cvs);
                    if (p2.X - dragStart.Value.X > 0)
                    {
                        Canvas.SetLeft(element, p2.X - dragStart.Value.X);
                    }
                    else
                    {
                        Canvas.SetLeft(element, 0);
                    }
                    if (p2.Y - dragStart.Value.Y > 0)
                    {
                        Canvas.SetTop(element, p2.Y - dragStart.Value.Y);
                    }
                    else
                    {
                        Canvas.SetTop(element, 0);
                    }
                }
            };

            // This function is for selecting elements on the screen.
            selectPresenter = (varMoved, args) =>
            {
                var presenter = varMoved as ContentPresenter;

                switch (viewModel.CurrentStatus)
                {
                case SelectStatus.SelectAnElement:
                    if (presenter.Content is Vertex)
                    {
                        CancelSelectionAndResetStatus();
                        viewModel.SelectVertex(presenter.Content as Vertex);
                        args.Handled = true;
                    }
                    if (presenter.Content is EdgeViewModelClass)
                    {
                        CancelSelectionAndResetStatus();
                        viewModel.SelectEdge((presenter.Content as EdgeViewModelClass).edge);
                        args.Handled = true;
                    }
                    break;

                case SelectStatus.EdgeBuilding:
                    if (presenter.Content is Vertex && presenter.Content != viewModel.CurrentVertexSelected)
                    {
                        Edge e = AddEdge(viewModel.CurrentVertexSelected, presenter.Content as Vertex);
                        CancelSelectionAndResetStatus();
                        if (e != null)
                        {
                            viewModel.SelectEdge(e);
                        }
                        args.Handled = true;
                    }
                    else
                    {
                        CancelSelectionAndResetStatus();
                    }
                    break;

                default:
                    CancelSelectionAndResetStatus();
                    break;
                }
            };
        }