public MainWindow() { InitializeComponent(); GraphBuilder_SizeChanged(null, null); graphDrawing = new GraphDrawing(DrawingSurface.Width, DrawingSurface.Height); graphDrawing.RadiusChanged += (sender, args1) => { if (BasicTypeCheckBox.Checked) { graphDrawing.DrawTheWholeGraph(digraph); } else { graphDrawing.DrawTheWholeGraphSandpile(digraph, false); } DrawingSurface.Image = graphDrawing.Image; }; VerticesColorPanel.BackColor = graphDrawing.VerticesColor; ArcsColorPanel.BackColor = graphDrawing.ArcsColor; graphDrawing.SandpilePaletteChanged += (sender, e) => DigraphInformationDemonstration.DisplaySandpileColors(graphDrawing, SandpilePalette); CommandsManager.CanRedoChanged += (sender, e) => RedoButton.Enabled = (bool)sender; CommandsManager.CanUndoChanged += (sender, e) => UndoButton.Enabled = (bool)sender; }
/// <summary> /// Redraws the digraph, refill DataGridViews with the digraph info /// </summary> private void UpdateDigraphInfo() { graphDrawing.DrawTheWholeGraph(digraph); DrawingSurface.Image = graphDrawing.Image; ArcName.Items.Clear(); ArcName.Text = String.Empty; ArcLength.Text = String.Empty; digraph.Arcs.ForEach(arc => ArcName.Items.Add((arc.StartVertex + 1) + "-" + (arc.EndVertex + 1))); DigraphInformationDemonstration.DisplayGraphAdjacencyInfo(digraph.AdjacencyMatrix, GridAdjacencyMatrix); DigraphInformationDemonstration.DisplayGraphParameters(digraph, GridParameters); }