private void EditRow() { var row = gridPlayers.CurrentRow; if (row != null) { var player = (Player)row.Tag; if (playerForm == null) { playerForm = new PlayerForm(player ?? new Player { Location = name.Text }); } else { playerForm.Player = player ?? new Player { Location = name.Text } }; playerForm.ShowDialog(this); if (playerForm.Player != null) { row.Tag = playerForm.Player; row.Cells[ColName.Index].Value = playerForm.Player.Name; row.Cells[ColTitle.Index].Value = playerForm.Player.Grade.ShortName; } CheckSaveButton(); } } }
/// <summary> /// Показывает форму участника и возвращает сведения об участнике /// </summary> /// <returns>Сведения об участнике или null</returns> private Player GetNewPlayer() { if (playerForm == null) { playerForm = new PlayerForm(); } else { playerForm.Player = null; } playerForm.ShowDialog(this); var player = playerForm.Player; return(player); }
private void EditPlayer() { var selectedItems = lvCompetitors.SelectedItems; if (selectedItems.Count > 0) { var item = selectedItems[0]; var player = PlayerFromItem(item); if (playerForm == null) { playerForm = new PlayerForm(player); } else { playerForm.Player = player; } playerForm.ShowDialog(this); if (playerForm.Player != null) { UpdateItem(item, playerForm.Player); } } }