예제 #1
0
        public Task StartAsync()
        {
            //System.Diagnostics.Debugger.Break();

            //create a form
            form      = new System.Windows.Forms.Form();
            form.Size = new System.Drawing.Size(500, 500);

            //create a viewer object
            viewer            = new GViewer();
            viewer.Dock       = System.Windows.Forms.DockStyle.Fill;
            viewer.AutoScroll = false;
            //viewer.CurrentLayoutMethod = LayoutMethod.MDS;

            // control
            var b = CreateCommandButton();

            form.Controls.Add(b);
            b.BringToFront();

            viewer.ObjectUnderMouseCursorChanged += new EventHandler <Microsoft.Msagl.Drawing.ObjectUnderMouseCursorChangedEventArgs>(viewer_ObjectUnderMouseCursorChanged);
            viewer.MouseDown += new MouseEventHandler(viewer_MouseDown);
            viewer.SuspendLayout();

            form.SuspendLayout();
            form.Controls.Add(viewer as Control);

            viewer.ResumeLayout(false);
            form.ResumeLayout(false);

            viewer.Graph = graph;

            return(Task.Run(() => form.ShowDialog()));
        }
예제 #2
0
        private void cboRouteSelection_SelectionChangeCommitted(object sender, System.EventArgs e)
        {
            var key = (string)cboRouteSelection.SelectedItem;

            if (Program.MainForm.CurrentProblem.RouteDic.ContainsKey(key))
            {
                txtNbPossiblePaths.Text = Program.MainForm.CurrentProblem.RouteDic[key].Graph.PossiblePathsOrderedByPenalty.Length.ToString("##,###");
                _graphViewer.SuspendLayout();
                _graphViewer.Graph = Program.MainForm.CurrentProblem.RouteDic[key].Graph.MSGraph;
                _graphViewer.ResumeLayout();

                cboPathSelection.Items.Clear();
                for (int i = 0; i < Program.MainForm.CurrentProblem.RouteDic[key].Graph.PossiblePathsOrderedByPenalty.Length; ++i)
                {
                    cboPathSelection.Items.Add(i);
                }
            }
        }
예제 #3
0
        private void cboTrainSelection_SelectionChangeCommitted(object sender, System.EventArgs e)
        {
            var key = (string)cboTrainSelection.SelectedItem;

            if (Program.MainForm.CurrentSolution.TrainRunsDic.ContainsKey(key))
            {
                _graphViewer.SuspendLayout();
                _graphViewer.Graph = Program.MainForm.CurrentSolution.TrainRunsDic[key].MSGraph;
                _graphViewer.ResumeLayout();
            }
        }
예제 #4
0
        // This populates the graph using the current roots of the tree list
        private void PopulateGraph()
        {
            SyntaxWrapper[] roots = _treeList.Roots == null ? null : _treeList.Roots.Cast <SyntaxWrapper>().ToArray();
            if (roots == null || roots.Length == 0)
            {
                PopulateGraph(null);
                return;
            }

            _graphViewer.SuspendLayout();
            Graph graph = new Graph();
            int   id    = 0;

            foreach (SyntaxWrapper root in roots)
            {
                id = PopulateGraph(graph, root, id, null) + 1;
            }
            _graphViewer.Graph = graph;
            _graphViewer.ResumeLayout();
        }
예제 #5
0
 private void cboTrainSelection_SelectionChangeCommitted(object sender, System.EventArgs e)
 {
     if (SelectedTrack != null && Program.MainForm?.CurrentSolution != null)
     {
         var selectedRoute = Program.MainForm.CurrentSolution.GetTrainRun((string)cboTrainSelection.SelectedItem).TrainRunSections;
         SelectedTrack.Highlight(selectedRoute);
         SelectedTrack.AdjustLabels(selectedRoute);
         _graphViewer.SuspendLayout();
         _graphViewer.Graph = SelectedTrack;
         _graphViewer.ResumeLayout();
     }
 }
예제 #6
0
        private void cboRouteSelection_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (SelectedTrack != null)
            {
                txtNbPossiblePaths.Text = SelectedTrack.NbPaths.ToString("##,###");
                _graphViewer.SuspendLayout();
                SelectedTrack.SelectPath(-1); // Reinit edge colors
                _graphViewer.Graph = SelectedTrack;
                _graphViewer.ResumeLayout();

                cboPathSelection.Items.Clear();
                for (int i = 0; i < SelectedTrack.NbPaths; ++i)
                {
                    cboPathSelection.Items.Add(i);
                }
            }
        }