/// <summary> /// Handles the Click event of the createUnitButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> private void createUnitButton_Click(object sender, RoutedEventArgs e) { if (selectedCity != null) { BuyUnitMessageBox buyMsgBox = new BuyUnitMessageBox(); var result = buyMsgBox.ShowDialog(); if ((result != null) && result == true) { switch (buyMsgBox.SelectedUnitType) { case "Etudiant": selectedCity.CreateUnit(UnitType.U_STUDENT, players[currentPlayerIndex]); break; case "Directeur": selectedCity.CreateUnit(UnitType.U_DIRECTOR, players[currentPlayerIndex]); break; case "Enseignant": selectedCity.CreateUnit(UnitType.U_TEACHER, players[currentPlayerIndex]); break; } } } this.mapViewer.Redraw(); }