private void GenerateAndAddPolygon() { if (SelectedPolygonGenerator == null) { throw new InvalidOperationException($"No polygon generator selected"); } var polygon = SelectedPolygonGenerator.Generate(MaxSideLength); var color = GenerateRandomColor(); Polygons.Add(new Polygon { Points = polygon, Description = $"Auto-generated Polygon at {DateTime.Now:D}", StrokeColor = color, FillColor = Color.FromArgb(128, color) }); }
private void GenerateAndAddPolygon() { if (SelectedPolygonGenerator == null) { throw new InvalidOperationException($"No polygon generator selected"); } var polygon = SelectedPolygonGenerator.Generate(MaxSideLength); var color = GenerateRandomColor(); Polygons.Add(new Polygon { Points = polygon, Description = $"Auto-generated Polygon at {DateTime.Now:D}", StrokeColor = color, FillColor = Color.FromArgb(128, color) }); // This is how you would show a message box: // DialogHandler?.ShowMessageBox("Polygon has been added"); }
private async Task GenerateAndAddPolygonAsync() { if (SelectedPolygonGenerator == null) { throw new InvalidOperationException($"No polygon generator selected"); } var polygon = SelectedPolygonGenerator.Generate(MaxSideLength); var color = GenerateRandomColor(); Polygons.Add(new Polygon { Points = polygon, Description = $"Auto-generated Polygon at {DateTime.Now:D}", StrokeColor = color, FillColor = Color.FromArgb(128, color) }); if (DialogHandler != null) { await DialogHandler.ShowMessageBoxAsync("Polygon has been added"); } }