private void dgvScoring_SelectionChanged(object sender, EventArgs e) { if (!this.Game.Notations.Scoring.IsSelectionAllowed) { return; } if (dgvScoring.CurrentCell == null || this.Game.Flags.IsFirtMove || this.Game.Notations.IsFromAdd) { return; } int sno = 0; if (dgvScoring.CurrentCell.ColumnIndex > 3) { sno = BaseItem.ToInt32(dgvScoring[3, dgvScoring.CurrentCell.RowIndex].Value); } else { sno = BaseItem.ToInt32(dgvScoring[0, dgvScoring.CurrentCell.RowIndex].Value); } ScoringDataRow sd = this.Game.Notations.Scoring.GetScoringDataRow(dgvScoring.CurrentCell.RowIndex, dgvScoring.CurrentCell.ColumnIndex, sno); if (sd == null) { return; } Move m = this.Game.Moves.GetById(sd.Id); this.Game.MoveTo(m); }
public void SetSelection(Move m) { try { ScoringDataRow sd = this.Game.Notations.Scoring.GetScoringDataRow(m.Id); if (sd == null) { return; } this.Game.Notations.IsFromAdd = true; if (sd.R < dgvScoring.Rows.Count && sd.C < dgvScoring.ColumnCount) { dgvScoring.CurrentCell = dgvScoring[sd.C, sd.R]; dgvScoring.Refresh(); } this.Game.Notations.IsFromAdd = false; } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); string s = ex.ToString(); } }