private void B_Click(object sender, RoutedEventArgs e) { HexButton source = (HexButton)sender; if (source.Planet.Name != string.Empty) { HideAllIcons(); _currentButton = source; PlanetProfileGrid.Visibility = Visibility.Visible; PlanetNameLabel.Text = source.Planet.Name; UWPLabel.Content = source.Planet.Profile + " " + source.Planet.TradeCodes; StarPortLabel.Content = (source.Planet.StarPort == 'X') ? "No starport" : source.Planet.StarPort.ToString(); SizeLabel.Content = GetSizeDescription(source.Planet.Size); AtmosphereLabel.Content = GetAtmosphereDescription(source.Planet.Atmosphere); HydrographicsLabel.Content = GetHydrographicsDescription(source.Planet.Hydrographics); PopulationLabel.Content = (source.Planet.Population == 0) ? "None" : string.Format("{0:n0}", Math.Pow(1 * 10, source.Planet.Population)) + "+"; GovernmentTextBox.Text = GetGovernmentDescription(source.Planet.Government); LawLevelLabel.Text = GetLawLevelDescription(source.Planet.LawLevel); TechTextBox.Content = source.Planet.TechLevel.ToString(); TemperatureTextBox.Text = GetTemperatureDescription(source.Planet.Temperature); NotesTextBox.Text = source.Planet.Notes; RedZonedCheckbox.IsChecked = source.Planet.isRed; if (source.Planet.HasGasGiant) { SetGasGiant(); } if (source.Planet.Hydrographics > 3) { SetWaterPlanet(); } else { SetDryPlanet(); } if (source.Planet.HasScoutBase) { SetScoutBase(); } if (source.Planet.HasTas) { SetTas(); } if (source.Planet.HasNavalBase) { SetNavalBase(); } } else { PlanetProfileGrid.Visibility = Visibility.Hidden; } }
private void AddPlanetToGrid(PlanetProfile p, HexagonGrid grid) { HexButton b = new HexButton(p); //b.clic += B_MouseDown; b.Click += B_Click; _profiles.Add(p); grid.Children.Add(b); Grid.SetRow(b, p.Column); Grid.SetColumn(b, p.Row); }