Beispiel #1
0
 private void listView_result_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (listView_result.SelectedItem != null)
         {
             SearchItem item = listView_result.SelectedItem as SearchItem;
             if (item.IsReserved == true)
             {
                 ChangeReserve(item.ReserveInfo);
             }
             else
             {
                 AddReserve(item.EventInfo);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
     }
 }
Beispiel #2
0
 protected override void mcs_ctxmLoading_switch(ContextMenu ctxm, MenuItem menu)
 {
     base.mcs_ctxmLoading_switch(ctxm, menu);
     //
     // ジャンル登録
     //
     if (menu.Tag == EpgCmds.SetGenre)
     {
         SearchWindow sw1 = Owner as SearchWindow;
         if (sw1.listView_result.SelectedItem != null)
         {
             SearchItem si1 = sw1.listView_result.SelectedItem as SearchItem;
             if (si1 != null && si1.EventInfo.ContentInfo != null)
             {
                 MenuUtil.addGenre(menu, si1.EventInfo.ContentInfo.nibbleList, (contentKindInfo0) =>
                 {
                     sw1.searchKeyView.setGenre(contentKindInfo0);
                 });
             }
         }
     }
 }
Beispiel #3
0
        /// <summary>予約一覧からのジャンプ先を番組表タブから探す</summary>
        public bool SearchJumpTargetProgram(SearchItem trg, bool dryrun = false)
        {
            try
            {
                if (trg == null)
                {
                    return(false);
                }

                var data = (AutoAddTargetData)trg.ReserveInfo ?? trg.EventInfo;
                if (data == null || data.PgStartTime == DateTime.MaxValue)
                {
                    return(false);
                }

                var tabs = Tabs.Where(t => t.Info.JumpTarget).OrderBy(tb => !tb.IsSelected).ToList();
                if (tabs.Any() == false)//dryrun以外でここに来るときは本当にタブが無い
                {
                    var infoList = Settings.Instance.UseCustomEpgView == false?
                                   CommonManager.CreateDefaultTabInfo() : Settings.Instance.CustomEpgTabList.ToList();

                    return(infoList.Where(info => info.IsVisible && info.JumpTarget)
                           .SelectMany(info => CommonManager.Instance.DB.ExpandSpecialKey(info.ViewServiceList)).Contains(data.Create64Key()));
                }

                //表示されてるものがなければキーを持っているタブを当たる
                var tab = tabs.FirstOrDefault(tb => tb.view != null && tb.IsEpgLoaded && tb.view.IsEnabledJumpTab(trg))
                          ?? tabs.FirstOrDefault(tb => tb.HasKey(data.Create64Key()));

                if (tab != null && dryrun == false)
                {
                    tab.IsSelected = true;
                }
                return(tab != null);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
            return(false);
        }
Beispiel #4
0
        private void MenuItem_Click_ProgramTable(object sender, RoutedEventArgs e)
        {
            SearchItem item1 = this.listView_result.SelectedItem as SearchItem;

            if (item1 != null)
            {
                MainWindow mainWindow1 = this.Owner as MainWindow;
                if (mainWindow1 != null)
                {
                    if (mainWindow1.OwnedWindows.OfType <SearchWindow>().Count() > 1)
                    {
                        // 非表示で保存するSearchWindowを1つに限定するため
                        this.Close();
                    }
                    else
                    {
                        this.Hide();
                        mainWindow1.EmphasizeSearchButton(true);
                    }
                    mainWindow1.SearchJumpTargetProgram(item1.EventInfo);
                }
            }
        }
Beispiel #5
0
        private void cm_autoadd_Click(object sender, RoutedEventArgs e)
        {
            {
                if (listView_event.SelectedItem != null)
                {
                    SearchItem item = listView_event.SelectedItem as SearchItem;

                    SearchWindow dlg = new SearchWindow();
                    dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual;

                    EpgSearchKeyInfo key = new EpgSearchKeyInfo();

                    if (item.EventInfo.ShortInfo != null)
                    {
                        key.andKey = item.EventInfo.ShortInfo.event_name;
                    }
                    key.serviceList.Add((long)CommonManager.Create64Key(item.EventInfo.original_network_id, item.EventInfo.transport_stream_id, item.EventInfo.service_id));

                    dlg.SetSearchDefKey(key);
                    dlg.ShowDialog();
                }
            }
        }
Beispiel #6
0
        protected virtual SearchItem mcs_GetJumpTabItem(CtxmCode trg_code)
        {
            SearchItem item = mcs_GetSearchItem();

            if (item == null)
            {
                return(null);
            }

            bool reserveOnly   = trg_code == CtxmCode.ReserveView || trg_code == CtxmCode.TunerReserveView;
            bool onReserveOnly = trg_code == CtxmCode.TunerReserveView && Settings.Instance.TunerDisplayOffReserve == false;

            if (reserveOnly && item.IsReserved == false)
            {
                return(null);
            }
            if (onReserveOnly && item.ReserveInfo.IsEnabled == false)
            {
                return(null);
            }

            return(item);
        }
Beispiel #7
0
            public int Compare(T x1, T x2)
            {
                int cmprResult1 = 0;

                PropertyInfo pi1 = typeof(T).GetProperty(this.sortBy);
                string       val1 = pi1.GetValue(x1, null).ToString();
                string       val2 = pi1.GetValue(x2, null).ToString();
                double       d1, d2;

                if (double.TryParse(val1, out d1) && double.TryParse(val2, out d2))     // 数値?
                {
                    cmprResult1 = d1.CompareTo(d2);
                }
                else
                {
                    cmprResult1 = val1.CompareTo(val2);
                }
                // 降順
                if (this.direction == ListSortDirection.Descending)
                {
                    cmprResult1 *= -1;
                }
                // 比較結果が同じ
                if (cmprResult1 == 0)
                {
                    // 再読み込みなどで並びが変わるのを防ぐ
                    Type type1 = x1.GetType();
                    if (type1 == typeof(SearchItem))
                    {
                        SearchItem x1_1 = x1 as SearchItem;
                        SearchItem x2_1 = x2 as SearchItem;
                        cmprResult1 = x1_1.EventInfo.event_id.CompareTo(x2_1.EventInfo.event_id);
                    }
                }

                return(cmprResult1);
            }
Beispiel #8
0
        private void button_add_reserve_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (listView_result.SelectedItem != null)
                {
                    SearchItem   item      = listView_result.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;

                    RecSettingData setInfo = new RecSettingData();
                    recSettingView.GetRecSetting(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("予約登録でエラーが発生しました。終了時間がすでに過ぎている可能性があります。");
                    }

                    CommonManager.Instance.DB.SetUpdateNotify((UInt32)UpdateNotifyItem.ReserveInfo);
                    CommonManager.Instance.DB.ReloadReserveInfo();
                    SearchPg();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Beispiel #9
0
        private void SearchPg()
        {
            try
            {
                ICollectionView dataView = CollectionViewSource.GetDefaultView(listView_result.DataContext);
                if (dataView != null)
                {
                    dataView.SortDescriptions.Clear();
                    dataView.Refresh();
                }
                listView_result.DataContext = null;

                resultList.Clear();


                EpgSearchKeyInfo key = new EpgSearchKeyInfo();
                searchKeyView.GetSearchKey(ref key);
                List <EpgSearchKeyInfo> keyList = new List <EpgSearchKeyInfo>();

                keyList.Add(key);
                List <EpgEventInfo> list = new List <EpgEventInfo>();

                cmd.SendSearchPg(keyList, ref list);
                foreach (EpgEventInfo info in list)
                {
                    SearchItem item = new SearchItem();
                    item.EventInfo = info;

                    if (item.EventInfo.start_time.AddSeconds(item.EventInfo.durationSec) > DateTime.Now)
                    {
                        foreach (ReserveData info2 in CommonManager.Instance.DB.ReserveList.Values)
                        {
                            if (info.original_network_id == info2.OriginalNetworkID &&
                                info.transport_stream_id == info2.TransportStreamID &&
                                info.service_id == info2.ServiceID &&
                                info.event_id == info2.EventID)
                            {
                                item.ReserveInfo = info2;
                                break;
                            }
                        }
                        UInt64 serviceKey = CommonManager.Create64Key(info.original_network_id, info.transport_stream_id, info.service_id);
                        if (ChSet5.Instance.ChList.ContainsKey(serviceKey) == true)
                        {
                            item.ServiceName = ChSet5.Instance.ChList[serviceKey].ServiceName;
                        }
                        if (Settings.Instance.FixSearchResult)
                        {
                            item.EventInfo.ShortInfo.text_char = "省略";
                        }

                        resultList.Add(item);
                    }
                }

                listView_result.DataContext = resultList;
                //if (_lastHeaderClicked != null) {
                //    Sort(_lastHeaderClicked, _lastDirection);
                //} else {
                //    string header = ((Binding)gridView_result.Columns[1].DisplayMemberBinding).Path.Path;
                //    Sort(header, _lastDirection);
                //    _lastHeaderClicked = header;
                //}
                if (this.gridViewSorter.isExistSortParams)
                {
                    this.gridViewSorter.SortByMultiHeader(this.resultList);
                }
                else
                {
                    this.gridViewSorter.resetSortParams();
                    this.gridViewSorter.SortByMultiHeader(
                        this.resultList,
                        gridView_result.Columns[1].Header as GridViewColumnHeader);
                }

                searchKeyView.SaveSearchLog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Beispiel #10
0
 protected virtual void mcs_SetBlackoutWindow(SearchItem item = null)
 {
     BlackoutWindow.SelectedItem = item;
 }
Beispiel #11
0
        private void UpdateEventList()
        {
            try
            {
                listView_event.ItemsSource = null;
                var programList = new List <SearchItem>();

                Dictionary <UInt64, EpgServiceAllEventInfo> eventList = null;
                if (setViewInfo.SearchMode == true)
                {
                    eventList = serviceEventList;
                }
                else
                {
                    eventList = CommonManager.Instance.DB.ServiceEventList;
                }
                List <ushort> contentKindList = setViewInfo.ViewContentKindList.ToList();
                contentKindList.Sort();

                DateTime now = DateTime.UtcNow.AddHours(9);
                foreach (ServiceItem info in listBox_service.ItemsSource ?? Enumerable.Empty <object>())
                {
                    if (info.IsSelected == true)
                    {
                        if (eventList.ContainsKey(info.ID) == true)
                        {
                            int eventInfoIndex = -1;
                            foreach (EpgEventInfo eventInfo in Enumerable.Concat(eventList[info.ID].eventArcList, eventList[info.ID].eventList))
                            {
                                bool past = ++eventInfoIndex < eventList[info.ID].eventArcList.Count;
                                if (eventInfo.StartTimeFlag == 0)
                                {
                                    //開始未定は除外
                                    continue;
                                }
                                if (setViewInfo.FilterEnded)
                                {
                                    if (eventInfo.start_time.AddSeconds(eventInfo.DurationFlag == 0 ? 0 : eventInfo.durationSec) < now)
                                    {
                                        continue;
                                    }
                                }
                                //ジャンル絞り込み
                                if (contentKindList.Count > 0)
                                {
                                    bool find = false;
                                    if (eventInfo.ContentInfo == null || eventInfo.ContentInfo.nibbleList.Count == 0)
                                    {
                                        //ジャンル情報ない
                                        find = contentKindList.BinarySearch(0xFFFF) >= 0;
                                    }
                                    else
                                    {
                                        foreach (EpgContentData contentInfo in eventInfo.ContentInfo.nibbleList)
                                        {
                                            int nibble1 = contentInfo.content_nibble_level_1;
                                            int nibble2 = contentInfo.content_nibble_level_2;
                                            if (nibble1 == 0x0E && nibble2 <= 0x01)
                                            {
                                                nibble1 = contentInfo.user_nibble_1 | (0x60 + nibble2 * 16);
                                                nibble2 = contentInfo.user_nibble_2;
                                            }
                                            if (contentKindList.BinarySearch((ushort)(nibble1 << 8 | 0xFF)) >= 0 ||
                                                contentKindList.BinarySearch((ushort)(nibble1 << 8 | nibble2)) >= 0)
                                            {
                                                find = true;
                                                break;
                                            }
                                        }
                                    }
                                    if (find == false)
                                    {
                                        //ジャンル見つからないので除外
                                        continue;
                                    }
                                }
                                //イベントグループのチェック
                                if (eventInfo.EventGroupInfo != null)
                                {
                                    bool spanFlag = false;
                                    foreach (EpgEventData data in eventInfo.EventGroupInfo.eventDataList)
                                    {
                                        if (info.ServiceInfo.ONID == data.original_network_id &&
                                            info.ServiceInfo.TSID == data.transport_stream_id &&
                                            info.ServiceInfo.SID == data.service_id)
                                        {
                                            spanFlag = true;
                                            break;
                                        }
                                    }

                                    if (spanFlag == false)
                                    {
                                        //サービス2やサービス3の結合されるべきもの
                                        continue;
                                    }
                                }

                                SearchItem item = new SearchItem(eventInfo, past);
                                item.ServiceName = info.ServiceInfo.service_name;
                                programList.Add(item);
                            }
                        }
                    }
                }
                listView_event.ItemsSource = programList;
                RefreshReserve();

                if (_lastHeaderClicked != null)
                {
                    //string header = ((Binding)_lastHeaderClicked.DisplayMemberBinding).Path.Path;
                    Sort(_lastHeaderClicked, _lastDirection);
                }
                else
                {
                    string header = ((Binding)gridView_event.Columns[1].DisplayMemberBinding).Path.Path;
                    Sort(header, _lastDirection);
                    _lastHeaderClicked = header;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Beispiel #12
0
 /// <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);
     }
 }
Beispiel #13
0
 public static void Clear()
 {
     SelectedItem = null;
     NowJumpTable = false;
 }
Beispiel #14
0
 public static void Clear()
 {
     SelectedItem = null;
     NowJumpTable = false;
 }
Beispiel #15
0
        private void UpdateEventList()
        {
            try
            {
                ICollectionView dataView = CollectionViewSource.GetDefaultView(listView_event.DataContext);
                if (dataView != null)
                {
                    dataView.SortDescriptions.Clear();
                    dataView.Refresh();
                }
                listView_event.DataContext = null;

                //listView_event.ItemsSource = null;
                programList.Clear();

                Dictionary<UInt64, EpgServiceEventInfo> eventList = null;
                if (setViewInfo.SearchMode == true)
                {
                    eventList = serviceEventList;
                }
                else
                {
                    eventList = CommonManager.Instance.DB.ServiceEventList;
                }

                DateTime now = DateTime.Now;
                foreach (ServiceItem info in serviceList)
                {
                    if (info.IsSelected == true)
                    {
                        if (eventList.ContainsKey(info.ID) == true)
                        {
                            foreach (EpgEventInfo eventInfo in eventList[info.ID].eventList)
                            {
                                if (eventInfo.StartTimeFlag == 0)
                                {
                                    //開始未定は除外
                                    continue;
                                }
                                if (setViewInfo.FilterEnded)
                                {
                                    if (eventInfo.start_time.AddSeconds(eventInfo.DurationFlag == 0 ? 0 : eventInfo.durationSec) < now)
                                        continue;
                                }
                                //ジャンル絞り込み
                                if (this.viewCustContentKindList.Count > 0)
                                {
                                    bool find = false;
                                    if (eventInfo.ContentInfo != null)
                                    {
                                        if (eventInfo.ContentInfo.nibbleList.Count > 0)
                                        {
                                            foreach (EpgContentData contentInfo in eventInfo.ContentInfo.nibbleList)
                                            {
                                                UInt16 ID1 = (UInt16)(((UInt16)contentInfo.content_nibble_level_1) << 8 | 0xFF);
                                                UInt16 ID2 = (UInt16)(((UInt16)contentInfo.content_nibble_level_1) << 8 | contentInfo.content_nibble_level_2);
                                                if (this.viewCustContentKindList.ContainsKey(ID1) == true)
                                                {
                                                    find = true;
                                                    break;
                                                }
                                                else if (this.viewCustContentKindList.ContainsKey(ID2) == true)
                                                {
                                                    find = true;
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                    if (find == false)
                                    {
                                        //ジャンル見つからないので除外
                                        continue;
                                    }
                                }
                                //イベントグループのチェック
                                if (eventInfo.EventGroupInfo != null)
                                {
                                    bool spanFlag = false;
                                    foreach (EpgEventData data in eventInfo.EventGroupInfo.eventDataList)
                                    {
                                        if (info.ServiceInfo.ONID == data.original_network_id &&
                                            info.ServiceInfo.TSID == data.transport_stream_id &&
                                            info.ServiceInfo.SID == data.service_id)
                                        {
                                            spanFlag = true;
                                            break;
                                        }
                                    }

                                    if (spanFlag == false)
                                    {
                                        //サービス2やサービス3の結合されるべきもの
                                        continue;
                                    }
                                }

                                SearchItem item = new SearchItem();
                                item.EventInfo = eventInfo;
                                item.ServiceName = info.ServiceInfo.service_name;

                                //予約チェック
                                foreach (ReserveData resInfo in CommonManager.Instance.DB.ReserveList.Values)
                                {
                                    if (resInfo.OriginalNetworkID == eventInfo.original_network_id &&
                                        resInfo.TransportStreamID == eventInfo.transport_stream_id &&
                                        resInfo.ServiceID == eventInfo.service_id &&
                                        resInfo.EventID == eventInfo.event_id)
                                    {
                                        item.ReserveInfo = resInfo;
                                        break;
                                    }
                                }

                                programList.Add(item);
                            }
                        }
                    }
                }
                //listView_event.DataContext = programList;
                listView_event.ItemsSource = programList;

                if (_lastHeaderClicked != null)
                {
                    //string header = ((Binding)_lastHeaderClicked.DisplayMemberBinding).Path.Path;
                    Sort(_lastHeaderClicked, _lastDirection);
                }
                else
                {
                    string header = ((Binding)gridView_event.Columns[1].DisplayMemberBinding).Path.Path;
                    Sort(header, _lastDirection);
                    _lastHeaderClicked = header;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
        private void UpdateEventList()
        {
            try
            {
                ICollectionView dataView = CollectionViewSource.GetDefaultView(listView_event.DataContext);
                if (dataView != null)
                {
                    dataView.SortDescriptions.Clear();
                    dataView.Refresh();
                }
                listView_event.DataContext = null;

                //listView_event.ItemsSource = null;
                programList.Clear();

                Dictionary <UInt64, EpgServiceEventInfo> eventList = null;
                if (setViewInfo.SearchMode == true)
                {
                    eventList = serviceEventList;
                }
                else
                {
                    eventList = CommonManager.Instance.DB.ServiceEventList;
                }

                foreach (ServiceItem info in serviceList)
                {
                    if (info.IsSelected == true)
                    {
                        if (eventList.ContainsKey(info.ID) == true)
                        {
                            foreach (EpgEventInfo eventInfo in eventList[info.ID].eventList)
                            {
                                if (eventInfo.StartTimeFlag == 0)
                                {
                                    //開始未定は除外
                                    continue;
                                }
                                //ジャンル絞り込み
                                if (this.viewCustContentKindList.Count > 0)
                                {
                                    bool find = false;
                                    if (eventInfo.ContentInfo != null)
                                    {
                                        if (eventInfo.ContentInfo.nibbleList.Count > 0)
                                        {
                                            foreach (EpgContentData contentInfo in eventInfo.ContentInfo.nibbleList)
                                            {
                                                UInt16 ID1 = (UInt16)(((UInt16)contentInfo.content_nibble_level_1) << 8 | 0xFF);
                                                UInt16 ID2 = (UInt16)(((UInt16)contentInfo.content_nibble_level_1) << 8 | contentInfo.content_nibble_level_2);
                                                if (this.viewCustContentKindList.ContainsKey(ID1) == true)
                                                {
                                                    find = true;
                                                    break;
                                                }
                                                else if (this.viewCustContentKindList.ContainsKey(ID2) == true)
                                                {
                                                    find = true;
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                    if (find == false)
                                    {
                                        //ジャンル見つからないので除外
                                        continue;
                                    }
                                }
                                //イベントグループのチェック
                                if (eventInfo.EventGroupInfo != null)
                                {
                                    bool spanFlag = false;
                                    foreach (EpgEventData data in eventInfo.EventGroupInfo.eventDataList)
                                    {
                                        if (info.ServiceInfo.ONID == data.original_network_id &&
                                            info.ServiceInfo.TSID == data.transport_stream_id &&
                                            info.ServiceInfo.SID == data.service_id)
                                        {
                                            spanFlag = true;
                                            break;
                                        }
                                    }

                                    if (spanFlag == false)
                                    {
                                        //サービス2やサービス3の結合されるべきもの
                                        continue;
                                    }
                                }

                                SearchItem item = new SearchItem();
                                item.EventInfo   = eventInfo;
                                item.ServiceName = info.ServiceInfo.service_name;

                                //予約チェック
                                foreach (ReserveData resInfo in CommonManager.Instance.DB.ReserveList.Values)
                                {
                                    if (resInfo.OriginalNetworkID == eventInfo.original_network_id &&
                                        resInfo.TransportStreamID == eventInfo.transport_stream_id &&
                                        resInfo.ServiceID == eventInfo.service_id &&
                                        resInfo.EventID == eventInfo.event_id)
                                    {
                                        item.ReserveInfo = resInfo;
                                        break;
                                    }
                                }

                                programList.Add(item);
                            }
                        }
                    }
                }
                //listView_event.DataContext = programList;
                listView_event.ItemsSource = programList;

                if (_lastHeaderClicked != null)
                {
                    //string header = ((Binding)_lastHeaderClicked.DisplayMemberBinding).Path.Path;
                    Sort(_lastHeaderClicked, _lastDirection);
                }
                else
                {
                    string header = ((Binding)gridView_event.Columns[1].DisplayMemberBinding).Path.Path;
                    Sort(header, _lastDirection);
                    _lastHeaderClicked = header;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Beispiel #17
0
        private void UpdateEventList()
        {
            try
            {
                listView_event.ItemsSource = null;
                var           programList     = new List <SearchItem>();
                List <ushort> contentKindList = setViewInfo.ViewContentKindList.ToList();
                contentKindList.Sort();

                DateTime now = DateTime.UtcNow.AddHours(9);
                foreach (ServiceItem info in listBox_service.ItemsSource ?? Enumerable.Empty <object>())
                {
                    if (info.IsSelected == true)
                    {
                        EpgServiceAllEventInfo allInfo;
                        if (serviceEventList.TryGetValue(info.ID, out allInfo))
                        {
                            int eventInfoIndex = -1;
                            foreach (EpgEventInfo eventInfo in Enumerable.Concat(allInfo.eventArcList, allInfo.eventList))
                            {
                                bool past = ++eventInfoIndex < allInfo.eventArcList.Count;
                                if (eventInfo.StartTimeFlag == 0)
                                {
                                    //開始未定は除外
                                    continue;
                                }
                                if (setViewInfo.FilterEnded)
                                {
                                    if (eventInfo.start_time.AddSeconds(eventInfo.DurationFlag == 0 ? 0 : eventInfo.durationSec) < now)
                                    {
                                        continue;
                                    }
                                }
                                //ジャンル絞り込み
                                bool filtered = false;
                                if (contentKindList.Count > 0)
                                {
                                    if (eventInfo.ContentInfo == null || eventInfo.ContentInfo.nibbleList.Count == 0)
                                    {
                                        //ジャンル情報ない
                                        filtered = contentKindList.BinarySearch(0xFFFF) < 0;
                                    }
                                    else
                                    {
                                        filtered = true;
                                        foreach (EpgContentData contentInfo in eventInfo.ContentInfo.nibbleList)
                                        {
                                            int nibble1 = contentInfo.content_nibble_level_1;
                                            int nibble2 = contentInfo.content_nibble_level_2;
                                            if (nibble1 == 0x0E && nibble2 <= 0x01)
                                            {
                                                nibble1 = contentInfo.user_nibble_1 | (0x60 + nibble2 * 16);
                                                nibble2 = contentInfo.user_nibble_2;
                                            }
                                            if (contentKindList.BinarySearch((ushort)(nibble1 << 8 | 0xFF)) >= 0 ||
                                                contentKindList.BinarySearch((ushort)(nibble1 << 8 | nibble2)) >= 0)
                                            {
                                                filtered = false;
                                                break;
                                            }
                                        }
                                    }
                                    if (filtered && setViewInfo.HighlightContentKind == false)
                                    {
                                        //ジャンル見つからないので除外
                                        continue;
                                    }
                                }
                                //イベントグループのチェック
                                if (eventInfo.EventGroupInfo != null)
                                {
                                    bool spanFlag = false;
                                    foreach (EpgEventData data in eventInfo.EventGroupInfo.eventDataList)
                                    {
                                        if (info.ServiceInfo.ONID == data.original_network_id &&
                                            info.ServiceInfo.TSID == data.transport_stream_id &&
                                            info.ServiceInfo.SID == data.service_id)
                                        {
                                            spanFlag = true;
                                            break;
                                        }
                                    }

                                    if (spanFlag == false)
                                    {
                                        //サービス2やサービス3の結合されるべきもの
                                        continue;
                                    }
                                }

                                var item = new SearchItem(eventInfo, past, filtered, false);
                                item.ServiceName = info.ServiceInfo.service_name;
                                programList.Add(item);
                            }
                        }
                    }
                }
                listView_event.ItemsSource = programList;
                RefreshReserve();

                if (_lastHeaderClicked != null)
                {
                    Sort(_lastHeaderClicked, _lastDirection);
                }
                else
                {
                    string header = (string)((GridViewColumnHeader)gridView_event.Columns[1].Header).Tag;
                    Sort(header, _lastDirection);
                    _lastHeaderClicked = header;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Beispiel #18
0
 public static bool CheckJumpTab(SearchItem target, bool switchTab = false)
 {
     return(ViewUtil.MainWindow.epgView.SearchJumpTargetProgram(target, !switchTab));
 }
Beispiel #19
0
        private void SearchPg()
        {
            try
            {
                ICollectionView dataView = CollectionViewSource.GetDefaultView(listView_result.DataContext);
                if (dataView != null)
                {
                    dataView.SortDescriptions.Clear();
                    dataView.Refresh();
                }
                listView_result.DataContext = null;

                resultList.Clear();

                EpgSearchKeyInfo key = new EpgSearchKeyInfo();
                searchKeyView.GetSearchKey(ref key);
                List<EpgSearchKeyInfo> keyList = new List<EpgSearchKeyInfo>();

                keyList.Add(key);
                List<EpgEventInfo> list = new List<EpgEventInfo>();

                cmd.SendSearchPg(keyList, ref list);
                foreach (EpgEventInfo info in list)
                {
                    SearchItem item = new SearchItem();
                    item.EventInfo = info;

                    if (item.EventInfo.start_time.AddSeconds(item.EventInfo.durationSec) > DateTime.Now)
                    {
                        foreach (ReserveData info2 in CommonManager.Instance.DB.ReserveList.Values)
                        {
                            if (info.original_network_id == info2.OriginalNetworkID &&
                                info.transport_stream_id == info2.TransportStreamID &&
                                info.service_id == info2.ServiceID &&
                                info.event_id == info2.EventID)
                            {
                                item.ReserveInfo = info2;
                                break;
                            }
                        }
                        UInt64 serviceKey = CommonManager.Create64Key(info.original_network_id, info.transport_stream_id, info.service_id);
                        if (ChSet5.Instance.ChList.ContainsKey(serviceKey) == true)
                        {
                            item.ServiceName = ChSet5.Instance.ChList[serviceKey].ServiceName;
                        }
                        if (Settings.Instance.FixSearchResult)
                        {
                            item.EventInfo.ShortInfo.text_char = "省略";
                        }

                        resultList.Add(item);
                    }
                }

                listView_result.DataContext = resultList;
                //if (_lastHeaderClicked != null) {
                //    Sort(_lastHeaderClicked, _lastDirection);
                //} else {
                //    string header = ((Binding)gridView_result.Columns[1].DisplayMemberBinding).Path.Path;
                //    Sort(header, _lastDirection);
                //    _lastHeaderClicked = header;
                //}
                if (this.gridViewSorter.isExistSortParams)
                {
                    this.gridViewSorter.SortByMultiHeader(this.resultList);
                }
                else
                {
                    this.gridViewSorter.resetSortParams();
                    this.gridViewSorter.SortByMultiHeader(
                        this.resultList,
                        gridView_result.Columns[1].Header as GridViewColumnHeader);
                }

                searchKeyView.SaveSearchLog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Beispiel #20
0
        public EpgEventInfo GetReserveEventList(ReserveData master, bool isSrv = true)
        {
            if (master == null || master.ReserveID == 0)
            {
                return(null);
            }

            if (reserveEventList == null)
            {
                if (IsEpgLoaded || Settings.Instance.NoReserveEventList == true)
                {
                    reserveEventList = ReserveList.Values.ToDictionary(rs => rs.ReserveID,
                                                                       rs => rs.IsEpgReserve ? MenuUtil.GetPgInfoUid(rs.CurrentPgUID()) : MenuUtil.GetPgInfoLikeThat(rs));
                }
                else
                {
                    reserveEventList      = new Dictionary <uint, EpgEventInfo>();
                    reserveEventListCache = reserveEventListCache ?? new Dictionary <ulong, EpgEventInfo>();

                    //要求はしないが、有効なデータが既に存在していればキーワード予約の追加データを参照する。
                    bool useAppend = epgAutoAddAppendList != null && updateEpgAutoAddAppend == false &&
                                     updateEpgAutoAddAppendReserveInfo == false;

                    //プログラム予約はここで探しても精度低いので諦める
                    var trgList = new List <ReserveData>();
                    foreach (ReserveData data in ReserveList.Values.Where(r => r.IsEpgReserve))
                    {
                        EpgEventInfo info = null;
                        ulong        key  = data.Create64PgKey();
                        if (useAppend == true)
                        {
                            List <EpgAutoAddData> epgAutoList = data.GetEpgAutoAddList();
                            if (epgAutoList.Count != 0)
                            {
                                SearchItem item = epgAutoList[0].GetSearchList()
                                                  .Find(sI => sI.IsReserved == true && sI.ReserveInfo.ReserveID == data.ReserveID);
                                if (item != null)
                                {
                                    info = item.EventInfo;
                                    reserveEventListCache[key] = info;
                                }
                            }
                        }
                        if (info != null || reserveEventListCache.TryGetValue(key, out info))
                        {
                            reserveEventList[data.ReserveID] = info;
                        }
                        else
                        {
                            trgList.Add(data);
                        }
                    }

                    if (isSrv == true && trgList.Any())
                    {
                        var pgIDset = trgList.ToLookup(data => data.Create64PgKey(), data => data.ReserveID);
                        var keys    = pgIDset.Select(lu => lu.Key).ToList();
                        var list    = new List <EpgEventInfo>();
                        try { CommonManager.CreateSrvCtrl().SendGetPgInfoList(keys, ref list); } catch { }

                        foreach (EpgEventInfo info in list)
                        {
                            ulong key = info.Create64PgKey();
                            if (pgIDset.Contains(key) == true)
                            {
                                foreach (uint rID in pgIDset[key])
                                {
                                    reserveEventList[rID] = info;
                                }
                                reserveEventListCache[key] = info;
                            }
                        }
                    }
                }
            }

            EpgEventInfo retv;

            reserveEventList.TryGetValue(master.ReserveID, out retv);
            return(retv);
        }
Beispiel #21
0
 public static new string GetValuePropertyName(string key)
 {
     var obj = new SearchItem();
     if (key == CommonUtil.GetMemberName(() => obj.StartTime))
     {
         return CommonUtil.GetMemberName(() => obj.StartTimeValue);
     }
     else if (key == CommonUtil.GetMemberName(() => obj.ProgramDuration))
     {
         return CommonUtil.GetMemberName(() => obj.ProgramDurationValue);
     }
     else
     {
         return RecSettingItem.GetValuePropertyName(key);
     }
 }