public static bool ConvertToReserveData(this EpgEventInfo epgInfo, ref ReserveData resInfo) { if (epgInfo == null || resInfo == null) { return(false); } resInfo.Title = epgInfo.DataTitle; resInfo.StartTime = epgInfo.start_time; resInfo.StartTimeEpg = epgInfo.start_time; resInfo.DurationSecond = (epgInfo.DurationFlag == 0 ? 10 * 60 : epgInfo.durationSec); UInt64 key = epgInfo.Create64Key(); if (ChSet5.ChList.ContainsKey(key) == true) { resInfo.StationName = ChSet5.ChList[key].ServiceName; } resInfo.OriginalNetworkID = epgInfo.original_network_id; resInfo.TransportStreamID = epgInfo.transport_stream_id; resInfo.ServiceID = epgInfo.service_id; resInfo.EventID = epgInfo.event_id; return(true); }
public void showResult(EpgEventInfo epgEventInfo0) { reset(); if (Settings.Instance.RecLog_SearchLog_IsEnabled) { _epgEventInfo = epgEventInfo0; _selectedRecLogItem = _mainWindow.recLogView.db_RecLog.exists(RecLogItem.RecodeStatuses.ALL, epgEventInfo0.original_network_id, epgEventInfo0.transport_stream_id, epgEventInfo0.service_id, epgEventInfo0.event_id, epgEventInfo0.start_time); if (_selectedRecLogItem != null) { switch (_selectedRecLogItem.recodeStatus) { case RecLogItem.RecodeStatuses.録画完了: menuItem_ChangeStatus_NONE.IsEnabled = true; menuItem_ChangeStatus_Recorded.IsEnabled = false; break; default: menuItem_ChangeStatus_NONE.IsEnabled = false; menuItem_ChangeStatus_Recorded.IsEnabled = true; break; } } search(epgEventInfo0.ShortInfo.event_name, _selectedRecLogItem, epgEventInfo0.ContentInfo); } else { drawText(RecLogView.notEnabledMessage); } show(); }
public static void CopyContent2Clipboard(EpgEventInfo eventInfo, bool NotToggle = false) { string text = ""; if (eventInfo != null) { bool setting = Settings.Instance.MenuSet.CopyContentBasic; if (Keyboard.Modifiers == ModifierKeys.Shift && NotToggle == false) { setting = !setting; } if (setting == true) { //text = eventInfo.ShortInfo.text_char; text = CommonManager.Instance.ConvertProgramText(eventInfo, EventInfoTextMode.BasicOnly); } else { text = CommonManager.Instance.ConvertProgramText(eventInfo, EventInfoTextMode.All); } text = text.TrimEnd() + "\r\n"; } Clipboard.SetDataObject(text, true); }
private void listView_event_SelectionChanged(object sender, SelectionChangedEventArgs e) { richTextBox_eventInfo.Document.Blocks.Clear(); scrollViewer1.ScrollToHome(); if (listView_event.SelectedItem != null) { SearchItem item = listView_event.SelectedItem as SearchItem; EpgEventInfo eventInfo = item.EventInfo; String text = CommonManager.Instance.ConvertProgramText(eventInfo, EventInfoTextMode.All); int searchFrom = 0; Paragraph para = new Paragraph(); string rtext = CommonManager.ReplaceText(text, CommonManager.Instance.ReplaceUrlDictionary); if (rtext.Length == text.Length) { for (Match m = Regex.Match(rtext, @"https?://[0-9A-Za-z!#$%&'()~=@;:?_+\-*/.]+"); m.Success; m = m.NextMatch()) { para.Inlines.Add(text.Substring(searchFrom, m.Index - searchFrom)); Hyperlink h = new Hyperlink(new Run(text.Substring(m.Index, m.Length))); h.MouseLeftButtonDown += new MouseButtonEventHandler(h_MouseLeftButtonDown); h.Foreground = Brushes.Blue; h.Cursor = Cursors.Hand; h.NavigateUri = new Uri(m.Value); para.Inlines.Add(h); searchFrom = m.Index + m.Length; } } para.Inlines.Add(text.Substring(searchFrom)); richTextBox_eventInfo.Document = new FlowDocument(para); } }
//ジャンル絞り込み public static bool ContainsContent(EpgEventInfo info, HashSet <UInt32> ContentHash, bool notContent = false) { //絞り込み無し if (ContentHash.Count == 0) { return(true); } //ジャンルデータ'なし'扱い。 if (info.ContentInfo == null) { return(ContentHash.Contains(0xFFFF0000) == !notContent); } if (ContentHash.Contains(0xFFFF0000) == true && info.ContentInfo.nibbleList.Any(data => data.IsAttributeInfo == false) != true) { return(!notContent); } //不明なジャンル if (ContentHash.Contains(0xFEFF0000) == true && info.ContentInfo.nibbleList.Any(data => CommonManager.ContentKindDictionary.ContainsKey(data.Key) == false)) { return(!notContent); } //検索 return(info.ContentInfo.nibbleList.Any(data => ContentHash.Contains(data.Key)) != notContent); }
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)); } } } }
private void tabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { //ComboBoxのSelectionChangedにも反応するので。(WPFの仕様) if (sender != e.OriginalSource) { return; } selectedTab = tabControl.SelectedIndex != -1 ? tabControl.SelectedIndex : selectedTab; if (tabItem_program.IsSelected) { var resInfo = new ReserveData(); GetReserveTimeInfo(ref resInfo); //描画軽減。人の操作では気にするほどのことはないが、保険。 if (resInfo.IsSamePg(resInfoDisplay) == true) { return; } resInfoDisplay = resInfo; EpgEventInfo eventInfo = null; //EPGを自動で読み込んでない時でも、元がEPG予約ならその番組情報は表示させられるようにする if (reserveInfo.IsEpgReserve == true && reserveInfo.IsSamePg(resInfo) == true) { eventInfo = eventInfoNow ?? reserveInfo.ReserveEventInfo(); } else { eventInfo = eventInfoNow ?? resInfo.SearchEventInfoLikeThat(); } richTextBox_descInfo.Document = CommonManager.ConvertDisplayText(eventInfo); } }
/// <summary> /// 指定IDの番組情報を取得する。できるだけServiceEventListを利用する /// </summary> public EpgEventInfo GetPgInfo(ushort onid, ushort tsid, ushort sid, ushort eventID, bool cacheOnly) { var eventInfo = new EpgEventInfo(); EpgServiceAllEventInfo allInfo; if (serviceEventList.TryGetValue(CommonManager.Create64Key(onid, tsid, sid), out allInfo)) { //過去でない番組情報は必ずID順になっている eventInfo.event_id = eventID; int index = allInfo.eventList.BinarySearch(eventInfo, new EpgEventInfoComparer()); if (index >= 0) { return(allInfo.eventList[index]); } } try { if (cacheOnly == false && CommonManager.CreateSrvCtrl().SendGetPgInfo(CommonManager.Create64PgKey(onid, tsid, sid, eventID), ref eventInfo) == ErrCode.CMD_SUCCESS) { return(eventInfo); } } catch { } return(null); }
/// <summary> /// 予約一覧からのジャンプ先を番組表タブから探す /// </summary> void searchJumpTargetProgram() { UInt64 serviceKey_Target1 = 0; if (BlackoutWindow.selectedReserveItem != null) { ReserveData reserveData1 = BlackoutWindow.selectedReserveItem.ReserveInfo; serviceKey_Target1 = CommonManager.Create64Key(reserveData1.OriginalNetworkID, reserveData1.TransportStreamID, reserveData1.ServiceID); } else if (BlackoutWindow.selectedSearchItem != null) { EpgEventInfo eventInfo1 = BlackoutWindow.selectedSearchItem.EventInfo; serviceKey_Target1 = CommonManager.Create64Key(eventInfo1.original_network_id, eventInfo1.transport_stream_id, eventInfo1.service_id); } foreach (TabItem tabItem1 in this.tabControl.Items) { EpgDataViewItem epgView1 = tabItem1.Content as EpgDataViewItem; foreach (UInt64 serviceKey_OnTab1 in epgView1.ViewInfo.ViewServiceList) { if (serviceKey_Target1 == serviceKey_OnTab1) { tabItem1.IsSelected = true; return; } } } }
public EpgEventInfo SearchEventInfo(bool getSrv = false) { EpgEventInfo eventInfo = null; try { if (IsEpgReserve == true) { UInt64 key = Create64Key(); if (CommonManager.Instance.DB.ServiceEventList.ContainsKey(key) == true) { foreach (EpgEventInfo eventChkInfo in CommonManager.Instance.DB.ServiceEventList[key].eventList) { if (eventChkInfo.event_id == EventID) { eventInfo = eventChkInfo; break; } } } if (eventInfo == null && getSrv == true) { UInt64 pgId = Create64PgKey(); eventInfo = new EpgEventInfo(); CommonManager.Instance.CtrlCmd.SendGetPgInfo(pgId, ref eventInfo); } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } return(eventInfo); }
public SearchItem(EpgEventInfo info, bool past, bool filtered, bool duplicate) { EventInfo = info; Past = past; Filtered = filtered; Duplicate = duplicate; }
protected override void MoveToProgramItem(EpgEventInfo target, bool IsMarking) { ulong PgKey = target.Create64PgKey(); SearchItem target_item = lstCtrl.dataList.Find(item => item.EventInfo.Create64PgKey() == PgKey); ViewUtil.ScrollToFindItem(target_item, listView_event, IsMarking); }
public EpgEventInfo GetPgInfo(bool isSrv = true) { //まずは手持ちのデータを探す EpgEventInfo pg = MenuUtil.GetPgInfoUidAll(CurrentPgUID()); if (pg != null || isSrv == false) { return(pg); } //過去番組情報を探してみる if (PgStartTime >= CommonManager.Instance.DB.EventTimeMinArc) { var arcList = new List <EpgServiceEventInfo>(); CommonManager.Instance.DB.LoadEpgArcData(PgStartTime, PgStartTime.AddSeconds(1), ref arcList, Create64Key().IntoList()); if (arcList.Any()) { return(arcList[0].eventList.FirstOrDefault()); } } //現在番組情報も探してみる ※EPGデータ未読み込み時で、録画直後の場合 if (CommonManager.Instance.DB.IsEpgLoaded == false) { var list = new List <EpgEventInfo>(); try { CommonManager.CreateSrvCtrl().SendGetPgInfoList(Create64PgKey().IntoList(), ref list); } catch { } return(list.FirstOrDefault()); } return(null); }
protected override void MoveToReserveItem(ReserveData target, bool IsMarking) { uint ID = target.ReserveID; SearchItem target_item = lstCtrl.dataList.Find(item => item.ReserveInfo != null && item.ReserveInfo.ReserveID == ID); if (target_item != null) { ViewUtil.ScrollToFindItem(target_item, listView_event, IsMarking); } else { //プログラム予約だと見つからないので、それらしい番組を引っ張ってきて再度確認する。 //でもリスト番組表で探すより、プログラム予約でも表示させられる標準モードへ投げてしまった方が良いのかも? EpgEventInfo target_like = target.SearchEventInfoLikeThat(); if (target_like != null) { MoveToProgramItem(target_like, IsMarking); } else { //それでもダメなら諦める。EPG範囲外の予約などは標準モードでもまともには表示されていないので。 listView_event.SelectedIndex = listView_event.Items.Count - 1; listView_event.ScrollIntoView(listView_event.SelectedItem); } return; } }
public void SetEventInfo(EpgEventInfo eventData) { try { eventInfo = eventData; textBox_info.Text = CommonManager.Instance.ConvertProgramText(eventData, EventInfoTextMode.BasicOnly); String text = CommonManager.Instance.ConvertProgramText(eventData, EventInfoTextMode.ExtOnly); int searchFrom = 0; Paragraph para = new Paragraph(); string rtext = CommonManager.ReplaceText(text, CommonManager.Instance.ReplaceUrlDictionary); if (rtext.Length == text.Length) { for (Match m = Regex.Match(rtext, @"https?://[0-9A-Za-z!#$%&'()~=@;:?_+\-*/.]+"); m.Success; m = m.NextMatch()) { para.Inlines.Add(text.Substring(searchFrom, m.Index - searchFrom)); Hyperlink h = new Hyperlink(new Run(text.Substring(m.Index, m.Length))); h.MouseLeftButtonDown += new MouseButtonEventHandler(h_MouseLeftButtonDown); h.Foreground = Brushes.Blue; h.Cursor = Cursors.Hand; h.NavigateUri = new Uri(m.Value); para.Inlines.Add(h); searchFrom = m.Index + m.Length; } } para.Inlines.Add(text.Substring(searchFrom)); richTextBox_descInfo.Document = new FlowDocument(para); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public EpgEventInfo SearchEventInfoLikeThat() { double dist = double.MaxValue, dist1; EpgEventInfo eventPossible = null; UInt64 key = Create64Key(); if (CommonManager.Instance.DB.ServiceEventList.ContainsKey(key) == true) { foreach (EpgEventInfo eventChkInfo in CommonManager.Instance.DB.ServiceEventList[key].eventList) { dist1 = Math.Abs((StartTime - eventChkInfo.start_time).TotalSeconds); double overlapLength = MenuUtil.CulcOverlapLength(StartTime, DurationSecond, eventChkInfo.start_time, eventChkInfo.durationSec); //開始時間が最も近いものを選ぶ。同じ差なら時間が前のものを選ぶ if (overlapLength >= 0 && (dist > dist1 || dist == dist1 && (eventPossible == null || StartTime > eventChkInfo.start_time))) { dist = dist1; eventPossible = eventChkInfo; if (dist == 0) { break; } } } } return(eventPossible); }
private void listView_event_SelectionChanged(object sender, SelectionChangedEventArgs e) { richTextBox_eventInfo.Document.Blocks.Clear(); if (listView_event.SelectedItem != null) { SearchItem item = listView_event.SelectedItem as SearchItem; EpgEventInfo eventInfo = item.EventInfo; String text = CommonManager.Instance.ConvertProgramText(eventInfo, EventInfoTextMode.All); Regex regex = new Regex("((http://|https://|http://|https://).*\r\n)"); if (regex.IsMatch(text) == true) { try { //Regexのsplitでやるとhttp://だけのも取れたりするので、1つずつ行う FlowDocument flowDoc = new FlowDocument(); Paragraph para = new Paragraph(); do { Match matchVal = regex.Match(text); int index = text.IndexOf(matchVal.Value); para.Inlines.Add(text.Substring(0, index)); text = text.Remove(0, index); Hyperlink h = new Hyperlink(new Run(matchVal.Value.Replace("\r\n", ""))); h.MouseLeftButtonDown += new MouseButtonEventHandler(h_MouseLeftButtonDown); h.Foreground = Brushes.Blue; h.Cursor = Cursors.Hand; String url = CommonManager.ReplaceUrl(matchVal.Value.Replace("\r\n", "")); h.NavigateUri = new Uri(url); para.Inlines.Add(h); para.Inlines.Add("\r\n"); text = text.Remove(0, matchVal.Value.Length); } while (regex.IsMatch(text) == true); para.Inlines.Add(text); flowDoc.Blocks.Add(para); richTextBox_eventInfo.Document = flowDoc; } catch { text = CommonManager.Instance.ConvertProgramText(eventInfo, EventInfoTextMode.All); FlowDocument flowDoc = new FlowDocument(); flowDoc.Blocks.Add(new Paragraph(new Run(text))); richTextBox_eventInfo.Document = flowDoc; } } else { FlowDocument flowDoc = new FlowDocument(); flowDoc.Blocks.Add(new Paragraph(new Run(text))); richTextBox_eventInfo.Document = flowDoc; } } }
/// <summary> /// 初期値の予約情報をセットし、ウィンドウを予約変更モードにする /// </summary> /// <param name="info">[IN] 初期値の予約情報</param> public void SetReserveInfo(ReserveData info) { try { reserveInfo = info; recSettingView.SetDefSetting(info.RecSetting); if (info.EventID != 0xFFFF) { EpgEventInfo eventInfo = CommonManager.Instance.DB.GetPgInfo(info.OriginalNetworkID, info.TransportStreamID, info.ServiceID, info.EventID, false); if (eventInfo != null) { richTextBox_descInfo.Document = new FlowDocument(CommonManager.ConvertDisplayText( CommonManager.ConvertProgramText(eventInfo, EventInfoTextMode.BasicInfo) + CommonManager.ConvertProgramText(eventInfo, EventInfoTextMode.BasicText), CommonManager.ConvertProgramText(eventInfo, EventInfoTextMode.ExtendedText), CommonManager.ConvertProgramText(eventInfo, EventInfoTextMode.PropertyInfo))); } } Title = "予約変更"; button_chg_reserve.Content = "変更"; button_del_reserve.Visibility = Visibility.Visible; if (reserveInfo.EventID == 0xFFFF) { checkBox_program.IsChecked = true; checkBox_program.IsEnabled = false; recSettingView.SetViewMode(false); } else { checkBox_program.IsChecked = false; checkBox_program.IsEnabled = true; recSettingView.SetViewMode(true); } textBox_title.Text = reserveInfo.Title; comboBox_service.SelectedItem = comboBox_service.Items.Cast <ChSet5Item>().FirstOrDefault(ch => ch.ONID == reserveInfo.OriginalNetworkID && ch.TSID == reserveInfo.TransportStreamID && ch.SID == reserveInfo.ServiceID); DateTime startTime = reserveInfo.StartTime; DateTime endTime = startTime.AddSeconds(reserveInfo.DurationSecond); datePicker_start.SelectedDate = startTime; datePicker_end.SelectedDate = endTime; comboBox_sh.SelectedIndex = startTime.Hour; comboBox_sm.SelectedIndex = startTime.Minute; comboBox_ss.SelectedIndex = startTime.Second; comboBox_eh.SelectedIndex = endTime.Hour; comboBox_em.SelectedIndex = endTime.Minute; comboBox_es.SelectedIndex = endTime.Second; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public static ReserveData ConvertEpgToReserveData(EpgEventInfo epgInfo) { if (epgInfo == null) return null; ReserveData resInfo = new ReserveData(); epgInfo.ConvertToReserveData(ref resInfo); return resInfo; }
/// <summary> /// 初期値の予約情報をセットする /// </summary> /// <param name="info">[IN] 初期値の予約情報</param> public void SetReserveInfo(ReserveData info) { try { reserveInfo = info; recSettingView.SetDefSetting(info.RecSetting); if (info.EventID != 0xFFFF) { UInt64 key = CommonManager.Create64Key(info.OriginalNetworkID, info.TransportStreamID, info.ServiceID); EpgEventInfo eventInfo = null; if (CommonManager.Instance.DB.ServiceEventList.ContainsKey(key) == true) { foreach (EpgEventInfo eventChkInfo in CommonManager.Instance.DB.ServiceEventList[key].eventList) { if (eventChkInfo.event_id == info.EventID) { eventInfo = eventChkInfo; break; } } } if (eventInfo == null) { UInt64 pgId = CommonManager.Create64PgKey(info.OriginalNetworkID, info.TransportStreamID, info.ServiceID, info.EventID); eventInfo = new EpgEventInfo(); CommonManager.CreateSrvCtrl().SendGetPgInfo(pgId, ref eventInfo); } if (eventInfo != null) { String text = CommonManager.Instance.ConvertProgramText(eventInfo, EventInfoTextMode.All); int searchFrom = 0; Paragraph para = new Paragraph(); string rtext = CommonManager.ReplaceText(text, CommonManager.Instance.ReplaceUrlDictionary); if (rtext.Length == text.Length) { for (Match m = Regex.Match(rtext, @"https?://[0-9A-Za-z!#$%&'()~=@;:?_+\-*/.]+"); m.Success; m = m.NextMatch()) { para.Inlines.Add(text.Substring(searchFrom, m.Index - searchFrom)); Hyperlink h = new Hyperlink(new Run(text.Substring(m.Index, m.Length))); h.MouseLeftButtonDown += new MouseButtonEventHandler(h_MouseLeftButtonDown); h.Foreground = Brushes.Blue; h.Cursor = Cursors.Hand; h.NavigateUri = new Uri(m.Value); para.Inlines.Add(h); searchFrom = m.Index + m.Length; } } para.Inlines.Add(text.Substring(searchFrom)); richTextBox_descInfo.Document = new FlowDocument(para); } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void AddReserveFromPreset(uint presetID) { try { if (listView_event.SelectedItem == null) { return; } SearchItem item = listView_event.SelectedItem as SearchItem; EpgEventInfo eventInfo = item.EventInfo; if (eventInfo.StartTimeFlag == 0) { MessageBox.Show("開始時間未定のため予約できません"); return; } ReserveData reserveInfo = new ReserveData(); if (eventInfo.ShortInfo != null) { reserveInfo.Title = eventInfo.ShortInfo.event_name; } reserveInfo.StartTime = eventInfo.start_time; reserveInfo.StartTimeEpg = eventInfo.start_time; if (eventInfo.DurationFlag == 0) { reserveInfo.DurationSecond = 10 * 60; } else { reserveInfo.DurationSecond = eventInfo.durationSec; } UInt64 key = CommonManager.Create64Key(eventInfo.original_network_id, eventInfo.transport_stream_id, eventInfo.service_id); if (ChSet5.Instance.ChList.ContainsKey(key) == true) { reserveInfo.StationName = ChSet5.Instance.ChList[key].ServiceName; } reserveInfo.OriginalNetworkID = eventInfo.original_network_id; reserveInfo.TransportStreamID = eventInfo.transport_stream_id; reserveInfo.ServiceID = eventInfo.service_id; reserveInfo.EventID = eventInfo.event_id; reserveInfo.RecSetting = Settings.CreateRecSetting(presetID); List <ReserveData> list = new List <ReserveData>(); list.Add(reserveInfo); ErrCode err = CommonManager.CreateSrvCtrl().SendAddReserve(list); if (err != ErrCode.CMD_SUCCESS) { MessageBox.Show(CommonManager.GetErrCodeText(err) ?? "予約登録でエラーが発生しました。終了時間がすでに過ぎている可能性があります。"); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public override void MoveToProgramItem(EpgEventInfo target, JumpItemStyle style = JumpItemStyle.MoveTo) { if (target != null) { ChangeViewService(target.Create64Key()); } base.MoveToProgramItem(target, style); }
public void SetEventInfo(EpgEventInfo eventData) { { eventInfo = eventData; textBox_info.Text = CommonManager.Instance.ConvertProgramText(eventData, EventInfoTextMode.BasicOnly); String text = CommonManager.Instance.ConvertProgramText(eventData, EventInfoTextMode.ExtOnly); richTextBox_descInfo.Document = new FlowDocument(CommonManager.ConvertDisplayText(text)); } }
private void SetProgramContent(EpgEventInfo info) { //放映時刻情報に対してEPGデータ無い場合もあるので、resInfoDisplayとは別にeventInfoDisplayを管理する if (CtrlCmdDefEx.EqualsPg(eventInfoDisplay, info) == false) { richTextBox_descInfo.Document = CommonManager.Instance.ConvertDisplayText(info); } eventInfoDisplay = info; }
/// <summary> /// 放送終了 /// </summary> /// <param name="eventInfo"></param> /// <returns></returns> public static bool isBroadcasted(this EpgEventInfo eventInfo) { if (eventInfo == null) { return(false); } // return(eventInfo.start_time.AddSeconds(eventInfo.durationSec) < DateTime.Now); }
public void SetEventInfo(EpgEventInfo eventData) { eventInfo = eventData; textBox_info.Text = CommonManager.ConvertProgramText(eventInfo, EventInfoTextMode.BasicInfo); richTextBox_descInfo.Document = new FlowDocument(CommonManager.ConvertDisplayText( CommonManager.ConvertProgramText(eventInfo, EventInfoTextMode.BasicText), CommonManager.ConvertProgramText(eventInfo, EventInfoTextMode.ExtendedText), CommonManager.ConvertProgramText(eventInfo, EventInfoTextMode.PropertyInfo))); }
public void SetEventInfo(EpgEventInfo eventData) { try { eventInfo = eventData; textBox_info.Text = CommonManager.Instance.ConvertProgramText(eventData, EventInfoTextMode.BasicOnly); String text = CommonManager.Instance.ConvertProgramText(eventData, EventInfoTextMode.ExtOnly); Regex regex = new Regex("(https?://[!#-'*-;=?-Z_a-z~]+)"); // URLに使用可能な文字から括弧を除外 if (regex.IsMatch(text) == true) { try { string[] substrings = regex.Split(text); FlowDocument flowDoc = new FlowDocument(); Paragraph para = new Paragraph(); for (int i = 0; i < substrings.Count(); i++) { if (i % 2 == 0) { para.Inlines.Add(substrings[i]); } else { Hyperlink h = new Hyperlink(new Run(substrings[i])); h.MouseLeftButtonDown += new MouseButtonEventHandler(h_MouseLeftButtonDown); h.Foreground = Brushes.Blue; h.Cursor = Cursors.Hand; h.NavigateUri = new Uri(substrings[i]); para.Inlines.Add(h); } } flowDoc.Blocks.Add(para); richTextBox_descInfo.Document = flowDoc; } catch { text = CommonManager.Instance.ConvertProgramText(eventInfo, EventInfoTextMode.All); FlowDocument flowDoc = new FlowDocument(); flowDoc.Blocks.Add(new Paragraph(new Run(text))); richTextBox_descInfo.Document = flowDoc; } } else { FlowDocument flowDoc = new FlowDocument(); flowDoc.Blocks.Add(new Paragraph(new Run(text))); richTextBox_descInfo.Document = flowDoc; } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void AddReserve(EpgEventInfo eventInfo) { { AddReserveEpgWindow dlg = new AddReserveEpgWindow(); dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual; dlg.SetEventInfo(eventInfo); dlg.ShowDialog(); } }
void reset() { menuItem_ChangeStatus_Recorded.IsEnabled = true; richTextBox_SelectedItem.Visibility = Visibility.Visible; _resultList.Clear(); _epgEventInfo = null; _recFileInfo = null; _selectedRecLogItem = null; richTextBox.Document.Blocks.Clear(); }
public virtual void MoveToProgramItem(EpgEventInfo target, JumpItemStyle style = JumpItemStyle.MoveTo) { if (DataListBox == null || DataListBox.Items.Count == 0) { return; } //過去番組表でイベントIDが重複している場合があるので開始時間も考慮する MoveToItem(target == null ? 0 : target.CurrentPgUID(), style); }
public virtual int MoveToProgramItem(EpgEventInfo target, JumpItemStyle style = JumpItemStyle.MoveTo, bool dryrun = false) { if (DataListBox == null || DataListBox.Items.Count == 0) { return(-1); } //過去番組表でイベントIDが重複している場合があるので開始時間も考慮する return(MoveToItem(target == null ? 0 : target.CurrentPgUID(), style, dryrun)); }
/// <summary> /// マウス位置から番組情報を取得する /// </summary> /// <param name="cursorPos">[IN]マウス位置</param> /// <param name="program">[OUT]番組情報</param> /// <returns>falseで存在しない</returns> private bool GetProgramItem(Point cursorPos, ref EpgEventInfo program) { try { int timeIndex = (int)(cursorPos.Y / (60 * Settings.Instance.MinHeight)); if (0 <= timeIndex && timeIndex < timeList.Count) { foreach (ProgramViewItem pgInfo in timeList.Values[timeIndex]) { if (pgInfo.LeftPos <= cursorPos.X && cursorPos.X < pgInfo.LeftPos + pgInfo.Width && pgInfo.TopPos <= cursorPos.Y && cursorPos.Y < pgInfo.TopPos + pgInfo.Height) { program = pgInfo.EventInfo; return true; } } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } return false; }
public String ConvertJyanruText(EpgEventInfo eventInfo) { if (eventInfo == null || eventInfo.ContentInfo == null) { return ""; } else { return ConvertJyanruText(eventInfo.ContentInfo.nibbleList); } }
public static String ConvertTimeText(EpgEventInfo info) { if (info.StartTimeFlag != 1) return "未定 ~ 未定"; // string reftxt = ConvertTimeText(info.start_time, info.PgDurationSecond, false, false, false, false); return info.DurationFlag == 1 ? reftxt : reftxt.Split(new char[] { '~' })[0] + "~ 未定"; }
/// <summary> /// 初期値の予約情報をセットする /// </summary> /// <param name="info">[IN] 初期値の予約情報</param> public void SetReserveInfo(ReserveData info) { try { reserveInfo = info; recSettingView.SetDefSetting(info.RecSetting); if (info.EventID != 0xFFFF) { UInt64 key = CommonManager.Create64Key(info.OriginalNetworkID, info.TransportStreamID, info.ServiceID); EpgEventInfo eventInfo = null; if (CommonManager.Instance.DB.ServiceEventList.ContainsKey(key) == true) { foreach (EpgEventInfo eventChkInfo in CommonManager.Instance.DB.ServiceEventList[key].eventList) { if (eventChkInfo.event_id == info.EventID) { eventInfo = eventChkInfo; break; } } } if(eventInfo == null ) { UInt64 pgId = CommonManager.Create64PgKey(info.OriginalNetworkID, info.TransportStreamID, info.ServiceID, info.EventID); eventInfo = new EpgEventInfo(); cmd.SendGetPgInfo(pgId, ref eventInfo); } if (eventInfo != null) { String text = CommonManager.Instance.ConvertProgramText(eventInfo, EventInfoTextMode.All); Regex regex = new Regex("((http://|https://|http://|https://).*\r\n)"); if (regex.IsMatch(text) == true) { try { //Regexのsplitでやるとhttp://だけのも取れたりするので、1つずつ行う FlowDocument flowDoc = new FlowDocument(); Paragraph para = new Paragraph(); do { Match matchVal = regex.Match(text); int index = text.IndexOf(matchVal.Value); para.Inlines.Add(text.Substring(0, index)); text = text.Remove(0, index); Hyperlink h = new Hyperlink(new Run(matchVal.Value.Replace("\r\n", ""))); h.MouseLeftButtonDown += new MouseButtonEventHandler(h_MouseLeftButtonDown); h.Foreground = Brushes.Blue; h.Cursor = Cursors.Hand; String url = CommonManager.ReplaceUrl(matchVal.Value.Replace("\r\n", "")); h.NavigateUri = new Uri(url); para.Inlines.Add(h); para.Inlines.Add("\r\n"); text = text.Remove(0, matchVal.Value.Length); } while (regex.IsMatch(text) == true); para.Inlines.Add(text); flowDoc.Blocks.Add(para); richTextBox_descInfo.Document = flowDoc; } catch { text = CommonManager.Instance.ConvertProgramText(eventInfo, EventInfoTextMode.All); FlowDocument flowDoc = new FlowDocument(); flowDoc.Blocks.Add(new Paragraph(new Run(text))); richTextBox_descInfo.Document = flowDoc; } } else { FlowDocument flowDoc = new FlowDocument(); flowDoc.Blocks.Add(new Paragraph(new Run(text))); richTextBox_descInfo.Document = flowDoc; } } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public static bool EqualsPg(ReserveData i1, EpgEventInfo i2, bool IdMode = true, bool TimeMode = false) { return EqualsPg(i1, ConvertEpgToReserveData(i2), IdMode, TimeMode); }
public String ConvertProgramText(EpgEventInfo eventInfo, EventInfoTextMode textMode) { string retText = ""; string basicInfo = ""; string extInfo = ""; if (eventInfo != null) { UInt64 key = ((UInt64)eventInfo.original_network_id) << 32 | ((UInt64)eventInfo.transport_stream_id) << 16 | ((UInt64)eventInfo.service_id); if (ChSet5.Instance.ChList.ContainsKey(key) == true) { basicInfo += ChSet5.Instance.ChList[key].ServiceName + "(" + ChSet5.Instance.ChList[key].NetworkName + ")" + "\r\n"; } if (eventInfo.StartTimeFlag == 1) { basicInfo += eventInfo.start_time.ToString("yyyy/MM/dd(ddd) HH:mm:ss ~ "); } else { basicInfo += "未定 ~ "; } if (eventInfo.DurationFlag == 1) { DateTime endTime = eventInfo.start_time + TimeSpan.FromSeconds(eventInfo.durationSec); basicInfo += endTime.ToString("yyyy/MM/dd(ddd) HH:mm:ss") + "\r\n"; } else { basicInfo += "未定\r\n"; } if (eventInfo.ShortInfo != null) { basicInfo += eventInfo.ShortInfo.event_name + "\r\n\r\n"; extInfo += eventInfo.ShortInfo.text_char + "\r\n\r\n"; } if (eventInfo.ExtInfo != null) { extInfo += eventInfo.ExtInfo.text_char + "\r\n\r\n"; } //ジャンル extInfo += "ジャンル :\r\n"; if (eventInfo.ContentInfo != null) { foreach (EpgContentData info in eventInfo.ContentInfo.nibbleList) { String content = ""; int nibble1 = info.content_nibble_level_1; int nibble2 = info.content_nibble_level_2; if (nibble1 == 0x0E && nibble2 == 0x01) { nibble1 = info.user_nibble_1; nibble2 = info.user_nibble_2; UInt16 contentKey1 = (UInt16)(nibble1 << 8 | 0xFF); UInt16 contentKey2 = (UInt16)(nibble1 << 8 | nibble2); if (ContentKindDictionary2.ContainsKey(contentKey1) == true) { content += ContentKindDictionary2[contentKey1]; } if (ContentKindDictionary2.ContainsKey(contentKey2) == true) { content += " - " + ContentKindDictionary2[contentKey2]; } if (content.Length == 0 || nibble1 == 0x0F) { content += "(0x" + info.user_nibble_1.ToString("X2") + info.user_nibble_2.ToString("X2") + ")" + "(0x" + info.user_nibble_1.ToString("X2") + info.user_nibble_2.ToString("X2") + ")"; } extInfo += content + "\r\n"; } else { UInt16 contentKey1 = (UInt16)(nibble1 << 8 | 0xFF); UInt16 contentKey2 = (UInt16)(nibble1 << 8 | nibble2); if (ContentKindDictionary.ContainsKey(contentKey1) == true) { content += ContentKindDictionary[contentKey1]; } if (ContentKindDictionary.ContainsKey(contentKey2) == true) { content += " - " + ContentKindDictionary[contentKey2]; } if (content.Length == 0 || nibble1 == 0x0F) { content += "(0x" + nibble1.ToString("X2") + nibble2.ToString("X2") + ")" + "(0x" + info.user_nibble_1.ToString("X2") + info.user_nibble_2.ToString("X2") + ")"; } extInfo += content + "\r\n"; } } } extInfo += "\r\n"; //映像 extInfo += "映像 :"; if (eventInfo.ComponentInfo != null) { int streamContent = eventInfo.ComponentInfo.stream_content; int componentType = eventInfo.ComponentInfo.component_type; UInt16 componentKey = (UInt16)(streamContent << 8 | componentType); if (ComponentKindDictionary.ContainsKey(componentKey) == true) { extInfo += ComponentKindDictionary[componentKey]; } if (eventInfo.ComponentInfo.text_char.Length > 0) { extInfo += "\r\n"; extInfo += eventInfo.ComponentInfo.text_char; } } extInfo += "\r\n"; //音声 extInfo += "音声 :\r\n"; if (eventInfo.AudioInfo != null) { foreach (EpgAudioComponentInfoData info in eventInfo.AudioInfo.componentList) { int streamContent = info.stream_content; int componentType = info.component_type; UInt16 componentKey = (UInt16)(streamContent << 8 | componentType); if (ComponentKindDictionary.ContainsKey(componentKey) == true) { extInfo += ComponentKindDictionary[componentKey]; } if (info.text_char.Length > 0) { extInfo += "\r\n"; extInfo += info.text_char; } extInfo += "\r\n"; extInfo += "サンプリングレート :"; switch (info.sampling_rate) { case 1: extInfo += "16kHz"; break; case 2: extInfo += "22.05kHz"; break; case 3: extInfo += "24kHz"; break; case 5: extInfo += "32kHz"; break; case 6: extInfo += "44.1kHz"; break; case 7: extInfo += "48kHz"; break; default: break; } extInfo += "\r\n"; } } extInfo += "\r\n"; //スクランブル if (!(0x7880 <= eventInfo.original_network_id && eventInfo.original_network_id <= 0x7FE8)) { if (eventInfo.FreeCAFlag == 0) { extInfo += "無料放送\r\n"; } else { extInfo += "有料放送\r\n"; } extInfo += "\r\n"; } //イベントリレー if (eventInfo.EventRelayInfo != null) { if (eventInfo.EventRelayInfo.eventDataList.Count > 0) { extInfo += "イベントリレーあり:\r\n"; foreach (EpgEventData info in eventInfo.EventRelayInfo.eventDataList) { key = ((UInt64)info.original_network_id) << 32 | ((UInt64)info.transport_stream_id) << 16 | ((UInt64)info.service_id); if (ChSet5.Instance.ChList.ContainsKey(key) == true) { extInfo += ChSet5.Instance.ChList[key].ServiceName + "(" + ChSet5.Instance.ChList[key].NetworkName + ")" + " "; } else { extInfo += "OriginalNetworkID : " + info.original_network_id.ToString() + " (0x" + info.original_network_id.ToString("X4") + ") "; extInfo += "TransportStreamID : " + info.transport_stream_id.ToString() + " (0x" + info.transport_stream_id.ToString("X4") + ") "; extInfo += "ServiceID : " + info.service_id.ToString() + " (0x" + info.service_id.ToString("X4") + ") "; } extInfo += "EventID : " + info.event_id.ToString() + " (0x" + info.event_id.ToString("X4") + ")\r\n"; extInfo += "\r\n"; } extInfo += "\r\n"; } } extInfo += "OriginalNetworkID : " + eventInfo.original_network_id.ToString() + " (0x" + eventInfo.original_network_id.ToString("X4") + ")\r\n"; extInfo += "TransportStreamID : " + eventInfo.transport_stream_id.ToString() + " (0x" + eventInfo.transport_stream_id.ToString("X4") + ")\r\n"; extInfo += "ServiceID : " + eventInfo.service_id.ToString() + " (0x" + eventInfo.service_id.ToString("X4") + ")\r\n"; extInfo += "EventID : " + eventInfo.event_id.ToString() + " (0x" + eventInfo.event_id.ToString("X4") + ")\r\n"; } if (textMode == EventInfoTextMode.All || textMode == EventInfoTextMode.BasicOnly) { retText = basicInfo; } if (textMode == EventInfoTextMode.All || textMode == EventInfoTextMode.ExtOnly) { retText += extInfo; } return retText; }
public void SetEventInfo(EpgEventInfo eventData) { eventInfo = eventData; textBox_info.Text = CommonManager.Instance.ConvertProgramText(eventData, EventInfoTextMode.BasicOnly); richTextBox_descInfo.Document = CommonManager.Instance.ConvertDisplayText(eventInfo); }
/// <summary> /// 右クリックメニュー 表示モードイベント呼び出し /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cm_chg_viewMode_Click(object sender, RoutedEventArgs e) { try { if (sender.GetType() != typeof(MenuItem)) { return; } if (ViewSettingClick != null) { MenuItem item = sender as MenuItem; CustomEpgTabInfo setInfo = new CustomEpgTabInfo(); setViewInfo.CopyTo(ref setInfo); setInfo.ViewMode = (int)item.DataContext; EpgEventInfo program = new EpgEventInfo(); if (GetProgramItem(clickPos, ref program) == true) { SearchItem searchitem = new SearchItem(); searchitem.EventInfo = program; BlackoutWindow.selectedSearchItem = searchitem; } else { BlackoutWindow.selectedSearchItem = null; } ViewSettingClick(this, setInfo); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
/// <summary> /// 右クリックメニュー 簡易予約イベント呼び出し /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cm_new_Click(object sender, RoutedEventArgs e) { try { EpgEventInfo eventInfo = new EpgEventInfo(); if (GetProgramItem(clickPos, ref eventInfo) == false) { return; } if (eventInfo.StartTimeFlag == 0) { MessageBox.Show("開始時間未定のため予約できません"); return; } ReserveData reserveInfo = new ReserveData(); if (eventInfo.ShortInfo != null) { reserveInfo.Title = eventInfo.ShortInfo.event_name; } reserveInfo.StartTime = eventInfo.start_time; reserveInfo.StartTimeEpg = eventInfo.start_time; if (eventInfo.DurationFlag == 0) { reserveInfo.DurationSecond = 10 * 60; } else { reserveInfo.DurationSecond = eventInfo.durationSec; } UInt64 key = CommonManager.Create64Key(eventInfo.original_network_id, eventInfo.transport_stream_id, eventInfo.service_id); if (ChSet5.Instance.ChList.ContainsKey(key) == true) { reserveInfo.StationName = ChSet5.Instance.ChList[key].ServiceName; } reserveInfo.OriginalNetworkID = eventInfo.original_network_id; reserveInfo.TransportStreamID = eventInfo.transport_stream_id; reserveInfo.ServiceID = eventInfo.service_id; reserveInfo.EventID = eventInfo.event_id; RecSettingData setInfo = new RecSettingData(); Settings.GetDefRecSetting(0, ref setInfo); // デフォルトをとって来てくれる? reserveInfo.RecSetting = setInfo; List<ReserveData> list = new List<ReserveData>(); list.Add(reserveInfo); ErrCode err = (ErrCode)cmd.SendAddReserve(list); if (err == ErrCode.CMD_ERR_CONNECT) { MessageBox.Show("サーバー または EpgTimerSrv に接続できませんでした。"); } if (err == ErrCode.CMD_ERR_TIMEOUT) { MessageBox.Show("EpgTimerSrvとの接続にタイムアウトしました。"); } if (err != ErrCode.CMD_SUCCESS) { MessageBox.Show("簡易予約でエラーが発生しました。終了時間がすでに過ぎている可能性があります。"); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
/// <summary> /// 右クリックメニュー 自動予約登録イベント呼び出し /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cm_autoadd_Click(object sender, RoutedEventArgs e) { try { if (sender.GetType() != typeof(MenuItem)) { return; } EpgEventInfo program = new EpgEventInfo(); if (GetProgramItem(clickPos, ref program) == false) { return; } SearchWindow dlg = new SearchWindow(); dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual; dlg.SetViewMode(1); EpgSearchKeyInfo key = new EpgSearchKeyInfo(); if (program.ShortInfo != null) { key.andKey = program.ShortInfo.event_name; } Int64 sidKey = ((Int64)program.original_network_id) << 32 | ((Int64)program.transport_stream_id) << 16 | ((Int64)program.service_id); key.serviceList.Add(sidKey); dlg.SetSearchDefKey(key); dlg.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
/// <summary> /// 右クリックメニュー 予約追加クリックイベント呼び出し /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cm_add_Click(object sender, RoutedEventArgs e) { try { EpgEventInfo program = new EpgEventInfo(); if (GetProgramItem(clickPos, ref program) == false) { return; } AddReserve(program); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
/// <summary> /// 右ボタンクリック /// </summary> /// <param name="sender"></param> /// <param name="cursorPos"></param> void epgProgramView_RightClick(object sender, Point cursorPos) { try { //右クリック表示メニューの作成 clickPos = cursorPos; ReserveData reserve = new ReserveData(); EpgEventInfo program = new EpgEventInfo(); bool noItem = false; bool addMode = false; if (GetReserveItem(cursorPos, ref reserve) == false) { if (GetProgramItem(cursorPos, ref program) == false) { noItem = true; } addMode = true; } ContextMenu menu = new ContextMenu(); MenuItem menuItemNew = new MenuItem(); menuItemNew.Header = "簡易予約"; menuItemNew.Click += new RoutedEventHandler(cm_new_Click); Separator separate = new Separator(); MenuItem menuItemAdd = new MenuItem(); menuItemAdd.Header = "予約追加 (_C)"; MenuItem menuItemAddDlg = new MenuItem(); menuItemAddDlg.Header = "ダイアログ表示 (_X)"; menuItemAddDlg.Click += new RoutedEventHandler(cm_add_Click); menuItemAdd.Items.Add(menuItemAddDlg); menuItemAdd.Items.Add(separate); MenuItem menuItemPreset = new MenuItem(); menuItemPreset.Header = "プリセット (_Z)"; foreach (RecPresetItem info in Settings.Instance.RecPresetList) { MenuItem menuItem = new MenuItem(); menuItem.Header = info.DisplayName; menuItem.DataContext = info.ID; menuItem.Click += new RoutedEventHandler(cm_add_preset_Click); menuItemPreset.Items.Add(menuItem); } menuItemAdd.Items.Add(menuItemPreset); Separator separate2 = new Separator(); MenuItem menuItemChg = new MenuItem(); menuItemChg.Header = "予約変更 (_C)"; MenuItem menuItemChgDlg = new MenuItem(); menuItemChgDlg.Header = "ダイアログ表示 (_X)"; menuItemChgDlg.Click += new RoutedEventHandler(cm_chg_Click); menuItemChg.Items.Add(menuItemChgDlg); menuItemChg.Items.Add(separate2); MenuItem menuItemChgRecMode0 = new MenuItem(); menuItemChgRecMode0.Header = "全サービス (_0)"; menuItemChgRecMode0.DataContext = 0; menuItemChgRecMode0.Click += new RoutedEventHandler(cm_chg_recmode_Click); MenuItem menuItemChgRecMode1 = new MenuItem(); menuItemChgRecMode1.Header = "指定サービス (_1)"; menuItemChgRecMode1.DataContext = 1; menuItemChgRecMode1.Click += new RoutedEventHandler(cm_chg_recmode_Click); MenuItem menuItemChgRecMode2 = new MenuItem(); menuItemChgRecMode2.Header = "全サービス(デコード処理なし) (_2)"; menuItemChgRecMode2.DataContext = 2; menuItemChgRecMode2.Click += new RoutedEventHandler(cm_chg_recmode_Click); MenuItem menuItemChgRecMode3 = new MenuItem(); menuItemChgRecMode3.Header = "指定サービス(デコード処理なし) (_3)"; menuItemChgRecMode3.DataContext = 3; menuItemChgRecMode3.Click += new RoutedEventHandler(cm_chg_recmode_Click); MenuItem menuItemChgRecMode4 = new MenuItem(); menuItemChgRecMode4.Header = "視聴 (_4)"; menuItemChgRecMode4.DataContext = 4; menuItemChgRecMode4.Click += new RoutedEventHandler(cm_chg_recmode_Click); MenuItem menuItemChgRecMode5 = new MenuItem(); menuItemChgRecMode5.Header = "無効 (_5)"; menuItemChgRecMode5.DataContext = 5; menuItemChgRecMode5.Click += new RoutedEventHandler(cm_chg_recmode_Click); menuItemChg.Items.Add(menuItemChgRecMode0); menuItemChg.Items.Add(menuItemChgRecMode1); menuItemChg.Items.Add(menuItemChgRecMode2); menuItemChg.Items.Add(menuItemChgRecMode3); menuItemChg.Items.Add(menuItemChgRecMode4); menuItemChg.Items.Add(menuItemChgRecMode5); menuItemChg.Items.Add(new Separator()); MenuItem menuItemChgRecPri = new MenuItem(); menuItemChgRecPri.Tag = "優先度 {0} (_E)"; MenuItem menuItemChgRecPri1 = new MenuItem(); menuItemChgRecPri1.Header = "1 (_1)"; menuItemChgRecPri1.DataContext = 1; menuItemChgRecPri1.Click += new RoutedEventHandler(cm_chg_priority_Click); MenuItem menuItemChgRecPri2 = new MenuItem(); menuItemChgRecPri2.Header = "2 (_2)"; menuItemChgRecPri2.DataContext = 2; menuItemChgRecPri2.Click += new RoutedEventHandler(cm_chg_priority_Click); MenuItem menuItemChgRecPri3 = new MenuItem(); menuItemChgRecPri3.Header = "3 (_3)"; menuItemChgRecPri3.DataContext = 3; menuItemChgRecPri3.Click += new RoutedEventHandler(cm_chg_priority_Click); MenuItem menuItemChgRecPri4 = new MenuItem(); menuItemChgRecPri4.Header = "4 (_4)"; menuItemChgRecPri4.DataContext = 4; menuItemChgRecPri4.Click += new RoutedEventHandler(cm_chg_priority_Click); MenuItem menuItemChgRecPri5 = new MenuItem(); menuItemChgRecPri5.Header = "5 (_5)"; menuItemChgRecPri5.DataContext = 5; menuItemChgRecPri5.Click += new RoutedEventHandler(cm_chg_priority_Click); menuItemChgRecPri.Items.Add(menuItemChgRecPri1); menuItemChgRecPri.Items.Add(menuItemChgRecPri2); menuItemChgRecPri.Items.Add(menuItemChgRecPri3); menuItemChgRecPri.Items.Add(menuItemChgRecPri4); menuItemChgRecPri.Items.Add(menuItemChgRecPri5); menuItemChg.Items.Add(menuItemChgRecPri); MenuItem menuItemDel = new MenuItem(); menuItemDel.Header = "予約削除"; menuItemDel.Click += new RoutedEventHandler(cm_del_Click); MenuItem menuItemAutoAdd = new MenuItem(); menuItemAutoAdd.Header = "自動予約登録"; menuItemAutoAdd.Click += new RoutedEventHandler(cm_autoadd_Click); MenuItem menuItemTimeshift = new MenuItem(); menuItemTimeshift.Header = "追っかけ再生 (_P)"; menuItemTimeshift.Click += new RoutedEventHandler(cm_timeShiftPlay_Click); //表示モード Separator separate3 = new Separator(); MenuItem menuItemView = new MenuItem(); menuItemView.Header = "表示モード (_W)"; MenuItem menuItemViewSetDlg = new MenuItem(); menuItemViewSetDlg.Header = "表示設定"; menuItemViewSetDlg.Click += new RoutedEventHandler(cm_viewSet_Click); MenuItem menuItemChgViewMode1 = new MenuItem(); menuItemChgViewMode1.Header = "標準モード (_1)"; menuItemChgViewMode1.DataContext = 0; menuItemChgViewMode1.Click += new RoutedEventHandler(cm_chg_viewMode_Click); MenuItem menuItemChgViewMode2 = new MenuItem(); menuItemChgViewMode2.Header = "1週間モード (_2)"; menuItemChgViewMode2.DataContext = 1; menuItemChgViewMode2.Click += new RoutedEventHandler(cm_chg_viewMode_Click); MenuItem menuItemChgViewMode3 = new MenuItem(); menuItemChgViewMode3.Header = "リスト表示モード (_3)"; menuItemChgViewMode3.DataContext = 2; menuItemChgViewMode3.Click += new RoutedEventHandler(cm_chg_viewMode_Click); if (setViewInfo.ViewMode == 1) { menuItemChgViewMode2.IsChecked = true; } else if (setViewInfo.ViewMode == 2) { menuItemChgViewMode3.IsChecked = true; } else { menuItemChgViewMode1.IsChecked = true; } //menuItemView.Items.Add(menuItemChgViewMode1); menuItemView.Items.Add(menuItemChgViewMode2); menuItemView.Items.Add(menuItemChgViewMode3); menuItemView.Items.Add(separate3); menuItemView.Items.Add(menuItemViewSetDlg); if (noItem == true) { menuItemNew.IsEnabled = false; menuItemAdd.IsEnabled = false; menuItemChg.IsEnabled = false; menuItemDel.IsEnabled = false; menuItemAutoAdd.IsEnabled = false; menuItemTimeshift.IsEnabled = false; menuItemView.IsEnabled = true; } else { if (addMode == false) { menuItemNew.IsEnabled = false; menuItemAdd.IsEnabled = false; menuItemChg.IsEnabled = true; ((MenuItem)menuItemChg.Items[menuItemChg.Items.IndexOf(menuItemChgRecMode0) + Math.Min((int)reserve.RecSetting.RecMode, 5)]).IsChecked = true; ((MenuItem)menuItemChgRecPri.Items[Math.Min((int)(reserve.RecSetting.Priority - 1), 4)]).IsChecked = true; menuItemChgRecPri.Header = string.Format((string)menuItemChgRecPri.Tag, reserve.RecSetting.Priority); menuItemDel.IsEnabled = true; menuItemAutoAdd.IsEnabled = true; menuItemTimeshift.IsEnabled = true; menuItemView.IsEnabled = true; } else { menuItemNew.IsEnabled = true; menuItemAdd.IsEnabled = true; menuItemChg.IsEnabled = false; menuItemDel.IsEnabled = false; menuItemAutoAdd.IsEnabled = true; menuItemTimeshift.IsEnabled = false; menuItemView.IsEnabled = true; } } menu.Items.Add(menuItemNew); menu.Items.Add(menuItemAdd); menu.Items.Add(menuItemChg); menu.Items.Add(menuItemDel); menu.Items.Add(menuItemAutoAdd); menu.Items.Add(menuItemTimeshift); menu.Items.Add(menuItemView); menu.IsOpen = true; } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
/// <summary> /// 左ボタンダブルクリックイベント呼び出し /// </summary> /// <param name="sender"></param> /// <param name="cursorPos"></param> void epgProgramView_LeftDoubleClick(object sender, Point cursorPos) { try { //まず予約情報あるかチェック ReserveData reserve = new ReserveData(); if (GetReserveItem(cursorPos, ref reserve) == true) { //予約変更ダイアログ表示 ChangeReserve(reserve); return; } //番組情報あるかチェック EpgEventInfo program = new EpgEventInfo(); if (GetProgramItem(cursorPos, ref program) == true) { //予約追加ダイアログ表示 AddReserve(program); return; } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public EpgEventInfo SearchEventInfo(bool getSrv = false) { EpgEventInfo eventInfo = null; try { if (IsEpgReserve == true) { UInt64 key = Create64Key(); if (CommonManager.Instance.DB.ServiceEventList.ContainsKey(key) == true) { foreach (EpgEventInfo eventChkInfo in CommonManager.Instance.DB.ServiceEventList[key].eventList) { if (eventChkInfo.event_id == EventID) { eventInfo = eventChkInfo; break; } } } if (eventInfo == null && getSrv == true) { UInt64 pgId = Create64PgKey(); eventInfo = new EpgEventInfo(); CommonManager.Instance.CtrlCmd.SendGetPgInfo(pgId, ref eventInfo); } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } return eventInfo; }
public void SetEventInfo(EpgEventInfo eventData) { try { eventInfo = eventData; textBox_info.Text = CommonManager.Instance.ConvertProgramText(eventData, EventInfoTextMode.BasicOnly); String text = CommonManager.Instance.ConvertProgramText(eventData, EventInfoTextMode.ExtOnly); Regex regex = new Regex("((http://|https://|http://|https://).*\r\n)"); if (regex.IsMatch(text) == true) { try { //Regexのsplitでやるとhttp://だけのも取れたりするので、1つずつ行う FlowDocument flowDoc = new FlowDocument(); Paragraph para = new Paragraph(); do { Match matchVal = regex.Match(text); int index = text.IndexOf(matchVal.Value); para.Inlines.Add(text.Substring(0, index)); text = text.Remove(0, index); Hyperlink h = new Hyperlink(new Run(matchVal.Value.Replace("\r\n", ""))); h.MouseLeftButtonDown += new MouseButtonEventHandler(h_MouseLeftButtonDown); h.Foreground = Brushes.Blue; h.Cursor = Cursors.Hand; String url = CommonManager.ReplaceUrl(matchVal.Value.Replace("\r\n", "")); h.NavigateUri = new Uri(url); para.Inlines.Add(h); para.Inlines.Add("\r\n"); text = text.Remove(0, matchVal.Value.Length); } while (regex.IsMatch(text) == true); para.Inlines.Add(text); flowDoc.Blocks.Add(para); richTextBox_descInfo.Document = flowDoc; } catch { text = CommonManager.Instance.ConvertProgramText(eventInfo, EventInfoTextMode.All); FlowDocument flowDoc = new FlowDocument(); flowDoc.Blocks.Add(new Paragraph(new Run(text))); richTextBox_descInfo.Document = flowDoc; } } else { FlowDocument flowDoc = new FlowDocument(); flowDoc.Blocks.Add(new Paragraph(new Run(text))); richTextBox_descInfo.Document = flowDoc; } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public SearchItem(EpgEventInfo item) { eventInfo = item; }
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.EventID != 0xFFFF && 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; }
public static bool EqualsPg(EpgEventInfo i1, ReserveData i2, bool IdMode = true, bool TimeMode = false) { return EqualsPg(ConvertEpgToReserveData(i1), i2, IdMode, TimeMode); }
private void ResetProgramContent() { richTextBox_descInfo.Document = CommonManager.Instance.ConvertDisplayText(null); eventInfoDisplay = null; }
public ProgramViewItem(EpgEventInfo info) { EventInfo = info; TitleDrawErr = false; }
/// <summary> /// 右クリックメニュー 番組名でググるイベント呼び出し /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cm_google_Click(object sender, RoutedEventArgs e) { try { if (sender.GetType() != typeof(MenuItem)) { return; } EpgEventInfo program = new EpgEventInfo(); if (GetProgramItem(clickPos, ref program) == false) { return; } PopupWindow _popupWindow = new PopupWindow(Window.GetWindow(this)); _popupWindow.google(program.ShortInfo.event_name); _popupWindow.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public String ConvertProgramText(EpgEventInfo eventInfo, EventInfoTextMode textMode) { string retText = ""; string basicInfo = ""; string extInfo = ""; if (eventInfo != null) { UInt64 key = eventInfo.Create64Key(); if (ChSet5.ChList.ContainsKey(key) == true) { basicInfo += ChSet5.ChList[key].ServiceName + "(" + ChSet5.ChList[key].NetworkName + ")" + "\r\n"; } basicInfo += ConvertTimeText(eventInfo) + "\r\n"; if (eventInfo.ShortInfo != null) { basicInfo += eventInfo.ShortInfo.event_name + "\r\n\r\n"; extInfo += eventInfo.ShortInfo.text_char + "\r\n\r\n"; } if (eventInfo.ExtInfo != null) { extInfo += eventInfo.ExtInfo.text_char + "\r\n\r\n"; } //ジャンル extInfo += "ジャンル :\r\n"; if (eventInfo.ContentInfo != null) { foreach (EpgContentData info in eventInfo.ContentInfo.nibbleList) { UInt16 ID1 = (UInt16)(((UInt16)info.content_nibble_level_1) << 8 | 0xFF); UInt16 ID2 = (UInt16)(((UInt16)info.content_nibble_level_1) << 8 | info.content_nibble_level_2); if (ID2 == 0x0e01)//CS、仮対応データをそのまま使用。 { ID1 = (UInt16)(((UInt16)info.user_nibble_1) << 8 | 0x70FF); ID2 = (UInt16)(((UInt16)info.user_nibble_1) << 8 | 0x7000 | info.user_nibble_2); } String content = ""; ContentKindInfo kindInfo; if (ContentKindDictionary.TryGetValue(ID1, out kindInfo) == true) { content += kindInfo.ContentName; } else { content += "不明" + "(0x" + info.content_nibble_level_1.ToString("X2") + info.content_nibble_level_2.ToString("X2") + ")"; } if (ContentKindDictionary.TryGetValue(ID2, out kindInfo) == true) { content += " - " + kindInfo.SubName; } else { content += " - " + "不明" + "(0x" + info.user_nibble_1.ToString("X2") + info.user_nibble_2.ToString("X2") + ")"; } extInfo += content + "\r\n"; } } extInfo += "\r\n"; //映像 extInfo += "映像 :"; if (eventInfo.ComponentInfo != null) { int streamContent = eventInfo.ComponentInfo.stream_content; int componentType = eventInfo.ComponentInfo.component_type; UInt16 componentKey = (UInt16)(streamContent << 8 | componentType); if (ComponentKindDictionary.ContainsKey(componentKey) == true) { extInfo += ComponentKindDictionary[componentKey]; } if (eventInfo.ComponentInfo.text_char.Length > 0) { extInfo += "\r\n"; extInfo += eventInfo.ComponentInfo.text_char; } } extInfo += "\r\n"; //音声 extInfo += "音声 :\r\n"; if (eventInfo.AudioInfo != null) { foreach (EpgAudioComponentInfoData info in eventInfo.AudioInfo.componentList) { int streamContent = info.stream_content; int componentType = info.component_type; UInt16 componentKey = (UInt16)(streamContent << 8 | componentType); if (ComponentKindDictionary.ContainsKey(componentKey) == true) { extInfo += ComponentKindDictionary[componentKey]; } if (info.text_char.Length > 0) { extInfo += "\r\n"; extInfo += info.text_char; } extInfo += "\r\n"; extInfo += "サンプリングレート :"; switch (info.sampling_rate) { case 1: extInfo += "16kHz"; break; case 2: extInfo += "22.05kHz"; break; case 3: extInfo += "24kHz"; break; case 5: extInfo += "32kHz"; break; case 6: extInfo += "44.1kHz"; break; case 7: extInfo += "48kHz"; break; default: break; } extInfo += "\r\n"; } } extInfo += "\r\n"; //スクランブル if (!ChSet5.IsDttv(eventInfo.original_network_id)) { if (eventInfo.FreeCAFlag == 0) { extInfo += "無料放送\r\n"; } else { extInfo += "有料放送\r\n"; } extInfo += "\r\n"; } //イベントリレー if (eventInfo.EventRelayInfo != null) { if (eventInfo.EventRelayInfo.eventDataList.Count > 0) { extInfo += "イベントリレーあり:\r\n"; foreach (EpgEventData info in eventInfo.EventRelayInfo.eventDataList) { key = info.Create64Key(); if (ChSet5.ChList.ContainsKey(key) == true) { extInfo += ChSet5.ChList[key].ServiceName + "(" + ChSet5.ChList[key].NetworkName + ")" + " "; } else { extInfo += "OriginalNetworkID : " + info.original_network_id.ToString() + " (0x" + info.original_network_id.ToString("X4") + ") "; extInfo += "TransportStreamID : " + info.transport_stream_id.ToString() + " (0x" + info.transport_stream_id.ToString("X4") + ") "; extInfo += "ServiceID : " + info.service_id.ToString() + " (0x" + info.service_id.ToString("X4") + ") "; } extInfo += "EventID : " + info.event_id.ToString() + " (0x" + info.event_id.ToString("X4") + ")\r\n"; extInfo += "\r\n"; } extInfo += "\r\n"; } } extInfo += "OriginalNetworkID : " + eventInfo.original_network_id.ToString() + " (0x" + eventInfo.original_network_id.ToString("X4") + ")\r\n"; extInfo += "TransportStreamID : " + eventInfo.transport_stream_id.ToString() + " (0x" + eventInfo.transport_stream_id.ToString("X4") + ")\r\n"; extInfo += "ServiceID : " + eventInfo.service_id.ToString() + " (0x" + eventInfo.service_id.ToString("X4") + ")\r\n"; extInfo += "EventID : " + eventInfo.event_id.ToString() + " (0x" + eventInfo.event_id.ToString("X4") + ")\r\n"; } if (textMode == EventInfoTextMode.All || textMode == EventInfoTextMode.BasicOnly) { retText = basicInfo; } if (textMode == EventInfoTextMode.All || textMode == EventInfoTextMode.ExtOnly) { retText += extInfo; } return retText; }
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.EventID != 0xFFFF && 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; } } }
public EventInfoItem(EpgEventInfo EventInfo) { this.EventInfo = EventInfo; }
private void AddReserve(EpgEventInfo eventInfo) { try { AddReserveEpgWindow dlg = new AddReserveEpgWindow(); dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual; dlg.SetEventInfo(eventInfo); if (dlg.ShowDialog() == true) { CommonManager.Instance.DB.SetUpdateNotify((UInt32)UpdateNotifyItem.ReserveInfo); CommonManager.Instance.DB.ReloadReserveInfo(); SearchPg(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
/// <summary> /// 予約追加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddReserve(EpgEventInfo eventInfo) { try { AddReserveEpgWindow dlg = new AddReserveEpgWindow(); dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual; dlg.SetOpenMode(Settings.Instance.EpgInfoOpenMode); dlg.SetEventInfo(eventInfo); if (dlg.ShowDialog() == true) { } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }