private void btAdd_Click_1(object sender, EventArgs e) { AddRecordingForm addRecordingForm = new AddRecordingForm(); addRecordingForm.ShowDialog(); RefreshDataViewGrid(); }
private void btView_Click(object sender, EventArgs e) { ScheduleItem scheduleItem = new ScheduleItem(); scheduleItem.ChannelToRecord = dataGridView1.CurrentRow.Cells["Channel"].Value.ToString(); scheduleItem.StartTime = DateTime.ParseExact(dataGridView1.CurrentRow.Cells["Start"].Value.ToString(), "M/dd/yyyy h:mm:ss tt", System.Globalization.CultureInfo.InvariantCulture); scheduleItem.EndTime = DateTime.ParseExact(dataGridView1.CurrentRow.Cells["End"].Value.ToString(), "M/dd/yyyy h:mm:ss tt", System.Globalization.CultureInfo.InvariantCulture); Dictionary <string, bool> daysToRecord = new Dictionary <string, bool>(); // Store days of week and checkbox value in a dictionary daysToRecord["Sunday"] = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["Sunday"].Value); daysToRecord["Monday"] = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["Monday"].Value); daysToRecord["Tuesday"] = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["Tuesday"].Value); daysToRecord["Wednesday"] = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["Wednesday"].Value); daysToRecord["Thursday"] = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["Thursday"].Value); daysToRecord["Friday"] = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["Friday"].Value); daysToRecord["Saturday"] = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["Saturday"].Value); daysToRecord["Sunday"] = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["Sunday"].Value); scheduleItem.DaysToRecord = daysToRecord; scheduleItem.Repeat = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["Repeat"].Value); AddRecordingForm addRecordingForm = new AddRecordingForm() { ScheduleItem = scheduleItem }; addRecordingForm.InitializeFields(); addRecordingForm.ShowDialog(); }