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_date_add_Click(object sender, RoutedEventArgs e) { if (radioButton_week.IsChecked == false) { var info = new EpgSearchDateInfo(); info.startDayOfWeek = (byte)comboBox_time_sw.SelectedIndex; info.startHour = (ushort)comboBox_time_sh.SelectedIndex; info.startMin = (ushort)comboBox_time_sm.SelectedIndex; info.endDayOfWeek = (byte)comboBox_time_ew.SelectedIndex; info.endHour = (ushort)comboBox_time_eh.SelectedIndex; info.endMin = (ushort)comboBox_time_em.SelectedIndex; listBox_date.ScrollIntoViewLast(new DateItem(info)); } else { listBox_date.ScrollIntoViewLast(chbxWeekList.Where(box => box.IsChecked == true).Select(box => { var info = new EpgSearchDateInfo(); info.startDayOfWeek = info.endDayOfWeek = (byte)box.Tag; info.startHour = (ushort)comboBox_week_sh.SelectedIndex; info.startMin = (ushort)comboBox_week_sm.SelectedIndex; info.endHour = (ushort)comboBox_week_eh.SelectedIndex; info.endMin = (ushort)comboBox_week_em.SelectedIndex; info.RegulateData(); return(new DateItem(info)); })); } CheckListBox(listBox_date); }
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)); }
private static void CopyData(EpgSearchDateInfo src, EpgSearchDateInfo dest) { dest.endDayOfWeek = src.endDayOfWeek; dest.endHour = src.endHour; dest.endMin = src.endMin; dest.startDayOfWeek = src.startDayOfWeek; dest.startHour = src.startHour; dest.startMin = src.startMin; }
private void button_date_add_Click(object sender, RoutedEventArgs e) { if (radioButton_week.IsChecked == false) { var info = new EpgSearchDateInfo(); info.startDayOfWeek = (byte)Math.Min(Math.Max(comboBox_time_sw.SelectedIndex, 0), 6); info.startHour = (ushort)Math.Min(Math.Max(comboBox_time_sh.SelectedIndex, 0), 23); info.startMin = (ushort)Math.Min(Math.Max(comboBox_time_sm.SelectedIndex, 0), 59); info.endDayOfWeek = (byte)Math.Min(Math.Max(comboBox_time_ew.SelectedIndex, 0), 6); info.endHour = (ushort)Math.Min(Math.Max(comboBox_time_eh.SelectedIndex, 0), 23); info.endMin = (ushort)Math.Min(Math.Max(comboBox_time_em.SelectedIndex, 0), 59); EnableDateListBox(true); var item = new DateItem(); item.DateInfo = info; listBox_date.Items.Add(item); } else { int startHour = Math.Min(Math.Max(comboBox_week_sh.SelectedIndex, 0), 23); int startMin = Math.Min(Math.Max(comboBox_week_sm.SelectedIndex, 0), 59); int endHour = Math.Min(Math.Max(comboBox_time_eh.SelectedIndex, 0), 23); int endMin = Math.Min(Math.Max(comboBox_time_em.SelectedIndex, 0), 59); var Add_week = new Action <CheckBox, byte>((chbox, day) => { if (chbox.IsChecked != true) { return; } // var info = new EpgSearchDateInfo(); info.startDayOfWeek = day; info.startHour = (ushort)startHour; info.startMin = (ushort)startMin; info.endDayOfWeek = info.startDayOfWeek; info.endHour = (ushort)endHour; info.endMin = (ushort)endMin; if (endHour * 60 + endMin < startHour * 60 + startMin) { //終了時間は翌日のものとみなす info.endDayOfWeek = (byte)((info.endDayOfWeek + 1) % 7); } EnableDateListBox(true); var item = new DateItem(); item.DateInfo = info; listBox_date.Items.Add(item); }); Add_week(checkBox_sun, 0); Add_week(checkBox_mon, 1); Add_week(checkBox_tue, 2); Add_week(checkBox_wed, 3); Add_week(checkBox_thu, 4); Add_week(checkBox_fri, 5); Add_week(checkBox_sat, 6); } }
public static void RegulateData(this EpgSearchDateInfo info) { //早い終了時間を翌日のものとみなす Int32 start = (info.startHour) * 60 + info.startMin; Int32 end = (info.endHour) * 60 + info.endMin; while (end < start) { end += 24 * 60; info.endDayOfWeek = (byte)((info.endDayOfWeek + 1) % 7); } //28時間表示対応の処置。実際はシフトは1回で十分ではある。 while (info.startHour >= 24) { ShiftRecDayPart(1, ref info.startHour, ref info.startDayOfWeek); } while (info.endHour >= 24) { ShiftRecDayPart(1, ref info.endHour, ref info.endDayOfWeek); } }
private void button_date_add_Click(object sender, RoutedEventArgs e) { for (byte day = 0; day < 7; day++) { var info = new EpgSearchDateInfo(); info.endHour = (ushort)Math.Min(Math.Max(comboBox_time_eh.SelectedIndex, 0), 23); info.endMin = (ushort)Math.Min(Math.Max(comboBox_time_em.SelectedIndex, 0), 59); if (radioButton_week.IsChecked == false) { info.startDayOfWeek = (byte)Math.Min(Math.Max(comboBox_time_sw.SelectedIndex, 0), 6); info.startHour = (ushort)Math.Min(Math.Max(comboBox_time_sh.SelectedIndex, 0), 23); info.startMin = (ushort)Math.Min(Math.Max(comboBox_time_sm.SelectedIndex, 0), 59); info.endDayOfWeek = (byte)Math.Min(Math.Max(comboBox_time_ew.SelectedIndex, 0), 6); day = 6; } else { var chbox = (new CheckBox[] { checkBox_sun, checkBox_mon, checkBox_tue, checkBox_wed, checkBox_thu, checkBox_fri, checkBox_sat })[day]; if (chbox.IsChecked != true) { continue; } info.startDayOfWeek = day; info.startHour = (ushort)Math.Min(Math.Max(comboBox_week_sh.SelectedIndex, 0), 23); info.startMin = (ushort)Math.Min(Math.Max(comboBox_week_sm.SelectedIndex, 0), 59); info.endDayOfWeek = info.startDayOfWeek; if (info.endHour * 60 + info.endMin < info.startHour * 60 + info.startMin) { //終了時間は翌日のものとみなす info.endDayOfWeek = (byte)((info.endDayOfWeek + 1) % 7); } } EnableDateListBox(true); listBox_date.Items.Add(new Tuple <string, EpgSearchDateInfo>( (new DateTime(2000, 1, 2 + info.startDayOfWeek, info.startHour, info.startMin, 0)).ToString("ddd HH\\:mm") + (new DateTime(2000, 1, 2 + info.endDayOfWeek, info.endHour, info.endMin, 0)).ToString(" ~ ddd HH\\:mm"), info)); } }
private void button_weekAdd_Click(object sender, RoutedEventArgs e) { if (comboBox_week_sh.SelectedItem == null || comboBox_week_sm.SelectedItem == null || comboBox_week_eh.SelectedItem == null || comboBox_week_em.SelectedItem == null) { return; } var Add_week = new Action <CheckBox, byte>((chbox, day) => { if (chbox.IsChecked != true) { return; } // var info = new EpgSearchDateInfo(); info.startDayOfWeek = day; info.startHour = (UInt16)comboBox_week_sh.SelectedIndex; info.startMin = (UInt16)comboBox_week_sm.SelectedIndex; info.endDayOfWeek = info.startDayOfWeek; info.endHour = (UInt16)comboBox_week_eh.SelectedIndex; info.endMin = (UInt16)comboBox_week_em.SelectedIndex; info.RegulateData(); listBox_date.Items.Add(new DateItem(info)); }); Add_week(checkBox_mon, 1); Add_week(checkBox_tue, 2); Add_week(checkBox_wen, 3); Add_week(checkBox_thu, 4); Add_week(checkBox_fri, 5); Add_week(checkBox_sat, 6); Add_week(checkBox_sun, 0); }
public static void CopyTo(this EpgSearchDateInfo src, EpgSearchDateInfo dest) { CopyObj.CopyTo(src, dest, CopyData); }
private void button_weekAdd_Click(object sender, RoutedEventArgs e) { if (comboBox_week_sh.SelectedItem == null || comboBox_week_sm.SelectedItem == null || comboBox_week_eh.SelectedItem == null || comboBox_week_em.SelectedItem == null) { return; } var Add_week = new Action<CheckBox, byte>((chbox, day) => { if (chbox.IsChecked != true) return; // var info = new EpgSearchDateInfo(); info.startDayOfWeek = day; info.startHour = (UInt16)comboBox_week_sh.SelectedIndex; info.startMin = (UInt16)comboBox_week_sm.SelectedIndex; info.endDayOfWeek = info.startDayOfWeek; info.endHour = (UInt16)comboBox_week_eh.SelectedIndex; info.endMin = (UInt16)comboBox_week_em.SelectedIndex; info.RegulateData(); listBox_date.Items.Add(new DateItem(info)); }); Add_week(checkBox_mon, 1); Add_week(checkBox_tue, 2); Add_week(checkBox_wen, 3); Add_week(checkBox_thu, 4); Add_week(checkBox_fri, 5); Add_week(checkBox_sat, 6); Add_week(checkBox_sun, 0); }
public static EpgSearchDateInfo Clone(this EpgSearchDateInfo src) { return(CopyObj.Clone(src, CopyData)); }
public static String ConvertTimeText(EpgSearchDateInfo info) { //超手抜き。書式が変ったら、巻き込まれて死ぬ。 var start = new DateTime(2000, 1, 2 + info.startDayOfWeek, info.startHour, info.startMin, 0); var end = new DateTime(2000, 1, 2 + info.endDayOfWeek, info.endHour, info.endMin, 0); if (end < start) end = end.AddDays(7); string reftxt = ConvertTimeText(start, (uint)(end - start).TotalSeconds, true, true, false, false); string[] src = reftxt.Split(new char[] { ' ', '~' }); return src[0].Substring(6, 1) + " " + src[1] + " ~ " + src[2].Substring(6, 1) + " " + src[3]; }
public bool LoadEAAFile(String filePath) { bool ret = false; System.IO.StreamReader reader = null; try { reader = (new System.IO.StreamReader(filePath, System.Text.Encoding.Default)); while (reader.Peek() >= 0) { string buff = reader.ReadLine(); if (buff.IndexOf(";") == 0) { //コメント行 } else { AddKey = new EpgAutoAddData(); EpgSearchKeyInfo searchKey = new EpgSearchKeyInfo(); RecSettingData recSetKey = new RecSettingData(); string[] list = buff.Split('\t'); if (list.Length == 0) { continue; } try { searchKey.andKey = list[0]; searchKey.notKey = list[1]; searchKey.regExpFlag = Convert.ToByte(list[2]); searchKey.titleOnlyFlag = Convert.ToByte(list[3]); //対象ジャンル searchKey.contentList = new List<EpgContentData>(); string[] valBuff; if (list[4].Length > 0) { valBuff = list[4].Split(','); foreach (string val in valBuff) { UInt32 content = Convert.ToUInt32(val); EpgContentData addItem = new EpgContentData(); addItem.content_nibble_level_1 = (byte)((content & 0xFF000000) >> 24); addItem.content_nibble_level_2 = (byte)((content & 0x00FF0000) >> 16); addItem.user_nibble_1 = (byte)((content & 0x0000FF00) >> 8); addItem.user_nibble_2 = (byte)((content & 0x000000FF)); searchKey.contentList.Add(addItem); } } //対象期間 searchKey.dateList = new List<EpgSearchDateInfo>(); if (list[5].Length > 0) { valBuff = list[5].Split(','); foreach (string val in valBuff) { string[] dateBuff = val.Split('-'); EpgSearchDateInfo addItem = new EpgSearchDateInfo(); addItem.startDayOfWeek = Convert.ToByte(dateBuff[0]); UInt32 time = Convert.ToUInt32(dateBuff[1]); addItem.startHour = (UInt16)((time & 0xFFFF0000) >> 16); addItem.startMin = (UInt16)((time & 0x0000FFFF)); addItem.endDayOfWeek = Convert.ToByte(dateBuff[2]); time = Convert.ToUInt32(dateBuff[3]); addItem.endHour = (UInt16)((time & 0xFFFF0000) >> 16); addItem.endMin = (UInt16)((time & 0x0000FFFF)); searchKey.dateList.Add(addItem); } } //対象サービス searchKey.serviceList = new List<long>(); if (list[6].Length > 0) { valBuff = list[6].Split(','); foreach (string val in valBuff) { Int64 addItem = 0; addItem = Convert.ToInt64(val, 16); searchKey.serviceList.Add(addItem); } } searchKey.aimaiFlag = Convert.ToByte(list[7]); Settings.GetDefRecSetting(0, ref recSetKey); AddKey.searchInfo = searchKey; AddKey.recSetting = recSetKey; ret = true; } catch { } } } } catch { AddKey = null; } if( reader != null ){ reader.Close(); } return ret; }
private void button_weekAdd_Click(object sender, RoutedEventArgs e) { if (comboBox_week_sh.SelectedItem == null || comboBox_week_sm.SelectedItem == null || comboBox_week_eh.SelectedItem == null || comboBox_week_em.SelectedItem == null) { return; } Int32 start = ((UInt16)comboBox_week_sh.SelectedItem) * 60; start += (UInt16)comboBox_week_sm.SelectedItem; Int32 end = ((UInt16)comboBox_week_eh.SelectedItem) * 60; end += (UInt16)comboBox_week_em.SelectedItem; if (end < start) { MessageBox.Show("開始時間が終了時間より前です"); return; } if (checkBox_mon.IsChecked == true) { DateItem item = new DateItem(); EpgSearchDateInfo info = new EpgSearchDateInfo(); info.startDayOfWeek = 1; info.startHour = (UInt16)comboBox_week_sh.SelectedItem; info.startMin = (UInt16)comboBox_week_sm.SelectedItem; info.endDayOfWeek = 1; info.endHour = (UInt16)comboBox_week_eh.SelectedItem; info.endMin = (UInt16)comboBox_week_em.SelectedItem; String viewText = ""; viewText = "月 " + info.startHour.ToString("00") + ":" + info.startMin.ToString("00") + " ~ " + "月 " + info.endHour.ToString("00") + ":" + info.endMin.ToString("00"); item.DateInfo = info; item.ViewText = viewText; listBox_date.Items.Add(item); } if (checkBox_tue.IsChecked == true) { DateItem item = new DateItem(); EpgSearchDateInfo info = new EpgSearchDateInfo(); info.startDayOfWeek = 2; info.startHour = (UInt16)comboBox_week_sh.SelectedItem; info.startMin = (UInt16)comboBox_week_sm.SelectedItem; info.endDayOfWeek = 2; info.endHour = (UInt16)comboBox_week_eh.SelectedItem; info.endMin = (UInt16)comboBox_week_em.SelectedItem; String viewText = ""; viewText = "火 " + info.startHour.ToString("00") + ":" + info.startMin.ToString("00") + " ~ " + "火 " + info.endHour.ToString("00") + ":" + info.endMin.ToString("00"); item.DateInfo = info; item.ViewText = viewText; listBox_date.Items.Add(item); } if (checkBox_wen.IsChecked == true) { DateItem item = new DateItem(); EpgSearchDateInfo info = new EpgSearchDateInfo(); info.startDayOfWeek = 3; info.startHour = (UInt16)comboBox_week_sh.SelectedItem; info.startMin = (UInt16)comboBox_week_sm.SelectedItem; info.endDayOfWeek = 3; info.endHour = (UInt16)comboBox_week_eh.SelectedItem; info.endMin = (UInt16)comboBox_week_em.SelectedItem; String viewText = ""; viewText = "水 " + info.startHour.ToString("00") + ":" + info.startMin.ToString("00") + " ~ " + "水 " + info.endHour.ToString("00") + ":" + info.endMin.ToString("00"); item.DateInfo = info; item.ViewText = viewText; listBox_date.Items.Add(item); } if (checkBox_thu.IsChecked == true) { DateItem item = new DateItem(); EpgSearchDateInfo info = new EpgSearchDateInfo(); info.startDayOfWeek = 4; info.startHour = (UInt16)comboBox_week_sh.SelectedItem; info.startMin = (UInt16)comboBox_week_sm.SelectedItem; info.endDayOfWeek = 4; info.endHour = (UInt16)comboBox_week_eh.SelectedItem; info.endMin = (UInt16)comboBox_week_em.SelectedItem; String viewText = ""; viewText = "木 " + info.startHour.ToString("00") + ":" + info.startMin.ToString("00") + " ~ " + "木 " + info.endHour.ToString("00") + ":" + info.endMin.ToString("00"); item.DateInfo = info; item.ViewText = viewText; listBox_date.Items.Add(item); } if (checkBox_fri.IsChecked == true) { DateItem item = new DateItem(); EpgSearchDateInfo info = new EpgSearchDateInfo(); info.startDayOfWeek = 5; info.startHour = (UInt16)comboBox_week_sh.SelectedItem; info.startMin = (UInt16)comboBox_week_sm.SelectedItem; info.endDayOfWeek = 5; info.endHour = (UInt16)comboBox_week_eh.SelectedItem; info.endMin = (UInt16)comboBox_week_em.SelectedItem; String viewText = ""; viewText = "金 " + info.startHour.ToString("00") + ":" + info.startMin.ToString("00") + " ~ " + "金 " + info.endHour.ToString("00") + ":" + info.endMin.ToString("00"); item.DateInfo = info; item.ViewText = viewText; listBox_date.Items.Add(item); } if (checkBox_sat.IsChecked == true) { DateItem item = new DateItem(); EpgSearchDateInfo info = new EpgSearchDateInfo(); info.startDayOfWeek = 6; info.startHour = (UInt16)comboBox_week_sh.SelectedItem; info.startMin = (UInt16)comboBox_week_sm.SelectedItem; info.endDayOfWeek = 6; info.endHour = (UInt16)comboBox_week_eh.SelectedItem; info.endMin = (UInt16)comboBox_week_em.SelectedItem; String viewText = ""; viewText = "土 " + info.startHour.ToString("00") + ":" + info.startMin.ToString("00") + " ~ " + "土 " + info.endHour.ToString("00") + ":" + info.endMin.ToString("00"); item.DateInfo = info; item.ViewText = viewText; listBox_date.Items.Add(item); } if (checkBox_sun.IsChecked == true) { DateItem item = new DateItem(); EpgSearchDateInfo info = new EpgSearchDateInfo(); info.startDayOfWeek = 0; info.startHour = (UInt16)comboBox_week_sh.SelectedItem; info.startMin = (UInt16)comboBox_week_sm.SelectedItem; info.endDayOfWeek = 0; info.endHour = (UInt16)comboBox_week_eh.SelectedItem; info.endMin = (UInt16)comboBox_week_em.SelectedItem; String viewText = ""; viewText = "日 " + info.startHour.ToString("00") + ":" + info.startMin.ToString("00") + " ~ " + "日 " + info.endHour.ToString("00") + ":" + info.endMin.ToString("00"); item.DateInfo = info; item.ViewText = viewText; listBox_date.Items.Add(item); } }
public DateItem(EpgSearchDateInfo info) { DateInfo = info; }
public bool LoadEAAFile(String filePath) { bool ret = false; System.IO.StreamReader reader = null; try { reader = (new System.IO.StreamReader(filePath, System.Text.Encoding.Default)); while (reader.Peek() >= 0) { string buff = reader.ReadLine(); if (buff.IndexOf(";") == 0) { //コメント行 } else { AddKey = new EpgAutoAddData(); EpgSearchKeyInfo searchKey = new EpgSearchKeyInfo(); RecSettingData recSetKey = new RecSettingData(); string[] list = buff.Split('\t'); if (list.Length == 0) { continue; } try { searchKey.andKey = list[0]; searchKey.notKey = list[1]; searchKey.regExpFlag = Convert.ToByte(list[2]); searchKey.titleOnlyFlag = Convert.ToByte(list[3]); //対象ジャンル searchKey.contentList = new List <EpgContentData>(); string[] valBuff; if (list[4].Length > 0) { valBuff = list[4].Split(','); foreach (string val in valBuff) { UInt32 content = Convert.ToUInt32(val); EpgContentData addItem = new EpgContentData(); addItem.content_nibble_level_1 = (byte)((content & 0xFF000000) >> 24); addItem.content_nibble_level_2 = (byte)((content & 0x00FF0000) >> 16); addItem.user_nibble_1 = (byte)((content & 0x0000FF00) >> 8); addItem.user_nibble_2 = (byte)((content & 0x000000FF)); searchKey.contentList.Add(addItem); } } //対象期間 searchKey.dateList = new List <EpgSearchDateInfo>(); if (list[5].Length > 0) { valBuff = list[5].Split(','); foreach (string val in valBuff) { string[] dateBuff = val.Split('-'); EpgSearchDateInfo addItem = new EpgSearchDateInfo(); addItem.startDayOfWeek = Convert.ToByte(dateBuff[0]); UInt32 time = Convert.ToUInt32(dateBuff[1]); addItem.startHour = (UInt16)((time & 0xFFFF0000) >> 16); addItem.startMin = (UInt16)((time & 0x0000FFFF)); addItem.endDayOfWeek = Convert.ToByte(dateBuff[2]); time = Convert.ToUInt32(dateBuff[3]); addItem.endHour = (UInt16)((time & 0xFFFF0000) >> 16); addItem.endMin = (UInt16)((time & 0x0000FFFF)); searchKey.dateList.Add(addItem); } } //対象サービス searchKey.serviceList = new List <UInt64>(); if (list[6].Length > 0) { valBuff = list[6].Split(','); foreach (string val in valBuff) { UInt64 addItem = 0; addItem = Convert.ToUInt64(val, 16); searchKey.serviceList.Add(addItem); } } searchKey.aimaiFlag = Convert.ToByte(list[7]); Settings.GetDefRecSetting(0, ref recSetKey); AddKey.searchInfo = searchKey; AddKey.recSetting = recSetKey; ret = true; } catch { } } } } catch { AddKey = null; } if (reader != null) { reader.Close(); } return(ret); }
private void button_weekAdd_Click(object sender, RoutedEventArgs e) { if (comboBox_week_sh.SelectedItem == null || comboBox_week_sm.SelectedItem == null || comboBox_week_eh.SelectedItem == null || comboBox_week_em.SelectedItem == null) { return; } Int32 start = ((UInt16)comboBox_week_sh.SelectedItem) * 60+ (UInt16)comboBox_week_sm.SelectedItem; Int32 end = ((UInt16)comboBox_week_eh.SelectedItem) * 60+ (UInt16)comboBox_week_em.SelectedItem; var Add_week = new Action<CheckBox, byte>((chbox, day) => { if (chbox.IsChecked != true) return; // var info = new EpgSearchDateInfo(); info.startDayOfWeek = day; info.startHour = (UInt16)comboBox_week_sh.SelectedItem; info.startMin = (UInt16)comboBox_week_sm.SelectedItem; info.endDayOfWeek = info.startDayOfWeek; info.endHour = (UInt16)comboBox_week_eh.SelectedItem; info.endMin = (UInt16)comboBox_week_em.SelectedItem; if (end < start) { //終了時間は翌日のものとみなす info.endDayOfWeek = (byte)((info.endDayOfWeek + 1) % 7); } string viewText = "日月火水木金土"[info.startDayOfWeek] + " " + info.startHour.ToString("00") + ":" + info.startMin.ToString("00") + " ~ " + "日月火水木金土"[info.endDayOfWeek] + " " + info.endHour.ToString("00") + ":" + info.endMin.ToString("00"); var item = new DateItem(); item.DateInfo = info; item.ViewText = viewText; listBox_date.Items.Add(item); }); Add_week(checkBox_mon, 1); Add_week(checkBox_tue, 2); Add_week(checkBox_wen, 3); Add_week(checkBox_thu, 4); Add_week(checkBox_fri, 5); Add_week(checkBox_sat, 6); Add_week(checkBox_sun, 0); }