public FactorStatsPerTrainerForm(Horse horse, long bitMask) { _horse = horse; _selectedFactorStatistic = FactorStatisticManager.Get(bitMask); _selectedFactorStatisticForTrainer = FactorStatisticManager.Get(bitMask,_horse.CorrespondingBrisHorse.TrainersFullName); _trainerSummary = TrainerSummary.Make(_horse.CorrespondingBrisHorse.TrainersFullName); _horseFactors = horse.FactorStatisticsForHorse; InitializeComponent(); }
private void AddFactorToGrid(FactorStatistic fs) { int rowIndex = _grid.Rows.Add(); var cells = _grid.Rows[rowIndex].Cells; cells[0].Value = fs.Name; cells[1].Value = fs; cells[2].Value = FactorStatisticManager.Get(fs.BitMask, _horse.CorrespondingBrisHorse.TrainersFullName); _grid.Rows[rowIndex].Tag = fs; }
private void _gridFactorsStatistics_CellClick(object sender, DataGridViewCellEventArgs e) { if(e.RowIndex >= 0 && e.RowIndex < _gridFactorsStatistics.Rows.Count) { var row = _gridFactorsStatistics.Rows[e.RowIndex]; long factorFlag = (long)row.Tag; foreach (var hf in _horseFactors) { if(hf.BitMask == factorFlag) { _selectedFactorStatistic = FactorStatisticManager.Get(factorFlag); _selectedFactorStatisticForTrainer = FactorStatisticManager.Get(factorFlag, _horse.CorrespondingBrisHorse.TrainersFullName); UpdateDisplay(); return; } } MessageBox.Show("Unmacthed factor"); } }