private void OnDoubleClick(object sender, EventArgs e) { try { var form = new JockeyStatisticsForm(_listBox.SelectedItem.ToString()); form.ShowDialog(); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
private void OnCellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { if (e.RowIndex < 0) { return; } if (e.Button == MouseButtons.Right) { Rectangle r = _grid.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true); _popupmenu.Items.Clear(); ToolStripItem item = _popupmenu.Items.Add("Show All Races For The Day", null, OnShowAllRacesForTheDay); ToolStripItem item2 = _popupmenu.Items.Add("Copy Race Replays Link To Clipboard", null, OnCopyRaceReplaysLinkToClipboard); ToolStripItem item3 = _popupmenu.Items.Add("Show Pace Figures", null, OnShowPaceFigures); item.Tag = _grid["ID_PP_OBJECT", e.RowIndex].Value; item2.Tag = _grid["ID_PP_OBJECT", e.RowIndex].Value; item3.Tag = _grid["ID_PP_OBJECT", e.RowIndex].Value; _popupmenu.Show((Control) sender, r.Left + e.X, r.Top + e.Y); } else if (e.Button == MouseButtons.Left) { int winnersNameColIndex = _grid.Columns["WinnersName"].Index; int secondNameColIndex = _grid.Columns["SecondHorseName"].Index; int thirdNameColIndex = _grid.Columns["ThirdHorseName"].Index; int conditionColIndex = _grid.Columns["Race Class"].Index; int jockeyColIndex = _grid.Columns["Jockey"].Index; if (0 == e.ColumnIndex) { var pp = (BrisPastPerformance) _grid.Rows[e.RowIndex].Cells["ID_PP_OBJECT"].Value; pp.Parent.CorrespondingHorse.SelectedRunningLine = pp; for (int i = 0; i < _grid.Rows.Count; ++i) { PaintSelectedRunningLineCell(i); } } else if (e.ColumnIndex == winnersNameColIndex || e.ColumnIndex == secondNameColIndex || e.ColumnIndex == thirdNameColIndex) { string horseName = _grid[e.ColumnIndex, e.RowIndex].Value.ToString(); var f = new ShowRacesByHorseForm(horseName); f.ShowDialog(); } else if (e.ColumnIndex == conditionColIndex) { var pp = (BrisPastPerformance) _grid.Rows[e.RowIndex].Cells["ID_PP_OBJECT"].Value; _shortRaceChartControl.Bind(pp); int raceNumber; if (int.TryParse(pp.RaceNumber, out raceNumber)) { _xRayCtrl.Bind(pp.Date, pp.TrackCode, pp.Parent.Name, raceNumber); } else { _xRayCtrl.Clear(); } } else if (e.ColumnIndex == jockeyColIndex) { var pp = (BrisPastPerformance) _grid.Rows[e.RowIndex].Cells["ID_PP_OBJECT"].Value; var jsf = new JockeyStatisticsForm(pp.Jockey); jsf.ShowDialog(); } else if (e.ColumnIndex == _grid.Columns["PostPosition"].Index) { var ctrl = sender as Control; var pp = (BrisPastPerformance) _grid.Rows[e.RowIndex].Cells["ID_PP_OBJECT"].Value; string trackCode = pp.TrackCode; string surface = pp.Surface.ToUpper(); if (surface == "ID") { surface = "d"; } if (surface == "IT") { surface = "t"; } int distance = pp.DistanceInYards; string distanceFlag = pp.AboutDistanceFlag ? "A" : ""; var postPositionPopUp = new PostPositionStatsForm(trackCode, surface, distanceFlag, distance); postPositionPopUp.ShowDialog(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }