private void SelectExoticCombination(ExoticCombination ec) { int index = _gridSelectedExoticCombinations.Rows.Add(); _gridSelectedExoticCombinations.Rows[index].Tag = ec; _gridSelectedExoticCombinations[0, index].Value = string.Format("{0} X {1}", ec.FirstHorse, ec.SecondHorse); _gridSelectedExoticCombinations[1, index].Value = ec.Payout; UpdateNumberOfCombinationsTextBox(); }
private void UnselectExoticCombination(ExoticCombination ec) { DataGridViewRow rowToRemove = null; foreach (DataGridViewRow row in _gridSelectedExoticCombinations.Rows) { if (row.Tag == ec) { rowToRemove = row; break; } } if (null != rowToRemove) { _gridSelectedExoticCombinations.Rows.Remove(rowToRemove); } UpdateNumberOfCombinationsTextBox(); }
private void OnInitialLoad(object sender, EventArgs e) { MakeTitle(); if (null == _oddsRetriver) { MessageBox.Show("Please start the Odds Retriever prior to open the Exacta form monitor"); return; } _labelRaceTrack.Text = string.Format("{0} Race# {1}", _oddsRetriver.TrackName, _oddsRetriver.RaceNumber); _gridSelectedExoticCombinations.Columns.Clear(); _gridSelectedExoticCombinations.Columns.Add("Combo", "Combo"); _gridSelectedExoticCombinations.Columns.Add("Price", "Price"); _gridSelectedExoticCombinations.Columns.Add("Bet", "Bet"); _gridSelectedExoticCombinations.Columns.Add("Rounded", "Rounded"); _gridSelectedExoticCombinations.Columns["Price"].CellTemplate.ValueType = typeof(double); _gridSelectedExoticCombinations.Columns["Bet"].CellTemplate.ValueType = typeof(double); _gridSelectedExoticCombinations.Columns["Rounded"].CellTemplate.ValueType = typeof(double); _gridSelectedExoticCombinations.Columns["Price"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; _gridSelectedExoticCombinations.Columns["Bet"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; _gridSelectedExoticCombinations.Columns["Rounded"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; _gridSelectedExoticCombinations.Columns["Price"].DefaultCellStyle.Format = "##.00"; _gridSelectedExoticCombinations.Columns["Bet"].DefaultCellStyle.Format = "##.00"; _gridSelectedExoticCombinations.Columns["Rounded"].DefaultCellStyle.Format = "##"; _gridSelectedExoticCombinations.Columns["Price"].Visible = false; _gridSelectedExoticCombinations.Columns["Bet"].Visible = false; DataTable dt = DataTableToUse; if (null == dt) { MessageBox.Show("Sorry data not available"); } for (int col = 0; col < dt.Columns.Count; ++col) { string colName = (col + 1).ToString(); _gridExoticCombination.Columns.Add(colName, colName); } for (int row = 0; row < dt.Rows.Count; ++row) { int index = _gridExoticCombination.Rows.Add(); string rowName = (row + 1).ToString(); _gridExoticCombination.Rows[index].HeaderCell.Value = rowName; } for (int col = 0; col < dt.Columns.Count; ++col) { for (int row = 0; row < dt.Rows.Count; ++row) { ExoticCombination ec = new ExoticCombination(row + 1, col + 1, (double)dt.Rows[row][col]); _gridExoticCombination[col, row].Value = ec; PaintExoticCombinationGridCell(col, row); } } _gridExoticCombination.DefaultCellStyle.SelectionBackColor = Color.White; _gridExoticCombination.DefaultCellStyle.SelectionForeColor = Color.Black; _txtboxAmountToWin.Text = "1000"; _oddsRetriver.UpdateObserverDelegateEvent += _oddsRetriver_UpdateObserverDelegateEvent; }