private void btnPlayerEdit_Click(object sender, RoutedEventArgs e)
{
Player playerToEdit = this.dgPointsTable.SelectedItem as Player;
if (playerToEdit == null) return;
playerToEdit.Clone();
bool edited = false;
while (!edited)
{
PlayerWindow frmPlayer = new PlayerWindow(playerToEdit) { Owner = this };
if (frmPlayer.ShowDialog() == true)
{
if (this.tournament.PointsTable.Where(p => p.Alias == playerToEdit.Alias).Count() > 1)
{
new PMW(StringTable.MainWindow_PlayerExists);
continue;
}
edited = true;
continue;
}
else
{
playerToEdit.Restore();
edited = true;
continue;
}
}
this.dgPointsTable.Items.Refresh();
}