예제 #1
0
 private void buttonAdd_Click(object sender, EventArgs e)
 {
     using (FormPlayerEdition dlg = new FormPlayerEdition())
     {
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             AddPlayerItem(dlg.Player);
             this.game.Players.Add(dlg.Player);
             //this.listViewPlayers.Invalidate(true);
         }
     }
 }
예제 #2
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (this.listViewPlayers.SelectedItems.Count == 0)
                return;

            ListViewItem item = this.listViewPlayers.SelectedItems[0];

            using (FormPlayerEdition dlg = new FormPlayerEdition(item.Tag as Player))
            {
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    this.listViewPlayers.Items.Remove(item);
                    this.game.Players.Remove(item.Tag as Player);

                    AddPlayerItem(dlg.Player);
                    this.game.Players.Add(dlg.Player);
                    //this.listViewPlayers.Invalidate(true);
                }
            }
        }