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(); }
private void BuildingComponent_Click(object sender, RoutedEventArgs e) { var componentName = (sender as Button)?.Name; if (componentName == null) { return; } _currentBuildingComponentType = (BuildingComponentType)Enum.Parse(typeof(BuildingComponentType), componentName, true); _currentBuildingComponentImage = BuildingComponentsHelper.GetBuildingComponentImage(_currentBuildingComponentType); buildingComponentClicked(_currentBuildingComponentType); }