private void ReserveModeChanged(bool programMode) { SetResModeProgram(programMode); eventInfoNow = null; if (programMode == false) { var resInfo = new ReserveData(); GetReserveTimeInfo(ref resInfo); //EPGデータが読込まれていない場合も考慮し、先に判定する。 if (reserveInfo.IsEpgReserve == true && reserveInfo.IsSamePg(resInfo) == true) { //EPG予約で、元の状態に戻る場合 textBox_title.Text = reserveInfo.Title; } else { eventInfoNow = resInfo.SearchEventInfoLikeThat(); if (eventInfoNow == null) { MessageBox.Show("変更可能な番組がありません。\r\n" + "EPGの期間外か、EPGデータが読み込まれていません。"); SetResModeProgram(true); } else { SetReserveTimeInfo(CtrlCmdDefEx.ConvertEpgToReserveData(eventInfoNow)); } } } }
protected override void SetData(bool IsAllData = false) { base.SetData(IsAllData); if (_getSearchList != null)//SearchItemリストがある場合 { List <SearchItem> searchList = _getSearchList(IsAllData); searchList = searchList == null ? new List <SearchItem>() : searchList.OfType <SearchItem>().ToList();//無くても大丈夫なはずだが一応 OrderAdjust <SearchItem>(searchList, _selectSingleSearchData); dataList = searchList.GetReserveList(); eventList = searchList.GetEventList(); eventListEx = searchList.GetNoReserveList(); headData = searchList.Count == 0 ? null : searchList[0].IsReserved == true ? searchList[0].ReserveInfo as object : searchList[0].EventInfo as object; } else { eventList = _getEpgEventList == null ? null : _getEpgEventList(); eventList = eventList == null ? new List <EpgEventInfo>() : eventList.OfType <EpgEventInfo>().ToList(); eventListEx = new List <EpgEventInfo>(); eventList.ForEach(epg => { if (dataList.All(res => CtrlCmdDefEx.EqualsPg(epg, res) == false)) { eventListEx.Add(epg); } }); headData = dataList.Count != 0 ? dataList[0] as object : eventList.Count != 0 ? eventList[0] as object : null; } }
protected override void mc_ToAutoadd(object sender, ExecutedRoutedEventArgs e) { ReserveData resData = null; IBasicPgInfo eventRefData = null; if (eventList.Count != 0) { resData = CtrlCmdDefEx.ConvertEpgToReserveData(eventList[0]); if (dataList.Count != 0) { resData.RecSetting = dataList[0].RecSetting.DeepClone(); } else { resData.RecSetting = Settings.Instance.RecPresetList[0].Data.DeepClone(); } eventRefData = eventList[0]; } else if (dataList.Count != 0) { resData = dataList[0]; eventRefData = new ReserveItem(resData).EventInfo ?? (IBasicPgInfo)resData; } var key = MenuUtil.SendAutoAddKey(eventRefData, CmdExeUtil.IsKeyGesture(e)); MenuUtil.SendAutoAdd(resData, CmdExeUtil.IsKeyGesture(e), key); IsCommandExecuted = true; }
public void StoreListViewSelected() { if (listBox != null && listBox.SelectedItem != null) { getKey = getKey ?? CtrlCmdDefEx.GetKeyFunc(listBox.SelectedItem.GetType()); oldItems = listBox.SelectedItems.OfType <object>().Select(data => getKey(data)).ToList(); allSelected = (oldItems.Count > 1 && oldItems.Count == listBox.Items.Count); } }
private void SetProgramContent(EpgEventInfo info) { //放映時刻情報に対してEPGデータ無い場合もあるので、resInfoDisplayとは別にeventInfoDisplayを管理する if (CtrlCmdDefEx.EqualsPg(eventInfoDisplay, info) == false) { richTextBox_descInfo.Document = CommonManager.Instance.ConvertDisplayText(info); } eventInfoDisplay = info; }
public bool IsOnRec(int MarginMin = 0) { int StartMargin = RecSetting.GetTrueMargin(true) + 60 * MarginMin; int EndMargin = RecSetting.GetTrueMargin(false); DateTime startTime = StartTime.AddSeconds(StartMargin * -1); int duration = (int)DurationSecond + StartMargin + EndMargin; return(CtrlCmdDefEx.isOnTime(startTime, duration)); }
public gvCache(List <object> itemList) { list = itemList; typeKey = list[0].GetType(); Func <object, ulong> getKey = CtrlCmdDefEx.GetKeyFunc(typeKey); getValueKey = CtrlCmdDefEx.GetValuePropertyFunc(typeKey); idCache = list.Select(item => { try { return(getKey(item)); } catch { return(ulong.MinValue); } }).ToArray(); }
public void RestoreListViewSelected(ListBox list = null) { try { if (list != null) { listBox = list; } if (listBox != null && listBox.Items.Count != 0 && oldItems != null && oldItems.Count > 0) { if (this.allSelected == true) { listBox.SelectAll(); return; } //このUnselectAll()は無いと正しく復元出来ない状況があり得る listBox.UnselectAll(); //上限越えの場合は、選択を解除して終了。 if (oldItems.Count >= this.MaxRestoreNum) { return; } //選択数が少ないときは逆に遅くなる気もするが、Dictionaryにしておく var listKeys = new Dictionary <ulong, object>(); getKey = getKey ?? CtrlCmdDefEx.GetKeyFunc(listBox.Items[0].GetType()); foreach (object listItem1 in listBox.Items) { //重複するキーは基本的に無いという前提 try { listKeys.Add(getKey(listItem1), listItem1); } catch { } } var setItems = oldItems.Where(oldItem1 => listKeys.ContainsKey(oldItem1)).Select(item => listKeys[item]); listBox.SelectedItemsAdd(setItems); //画面更新が入るので最後に実行する。SelectedItem==nullのときScrollIntoViewは何もしない。 listBox.ScrollIntoView(listBox.SelectedItem); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void ReserveModeChanged() { // UIに反映させる SetResModeProgram(); if (!initialized) { return; } if (ReserveMode == UIReserveMode.Program) { eventInfoNew = null; } else if (ReserveMode == UIReserveMode.EPGManual) { var resInfo = new ReserveData(); GetReserveTimeInfo(ref resInfo); if (reserveInfo.IsEpgReserve == true && CtrlCmdDefEx.EqualsPg(reserveInfo, resInfo, false, true) == true) { //EPG予約で、元の状態に戻る場合 textBox_title.Text = reserveInfo.Title; eventInfoNew = null; } else { eventInfoNew = resInfo.SearchEventInfoLikeThat(); if (eventInfoNew == null) { MessageBox.Show("変更可能な番組がありません。\r\n" + "EPGの期間外か、EPGデータが読み込まれていません。"); ReserveMode = UIReserveMode.Program; } else { SetReserveTimeInfo(CtrlCmdDefEx.ConvertEpgToReserveData(eventInfoNew)); } } } else if (ReserveMode == UIReserveMode.EPGAuto) { SetReserveTimeInfo(reserveInfo); } eventInfoSelected = eventInfoNew; }
private void tabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (tabControl.SelectedIndex == TabSelectedIndex) { return; } TabSelectedIndex = tabControl.SelectedIndex; if (tabItem_program.IsSelected) { if (ReserveMode == UIReserveMode.Program) { var resInfo = new ReserveData(); GetReserveTimeInfo(ref resInfo); //描画回数の削減を気にしないなら、この条件文は無くてもいい if (CtrlCmdDefEx.EqualsPg(resInfoDisplay, resInfo, false, true) == false) { //EPGを自動で読み込んでない時でも、元がEPG予約ならその番組情報は表示させられるようにする if (reserveInfo.IsEpgReserve == true && CtrlCmdDefEx.EqualsPg(reserveInfo, resInfo, false, true) == true) { SetProgramContent(reserveInfo.SearchEventInfo(true)); } else { SetProgramContent(resInfo.SearchEventInfoLikeThat()); } resInfoDisplay = resInfo; } } else { //EPG予約を変更していない場合引っかかる。 //最も表示される可能性が高いので、何度も探しにいかせないようにする。 if (eventInfoSelected == null) { eventInfoSelected = reserveInfo.SearchEventInfo(true); } SetProgramContent(eventInfoSelected); resInfoDisplay = null; } } }
protected override void mc_ToAutoadd(object sender, ExecutedRoutedEventArgs e) { ReserveData resData = null; if (eventList.Count != 0) { resData = CtrlCmdDefEx.ConvertEpgToReserveData(eventList[0]); if (dataList.Count != 0) { resData.RecSetting = dataList[0].RecSetting.Clone(); } else { resData.RecSetting = Settings.Instance.RecPresetList[0].RecPresetData.Clone(); } } else if (dataList.Count != 0) { resData = dataList[0]; } MenuUtil.SendAutoAdd(resData, CmdExeUtil.IsKeyGesture(e)); IsCommandExecuted = true; }
public bool IsOnAir() { return(CtrlCmdDefEx.isOnTime(StartTime, (int)DurationSecond)); }
public bool IsOnAir() { return(CtrlCmdDefEx.isOnTime(start_time, (int)durationSec)); }
private void button_chg_reserve_Click(object sender, ExecutedRoutedEventArgs e) { try { if (CmdExeUtil.IsDisplayKgMessage(e) == true) { bool change_proc = false; switch (addMode) { case AddMode.Add: change_proc = (MessageBox.Show("予約を追加します。\r\nよろしいですか?", "予約の確認", MessageBoxButton.OKCancel) == MessageBoxResult.OK); break; case AddMode.Re_Add: change_proc = (MessageBox.Show("この内容で再予約します。\r\nよろしいですか?", "再予約の確認", MessageBoxButton.OKCancel) == MessageBoxResult.OK); break; case AddMode.Change: change_proc = (MessageBox.Show("この予約を変更します。\r\nよろしいですか?", "変更の確認", MessageBoxButton.OKCancel) == MessageBoxResult.OK); break; } if (change_proc == false) { return; } } if (addMode == AddMode.Change && CheckExistReserveItem() == false) { return; } //ダイアログを閉じないときはreserveInfoを変更しないよう注意する if (ReserveMode == UIReserveMode.Program) { var resInfo = new ReserveData(); if (GetReserveTimeInfo(ref resInfo) == -2) { MessageBox.Show("終了日時が開始日時より前です"); return; } //reserveInfo取得前に保存する。サービスや時間が変わったら、個別予約扱いにする。タイトルのみ変更は見ない。 bool chgManualMode = !CtrlCmdDefEx.EqualsPg(resInfo, reserveInfo, false, true); GetReserveTimeInfo(ref reserveInfo); if (reserveInfo.EventID != 0xFFFF || chgManualMode == true) { reserveInfo.EventID = 0xFFFF; reserveInfo.Comment = ""; } reserveInfo.StartTimeEpg = reserveInfo.StartTime; } else if (ReserveMode == UIReserveMode.EPGManual) { //EPG予約に変える場合、またはEPG予約で別の番組に変わる場合 if (eventInfoNew != null) { //基本的にAddReserveEpgWindowと同じ処理内容 if (MenuUtil.IsEnableReserveAdd(eventInfoNew) == false) { return; } eventInfoNew.ConvertToReserveData(ref reserveInfo); reserveInfo.Comment = ""; } // 自動予約から個別予約に変える場合 else if (GetReserveModeFromInfo() == UIReserveMode.EPGAuto) { reserveInfo.Comment = ""; } } reserveInfo.RecSetting = recSettingView.GetRecSetting(); if (addMode == AddMode.Change) { bool ret = MenuUtil.ReserveChange(CommonUtil.ToList(reserveInfo)); CommonManager.Instance.StatusNotifySet(ret, "録画予約を変更"); } else { bool ret = MenuUtil.ReserveAdd(CommonUtil.ToList(reserveInfo)); CommonManager.Instance.StatusNotifySet(ret, "録画予約を追加"); } // EPG自動予約以外になったら戻せないようにしておく if (ReserveMode != UIReserveMode.EPGAuto) { CanSelectAutoAdd = false; } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } DialogResult = true; }