//method to change the data grid if the repository combo box is changed private void comboBoxChooseRepo_SelectedIndexChanged(object sender, EventArgs e) { //populate the data grid based on the newly selected combo box item PopulateGrid(CallRecordFactory.GetCallRecordRepo(comboBoxChooseRepo.SelectedItem.ToString())); //when it's changed, we need to load the proper phone numbers for the other combo box InitializeComboBoxFromPhoneNumber(); }
//form onload method private void MainForm_Load(object sender, EventArgs e) { //set up the repository combo box IntializeComboBoxRepo(); //populate the data grid with the first entry in the repo combo box PopulateGrid(CallRecordFactory.GetCallRecordRepo(comboBoxChooseRepo.SelectedItem.ToString())); //show only the records from the first phone number in the combo box InitializeComboBoxFromPhoneNumber(); }
//method to change the data grid if the check box for answered calls only is checked or not private void checkBoxAnsweredCalls_CheckedChanged(object sender, EventArgs e) { //show only answered calls if (checkBoxAnsweredCalls.Checked) { ShowAnsweredOnly(_callRecords); } //otherwise re-populate the grid by the chosen phone number else { PopulateGridByPhoneNumber(CallRecordFactory.GetCallRecordRepo(comboBoxChooseRepo.SelectedItem.ToString())); } }
//method for when the selected item in the fromPhoneNumber combo box changes private void comboBoxFromPhoneNumber_SelectedIndexChanged(object sender, EventArgs e) { //re-populate the data grid with entries with a different fromPhoneNumber using the selected repository PopulateGridByPhoneNumber(CallRecordFactory.GetCallRecordRepo(comboBoxChooseRepo.SelectedItem.ToString())); }