private void VisualizeSimulationGridFromImportedData(List <NodeCreationData> importedData) { SimulationGrid.Children.Clear(); for (var index = importedData.Count - 1; index >= 0; index--) { var component = importedData[index]; foreach ((int, int)cell in component.Cell) { var(row, col) = cell; var enabledRectangle = new MutantRectangle(cell, new ImageBrush { ImageSource = BuildingComponentsHelper.GetBuildingComponentImage(component.Type), Stretch = Stretch.Fill }); Grid.SetRow(enabledRectangle, row); Grid.SetColumn(enabledRectangle, col); SimulationGrid.Children.Add(enabledRectangle); } } ConvertToSettingsService.SerializedToCreation(importedData); EnableNextButton(); }
public static void PaintChildrenCells(List <GridCell> blinkingCells) { foreach (GridCell blinkingCell in blinkingCells) { int index = GridHelper.CalculateIndexFromCoordinates(blinkingCell.Cell); MutantRectangle rectangleAtIndex = (_grid.Children[index] as MutantRectangle); if (rectangleAtIndex.Content.GetType() != typeof(GenericBuildingComponent)) { rectangleAtIndex.Content = blinkingCell; rectangleAtIndex.Fill = blinkingCell.Fill; } } }
private void EnabledRectangle_MouseDown(object sender, MouseButtonEventArgs e) { MutantRectangle clickedRectangle = sender as MutantRectangle; clickedRectangle.On_Click(_currentBuildingComponentType); }