private void btnPlayerAdd_Click(object sender, RoutedEventArgs e)
{
try
{
Player playerToAdd = new Player() { Place = this.tournament.PointsTable.Count + 1 };
bool added = false;
while (!added)
{
PlayerWindow frmPlayer = new PlayerWindow(playerToAdd) { Owner = this };
if (frmPlayer.ShowDialog() == true)
{
if (this.tournament.PointsTable.Where(p => p.Alias == playerToAdd.Alias).Count() > 0)
{
new PMW(StringTable.MainWindow_PlayerExists);
continue;
}
this.tournament.AddPlayer(playerToAdd);
added = true;
continue;
}
else
{
added = true;
continue;
}
}
}
catch (Exception ex)
{
new PME("Błąd dodawania gracza." + Environment.NewLine + ex.Message + Environment.NewLine + (ex.InnerException == null ? "" : ex.InnerException.Message));
}
}