private void button_timeAdd_Click(object sender, RoutedEventArgs e) { if (comboBox_time_sw.SelectedItem == null || comboBox_time_sh.SelectedItem == null || comboBox_time_sm.SelectedItem == null || comboBox_time_ew.SelectedItem == null || comboBox_time_eh.SelectedItem == null || comboBox_time_em.SelectedItem == null) { return; } DateItem item = new DateItem(); EpgSearchDateInfo info = new EpgSearchDateInfo(); DayOfWeekInfo startWeek = comboBox_time_sw.SelectedItem as DayOfWeekInfo; DayOfWeekInfo endWeek = comboBox_time_ew.SelectedItem as DayOfWeekInfo; info.startDayOfWeek = startWeek.Value; info.startHour = (UInt16)comboBox_time_sh.SelectedItem; info.startMin = (UInt16)comboBox_time_sm.SelectedItem; info.endDayOfWeek = endWeek.Value; info.endHour = (UInt16)comboBox_time_eh.SelectedItem; info.endMin = (UInt16)comboBox_time_em.SelectedItem; String viewText = ""; viewText = startWeek.DisplayName + " " + info.startHour.ToString("00") + ":" + info.startMin.ToString("00") + " ~ " + endWeek.DisplayName + " " + info.endHour.ToString("00") + ":" + info.endMin.ToString("00"); item.DateInfo = info; item.ViewText = viewText; listBox_date.Items.Add(item); }
private void button_timeAdd_Click(object sender, RoutedEventArgs e) { if (comboBox_time_sw.SelectedItem == null || comboBox_time_sh.SelectedItem == null || comboBox_time_sm.SelectedItem == null || comboBox_time_ew.SelectedItem == null || comboBox_time_eh.SelectedItem == null || comboBox_time_em.SelectedItem == null) { return; } EpgSearchDateInfo info = new EpgSearchDateInfo(); DayOfWeekInfo startWeek = comboBox_time_sw.SelectedItem as DayOfWeekInfo; DayOfWeekInfo endWeek = comboBox_time_ew.SelectedItem as DayOfWeekInfo; info.startDayOfWeek = startWeek.Value; info.startHour = (UInt16)comboBox_time_sh.SelectedIndex; info.startMin = (UInt16)comboBox_time_sm.SelectedIndex; info.endDayOfWeek = endWeek.Value; info.endHour = (UInt16)comboBox_time_eh.SelectedIndex; info.endMin = (UInt16)comboBox_time_em.SelectedIndex; listBox_date.Items.Add(new DateItem(info)); }