private void ViewPlayerDetails( int rowIndex )
        {
            int playerID = Convert.ToInt32( this.gridPlayers.Rows[rowIndex].Cells[0].Value.ToString() );

            this.RefreshTableData();
            this.RefreshPlayers();

            ViewPlayerForm viewPlayerForm = new ViewPlayerForm( PlayerDataService.GetPlayerByID( playerID ) );

            viewPlayerForm.ShowDialog();

            if ( _table.Players.Count < 1 )
            {
                this.Close();
            } else
            {
                this.RefreshTableData();
                this.RefreshPlayers();
            }
        }
示例#2
0
        private void ViewPlayerDetails(int rowIndex)
        {
            int playerID = Convert.ToInt32( this.playersGrid.Rows[rowIndex].Cells[0].Value.ToString() );

            this.playersGrid.EndEdit();

            this.SetTableData();

            this.playersGrid.Select();
            this.playersGrid.Rows[0].Cells[1].Selected = true;
            this.playersGrid.CurrentCell = this.playersGrid.SelectedCells[0];
            this.playersGrid.CurrentCell.Selected = true;

            foreach ( DataGridViewRow row in this.playersGrid.Rows )
            {
                if ( Convert.ToInt32( row.Cells[0].Value.ToString() ) == playerID )
                {
                    this.playersGrid.ClearSelection();

                    row.Cells[1].Selected = true;
                    this.playersGrid.CurrentCell = this.playersGrid.SelectedCells[0];
                    this.playersGrid.CurrentCell.Selected = true;
                }
            }

            ViewPlayerForm viewPlayerForm = new ViewPlayerForm( PlayerDataService.GetPlayerByID( playerID ) );

            viewPlayerForm.ShowDialog();

            this.SetTableData();

            playersGrid.ClearSelection();

            if ( this.playersGrid.Rows.Count > 0 )
            {
                this.playersGrid.Select();
                this.playersGrid.Rows[0].Cells[1].Selected = true;
                this.playersGrid.CurrentCell = this.playersGrid.SelectedCells[0];
                this.playersGrid.CurrentCell.Selected = true;

                foreach ( DataGridViewRow row in this.playersGrid.Rows )
                {
                    if ( Convert.ToInt32( row.Cells[0].Value.ToString() ) == playerID )
                    {
                        this.playersGrid.ClearSelection();

                        row.Cells[1].Selected = true;
                        this.playersGrid.CurrentCell = this.playersGrid.SelectedCells[0];
                        this.playersGrid.CurrentCell.Selected = true;
                    }
                }
            } else
            {
                this.Hide();
            }
        }