/// <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); if (sender == cm_chg_viewMode2) { setInfo.ViewMode = 1; } else if (sender == cm_chg_viewMode3) { setInfo.ViewMode = 2; } else { setInfo.ViewMode = 0; } ViewSettingClick(this, setInfo); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
/// <summary> /// 設定値の取得 /// </summary> /// <param name="setInfo"></param> public void GetSetting(ref CustomEpgTabInfo info) { info.TabName = textBox_tabName.Text; info.ViewMode = 0; if (radioButton_week.IsChecked == true) { info.ViewMode = 1; } else if (radioButton_list.IsChecked == true) { info.ViewMode = 2; } info.NeedTimeOnlyBasic = (checkBox_noTimeView_rate.IsChecked == true); info.NeedTimeOnlyWeek = (checkBox_noTimeView_week.IsChecked == true); info.StartTimeWeek = comboBox_timeH_week.SelectedIndex; info.SearchMode = (checkBox_searchMode.IsChecked == true); info.SearchServiceFromView = (checkBox_searchServiceFromView.IsChecked == true); info.FilterEnded = (checkBox_filterEnded.IsChecked == true); info.SearchKey = searchKey.Clone(); info.ID = tabInfoID; info.ViewServiceList = listBox_serviceView.Items.OfType <ChSet5Item>().Select(item => item.Key).ToList(); info.ViewContentKindList = listBox_jyanruView.Items.OfType <ContentKindInfo>().Select(item => item.ID).ToList(); }
public void UpdateSetting() { try { SaveViewData(); //表示していた番組表の情報を保存 var item = tabControl.SelectedItem as TabItem; if (item != null) { var view = item.Content as EpgDataViewItem; oldInfo = view.GetViewMode(); oldState = view.GetViewState(); oldID = oldInfo.ID; } //一度全部削除して作り直す。 //保存情報は次回のタブ作成時に復元する。 tabControl.Items.Clear(); UpdateInfo(); } catch (Exception ex) { CommonUtil.DispatcherMsgBoxShow(ex.Message + "\r\n" + ex.StackTrace); } //UpdateInfo()は非表示の時走らない。 //データはここでクリアしてしまうので、現に表示されているもの以外は表示状態はリセットされる。 //ただし、番組表(oldID)の選択そのものは保持する。 oldInfo = null; oldState = null; }
/// <summary> /// 右クリックメニュー 表示設定イベント呼び出し /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cm_viewSet_Click(object sender, RoutedEventArgs e) { if (Settings.Instance.UseCustomEpgView == false) { MessageBox.Show("デフォルト表示では設定を変更することはできません。"); } else { var dlg = new EpgDataViewSettingWindow(); dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual; dlg.SetDefSetting(setViewInfo); if (dlg.ShowDialog() == true) { var setInfo = dlg.GetSetting(); if (setInfo.ViewMode == setViewInfo.ViewMode) { setViewInfo = setInfo; UpdateEpgData(); } else if (ViewModeChangeRequested != null) { ViewModeChangeRequested(this, setInfo, null); } } } }
/// <summary> /// 設定値の取得 /// </summary> /// <param name="setInfo"></param> public void GetSetting(ref CustomEpgTabInfo info) { info.TabName = textBox_tabName.Text; info.ViewMode = 0; if (radioButton_week.IsChecked == true) { info.ViewMode = 1; } else if (radioButton_list.IsChecked == true) { info.ViewMode = 2; } info.NeedTimeOnlyBasic = (checkBox_noTimeView_rate.IsChecked == true); info.NeedTimeOnlyWeek = (checkBox_noTimeView_week.IsChecked == true); info.StartTimeWeek = comboBox_timeH_week.SelectedIndex; info.SearchMode = (checkBox_searchMode.IsChecked == true); info.SearchServiceFromView = (checkBox_searchServiceFromView.IsChecked == true); info.FilterEnded = (checkBox_filterEnded.IsChecked == true); info.SearchKey = searchKey.Clone(); info.ID = tabInfoID; info.ViewServiceList = listBox_serviceView.Items.OfType<ChSet5Item>().Select(item => item.Key).ToList(); info.ViewContentKindList = listBox_jyanruView.Items.OfType<ContentKindInfo>().Select(item => item.ID).ToList(); }
public void CopyTo(ref CustomEpgTabInfo dest) { dest.TabName = TabName; dest.ViewMode = ViewMode; dest.NeedTimeOnlyBasic = NeedTimeOnlyBasic; dest.NeedTimeOnlyWeek = NeedTimeOnlyWeek; dest.StartTimeWeek = StartTimeWeek; dest.ViewServiceList = ViewServiceList.ToList(); dest.ViewContentKindList = ViewContentKindList.ToList(); dest.SearchMode = SearchMode; dest.SearchKey.aimaiFlag = SearchKey.aimaiFlag; dest.SearchKey.andKey = SearchKey.andKey; dest.SearchKey.audioList = SearchKey.audioList.ToList(); dest.SearchKey.contentList = SearchKey.contentList.ToList(); dest.SearchKey.dateList = SearchKey.dateList.ToList(); dest.SearchKey.freeCAFlag = SearchKey.freeCAFlag; dest.SearchKey.notContetFlag = SearchKey.notContetFlag; dest.SearchKey.notDateFlag = SearchKey.notDateFlag; dest.SearchKey.notKey = SearchKey.notKey; dest.SearchKey.regExpFlag = SearchKey.regExpFlag; dest.SearchKey.serviceList = SearchKey.serviceList.ToList(); dest.SearchKey.titleOnlyFlag = SearchKey.titleOnlyFlag; dest.SearchKey.videoList = SearchKey.videoList.ToList(); }
/// <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 (ViewModeChangeRequested != null) { MenuItem item = sender as MenuItem; CustomEpgTabInfo setInfo = setViewInfo.DeepClone(); if (sender == cm_chg_viewMode2) { setInfo.ViewMode = 1; } else { setInfo.ViewMode = 0; } ViewModeChangeRequested(this, setInfo, null); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public EpgDataViewSetting() { InitializeComponent(); DataContext = new CustomEpgTabInfo(); try { comboBox_timeH_week.ItemsSource = Enumerable.Range(0, 24); info.StartTimeWeek = 4; servieceList = ChSet5.ChList.Values.Select(item => new ServiceViewItem(item)).ToDictionary(item => item.Key, item => item); var selectedList = ChSet5.ChListSelected.Select(item => servieceList[item.Key]).ToList(); listBox_serviceDttv.ItemsSource = selectedList.Where(item => item.ServiceInfo.IsDttv == true); listBox_serviceBS.ItemsSource = selectedList.Where(item => item.ServiceInfo.IsBS == true); listBox_serviceCS.ItemsSource = selectedList.Where(item => item.ServiceInfo.IsCS == true); listBox_serviceSP.ItemsSource = selectedList.Where(item => item.ServiceInfo.IsSPHD == true); listBox_serviceOther.ItemsSource = selectedList.Where(item => item.ServiceInfo.IsOther == true); listBox_serviceAll.ItemsSource = selectedList; foreach (TabItem tab in tab_ServiceList.Items) { tab.Visibility = ((ListView)tab.Content).Items.Count == 0 ? Visibility.Collapsed : Visibility.Visible; } listBox_jyanru.ItemsSource = CommonManager.ContentKindList; viewModeRadioBtns = new RadioBtnSelect(PanelDisplaySet); listBox_Button_Set(); listBox_serviceView_ContextMenu_Set(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void button_searchKey_Click(object sender, RoutedEventArgs e) { CustomEpgTabInfo tabInfo = this.GetSetting(); var dlg = new SetSearchPresetWindow(this); dlg.SetSettingMode("検索条件"); dlg.DataView.SetSearchKey(tabInfo.GetSearchKeyReloadEpg()); if (dlg.ShowDialog() == true) { searchKey = dlg.DataView.GetSearchKey(); //サービスリストは表示順を保持する var oldList = listBox_serviceView.Items.OfType <object>().ToList(); var newList = searchKey.serviceList.Where(sv => servieceList.ContainsKey((ulong)sv) == true).Select(sv => servieceList[(ulong)sv]).ToList(); listBox_serviceView.UnselectAll(); listBox_serviceView.Items.RemoveItems(oldList.Where(sv => newList.Contains(sv) == false)); listBox_serviceView.Items.AddItems(newList.Where(sv => oldList.Contains(sv) == false)); //ジャンルリストの同期はオプションによる if (tabInfo.SearchGenreNoSyncView == false) { var items = searchKey.contentList.Select(data => CommonManager.ContentKindInfoForDisplay(data)); listBox_jyanruView.Items.Clear(); listBox_jyanruView.Items.AddItems(items); checkBox_notContent.IsChecked = searchKey.notContetFlag != 0; } } }
/// <summary>EPGデータの表示モードを設定する</summary> /// <param name="setInfo">[IN]表示モードの設定値</param> public void SetViewMode(CustomEpgTabInfo setInfo) { //表示モード一緒で、絞り込み内容変化のみ。 if (viewCtrl != null) { CustomEpgTabInfo viewInfo = viewCtrl.GetViewMode(); if (viewInfo != null && viewInfo.ViewMode == setInfo.ViewMode) { viewInfo = setInfo.Clone(); viewCtrl.SetViewMode(viewInfo); return; } } //切り替える場合 switch (setInfo.ViewMode) { case 1://1週間表示 viewCtrl = new EpgWeekMainView(); break; case 2://リスト表示 viewCtrl = new EpgListMainView(); break; default://標準ラテ欄表示 viewCtrl = new EpgMainView(); break; } viewCtrl.ViewSettingClick += new ViewSettingClickHandler(item_ViewSettingClick); viewCtrl.SetViewMode(setInfo); grid_main.Children.Clear(); grid_main.Children.Add(viewCtrl as UIElement); }
public void CopyTo(ref CustomEpgTabInfo dest) { dest.TabName = TabName; dest.ViewMode = ViewMode; dest.NeedTimeOnlyBasic = NeedTimeOnlyBasic; dest.NeedTimeOnlyWeek = NeedTimeOnlyWeek; dest.StartTimeWeek = StartTimeWeek; dest.ViewServiceList = ViewServiceList.ToList(); dest.ViewContentKindList = ViewContentKindList.ToList(); dest.SearchMode = SearchMode; dest.FilterEnded = FilterEnded; dest.SearchKey.aimaiFlag = SearchKey.aimaiFlag; dest.SearchKey.andKey = SearchKey.andKey; dest.SearchKey.audioList = SearchKey.audioList.ToList(); dest.SearchKey.contentList = SearchKey.contentList.ToList(); dest.SearchKey.dateList = SearchKey.dateList.ToList(); dest.SearchKey.freeCAFlag = SearchKey.freeCAFlag; dest.SearchKey.notContetFlag = SearchKey.notContetFlag; dest.SearchKey.notDateFlag = SearchKey.notDateFlag; dest.SearchKey.notKey = SearchKey.notKey; dest.SearchKey.regExpFlag = SearchKey.regExpFlag; dest.SearchKey.serviceList = SearchKey.serviceList.ToList(); dest.SearchKey.titleOnlyFlag = SearchKey.titleOnlyFlag; dest.SearchKey.videoList = SearchKey.videoList.ToList(); }
public EpgDataViewSettingWindow(CustomEpgTabInfo setInfo = null) { InitializeComponent(); button_ok.Click += new RoutedEventHandler((sender, e) => DialogResult = true); button_cancel.Click += new RoutedEventHandler((sender, e) => DialogResult = false); checkBox_tryEpgSetting.Visibility = Visibility.Hidden; SetDefSetting(setInfo ?? new CustomEpgTabInfo()); }
public EpgListMainView(CustomEpgTabInfo setInfo, DateTime _baseTime) { InitializeComponent(); setViewInfo = setInfo; baseTime = _baseTime; listView_event.AlternationCount = Settings.Instance.ResAlternationCount; }
/// <summary> /// 現在のEPGデータ表示モードの設定を取得する /// </summary> /// <param name="setInfo">[OUT]表示モードの設定値</param> /// <returns></returns> public bool GetViewMode(ref CustomEpgTabInfo setInfo) { if (viewInfo == null) { return(false); } viewInfo.CopyTo(ref setInfo); return(true); }
/// <summary> /// 現在のEPGデータ表示モードの設定を取得する /// </summary> /// <param name="setInfo">[OUT]表示モードの設定値</param> /// <returns></returns> public bool GetViewMode(ref CustomEpgTabInfo setInfo) { if (viewInfo == null) { return false; } viewInfo.CopyTo(ref setInfo); return true; }
/// <summary> /// 設定値の取得 /// </summary> public CustomEpgTabInfo GetSetting() { var info = new CustomEpgTabInfo(); info.TabName = textBox_tabName.Text; info.ViewMode = radioButton_week.IsChecked == true ? 1 : radioButton_list.IsChecked == true ? 2 : 0; info.EpgSettingIndex = radioButton_designSub1.IsChecked == true ? 1 : radioButton_designSub2.IsChecked == true ? 2 : 0; if (checkBox_noTimeView_rate.IsChecked == true) { info.NeedTimeOnlyBasic = true; } else { info.NeedTimeOnlyBasic = false; } if (checkBox_noTimeView_week.IsChecked == true) { info.NeedTimeOnlyWeek = true; } else { info.NeedTimeOnlyWeek = false; } info.StartTimeWeek = comboBox_timeH_week.SelectedIndex; info.HighlightContentKind = checkBox_highlightContentKind.IsChecked == true; info.SearchMode = checkBox_searchMode.IsChecked == true; if (checkBox_filterEnded.IsChecked == true) { info.FilterEnded = true; } else { info.FilterEnded = false; } info.SearchKey = searchKey; foreach (Tuple <string, ulong> item in listBox_serviceView.Items) { info.ViewServiceList.Add(item.Item2); } foreach (ContentKindInfo item in listBox_jyanruView.Items) { info.ViewContentKindList.Add(item.ID); } return(info); }
/// <summary> /// デフォルト表示の設定値 /// </summary> /// <param name="setInfo"></param> public void SetSetting(CustomEpgTabInfo setInfo) { DataContext = setInfo.DeepClone(); searchKey = setInfo.SearchKey.DeepClone(); textBox_tabName.Text = setInfo.TabName; checkBox_isVisible.IsChecked = setInfo.IsVisible; viewModeRadioBtns.Value = setInfo.ViewMode; listBox_serviceView.Items.AddItems(setInfo.ViewServiceList .Where(id => servieceList.ContainsKey(id) == true).Select(id => servieceList[id])); listBox_jyanruView.Items.AddItems(setInfo.ViewContentList.Select(data => CommonManager.ContentKindInfoForDisplay(data))); }
//表示切り替えに対する処理 public void UpdateContent(CustomEpgTabInfo setInfo, int mode) { //表示モード一緒で、絞り込み内容などの変化のみ。 if (view != null && setInfo != null && Info.ViewMode == setInfo.ViewMode) { Info = setInfo; UpdateInfo(); } else { CreateContent(setInfo, null, mode < 0 ? null : (int?)mode); } }
private void EpgTabMove() { if (dragUid == null) { return; } Point pt = Mouse.GetPosition(tabControl); pt.X = Math.Min(pt.X, tabControl.DesiredSize.Width - 5);//右範囲外の処理。 var trg = tabControl.GetPlacementItem(pt) as EpgTabItem; if (trg == null || trg.Uid == dragUid) { return; } EpgTabItem tab = Tabs.FirstOrDefault(t => t.Uid == dragUid); int pos = tabControl.Items.IndexOf(trg); if (tab == null || pos < 0) { return; } OnMoveTab = true; tabControl.Items.Remove(tab); tabControl.Items.Insert(pos, tab); tabControl.SelectedItem = tab; OnMoveTab = false; //設定更新 Func <List <CustomEpgTabInfo>, bool> updatesList = (list) => { CustomEpgTabInfo info = list.Find(ti => ti.ID == tab.Info.ID); int idx = list.FindIndex(ti => ti.ID == trg.Info.ID); if (info != null && idx >= 0) { list.Remove(info); list.Insert(idx, info); } return(info != null && idx >= 0); }; if (updatesList(tabInfo) && Settings.Instance.UseCustomEpgView && updatesList(Settings.Instance.CustomEpgTabList)) { SettingWindow.UpdatesInfo("番組表関連の変更"); } }
protected static void CopyData(CustomEpgTabInfo src, CustomEpgTabInfo dest) { dest.TabName = src.TabName; dest.ViewMode = src.ViewMode; dest.NeedTimeOnlyBasic = src.NeedTimeOnlyBasic; dest.NeedTimeOnlyWeek = src.NeedTimeOnlyWeek; dest.StartTimeWeek = src.StartTimeWeek; dest.ViewServiceList = src.ViewServiceList.ToList(); dest.ViewContentKindList = src.ViewContentKindList.ToList(); dest.SearchMode = src.SearchMode; dest.SearchServiceFromView = src.SearchServiceFromView; dest.FilterEnded = src.FilterEnded; dest.SearchKey = src.SearchKey.Clone(); dest.ID = src.ID; }
private void item_ViewModeChangeRequested(object sender, CustomEpgTabInfo info, DateTime baseTime, object scrollToTarget) { foreach (TabItem tabItem in tabControl.Items) { if (tabItem.Content == sender) { //情報クリア if (tabItem.Content is EpgListMainView) { ((EpgListMainView)tabItem.Content).ClearInfo(); } else if (tabItem.Content is EpgMainView) { ((EpgMainView)tabItem.Content).ClearInfo(); } else if (tabItem.Content is EpgWeekMainView) { ((EpgWeekMainView)tabItem.Content).ClearInfo(); } if (info.ViewMode == 1) { //1週間表示 var epgView = new EpgWeekMainView(info, baseTime); epgView.ViewModeChangeRequested += item_ViewModeChangeRequested; tabItem.Content = epgView; epgView.ScrollTo(scrollToTarget, false); } else if (info.ViewMode == 2) { //リスト表示 var epgView = new EpgListMainView(info, baseTime); epgView.ViewModeChangeRequested += item_ViewModeChangeRequested; tabItem.Content = epgView; } else { //標準ラテ欄表示 var epgView = new EpgMainView(info, baseTime); epgView.ViewModeChangeRequested += item_ViewModeChangeRequested; tabItem.Content = epgView; epgView.ScrollTo(scrollToTarget, false); } break; } } }
/// <summary> /// デフォルト表示の設定値 /// </summary> /// <param name="setInfo"></param> public void SetSetting(CustomEpgTabInfo setInfo) { tabInfoID = setInfo.ID; searchKey = setInfo.SearchKey.Clone(); textBox_tabName.Text = setInfo.TabName; radioButton_rate.IsChecked = false; radioButton_week.IsChecked = false; radioButton_list.IsChecked = false; switch (setInfo.ViewMode) { case 1: radioButton_week.IsChecked = true; break; case 2: radioButton_list.IsChecked = true; break; default: radioButton_rate.IsChecked = true; break; } checkBox_noTimeView_rate.IsChecked = setInfo.NeedTimeOnlyBasic; checkBox_noTimeView_week.IsChecked = setInfo.NeedTimeOnlyWeek; comboBox_timeH_week.SelectedIndex = setInfo.StartTimeWeek; checkBox_searchMode.IsChecked = setInfo.SearchMode; checkBox_searchServiceFromView.IsChecked = setInfo.SearchServiceFromView; checkBox_filterEnded.IsChecked = (setInfo.FilterEnded == true); foreach (UInt64 id in setInfo.ViewServiceList) { if (ChSet5.ChList.ContainsKey(id) == true) { listBox_serviceView.Items.Add(ChSet5.ChList[id]); } } foreach (UInt16 id in setInfo.ViewContentKindList) { if (CommonManager.Instance.ContentKindDictionary.ContainsKey(id) == true) { listBox_jyanruView.Items.Add(CommonManager.Instance.ContentKindDictionary[id]); } } }
void epgView_ViewSettingClick(object sender, object param) { try { if (Settings.Instance.UseCustomEpgView == false) { MessageBox.Show("デフォルト表示では設定を変更することはできません。"); } else { if (sender.GetType() == typeof(EpgDataViewItem)) { if (param == null) { EpgDataViewItem item = sender as EpgDataViewItem; CustomEpgTabInfo setInfo = new CustomEpgTabInfo(); item.GetViewMode(ref setInfo); EpgDataViewSettingWindow dlg = new EpgDataViewSettingWindow(); PresentationSource topWindow = PresentationSource.FromVisual(this); if (topWindow != null) { dlg.Owner = (Window)topWindow.RootVisual; } dlg.SetDefSetting(setInfo); if (dlg.ShowDialog() == true) { dlg.GetSetting(ref setInfo); item.SetViewMode(setInfo); } } else { EpgDataViewItem item = sender as EpgDataViewItem; CustomEpgTabInfo setInfo = param as CustomEpgTabInfo; item.SetViewMode(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_chg_viewMode_Click(object sender, RoutedEventArgs e) { { if (ViewModeChangeRequested != null) { CustomEpgTabInfo setInfo = setViewInfo.DeepClone(); if (sender == cm_chg_viewMode2) { setInfo.ViewMode = 1; } else { setInfo.ViewMode = 0; } ViewModeChangeRequested(this, setInfo, baseTime, null); } } }
//表示切り替えに対する処理 public void ChangeContent(CustomEpgTabInfo setInfo = null, int mode = -1) { if (setInfo != null) { Info = setInfo; } if (mode >= 0) { Info.ViewMode = mode; } //表示中のものはデータを保存する if (view != null) { view.SaveViewData(); } SetContent(setInfo != null); }
/// <summary> /// 右クリックメニュー 表示設定イベント呼び出し /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cm_viewSet_Click(object sender, RoutedEventArgs e) { var dlg = new EpgDataViewSettingWindow(); dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual; dlg.SetDefSetting(setViewInfo); if (dlg.ShowDialog() == true) { var setInfo = dlg.GetSetting(); if (setInfo.ViewMode == setViewInfo.ViewMode) { setViewInfo = setInfo; UpdateEpgData(); } else if (ViewModeChangeRequested != null) { ViewModeChangeRequested(this, setInfo, baseTime, null); } } }
/// <summary> /// デフォルト表示の設定値 /// </summary> /// <param name="setInfo"></param> public void SetSetting(CustomEpgTabInfo setInfo) { info = setInfo.DeepClone(); searchKey = setInfo.SearchKey.DeepClone(); textBox_tabName.Text = setInfo.TabName; checkBox_isVisible.IsChecked = setInfo.IsVisible; viewModeRadioBtns.Value = setInfo.ViewMode; checkBox_noTimeView_rate.IsChecked = setInfo.NeedTimeOnlyBasic; checkBox_noTimeView_week.IsChecked = setInfo.NeedTimeOnlyWeek; comboBox_timeH_week.SelectedIndex = setInfo.StartTimeWeek; checkBox_searchMode.IsChecked = setInfo.SearchMode; checkBox_searchServiceFromView.IsChecked = setInfo.SearchGenreNoSyncView; checkBox_filterEnded.IsChecked = (setInfo.FilterEnded == true); listBox_serviceView.Items.AddItems(setInfo.ViewServiceList .Where(id => servieceList.ContainsKey(id) == true).Select(id => servieceList[id])); listBox_jyanruView.Items.AddItems(setInfo.ViewContentList.Select(data => CommonManager.ContentKindInfoForDisplay(data))); checkBox_notContent.IsChecked = setInfo.ViewNotContentFlag; }
public EpgTabItem(CustomEpgTabInfo setInfo, string selectID = null, EpgViewState state = null) { //この番組表の表示エリアを登録 grid_tab.Children.Add(grid); //番組情報を登録 Info = setInfo; if (state != null) { Info.ViewMode = state.viewMode; } if (state != null) { vStates[state.viewMode] = state; } if (base.Uid == selectID) { base.IsSelected = true; } }
private void item_ViewSettingClick(object sender, object param) { try { if (param == null) { var dlg = new EpgDataViewSettingWindow(); dlg.Owner = CommonUtil.GetTopWindow(this); dlg.SetDefSetting(this.GetViewMode()); dlg.SetTrySetModeEnable(); if (Settings.Instance.UseCustomEpgView == false) { dlg.SetTrySetModeOnly(); } if (dlg.ShowDialog() == true) { var setInfo = new CustomEpgTabInfo();; dlg.GetSetting(ref setInfo); if (Settings.Instance.UseCustomEpgView == true && Settings.Instance.TryEpgSetting == false) { if (setInfo.ID >= 0 && setInfo.ID <= Settings.Instance.CustomEpgTabList.Count) { Settings.Instance.CustomEpgTabList[setInfo.ID] = setInfo; Settings.SaveToXmlFile(); } } this.SetViewMode(setInfo); viewCtrl.UpdateInfo(); } } else { CustomEpgTabInfo setInfo = param as CustomEpgTabInfo; this.SetViewMode(setInfo); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
/// <summary>EPGデータの表示モードを設定する</summary> /// <param name="setInfo">[IN]表示モードの設定値</param> public void SetViewMode(CustomEpgTabInfo setInfo, object state = null) { //表示モード一緒で、絞り込み内容変化のみ。 if (viewCtrl != null) { CustomEpgTabInfo viewInfo = viewCtrl.GetViewMode(); if (viewInfo != null && viewInfo.ViewMode == setInfo.ViewMode) { viewInfo = setInfo.Clone(); viewCtrl.SetViewMode(viewInfo); return; } } //切り替える場合 SaveViewData(); switch (setInfo.ViewMode) { case 1: //1週間表示 viewCtrl = new EpgWeekMainView(); break; case 2: //リスト表示 viewCtrl = new EpgListMainView(); break; default: //標準ラテ欄表示 viewCtrl = new EpgMainView(); break; } viewCtrl.ViewSettingClick += new ViewSettingClickHandler(item_ViewSettingClick); viewCtrl.SetViewMode(setInfo); if (state != null) { SetViewState(state); } grid_main.Children.Clear(); grid_main.Children.Add(viewCtrl as UIElement); }
/// <summary>デフォルト表示の設定値</summary> public void SetSetting(CustomEpgTabInfo setInfo, List <EpgSetting> setList = null) { DataContext = setInfo.DeepClone(); searchKey = setInfo.SearchKey.DeepClone(); textBox_tabName.Text = setInfo.TabName; checkBox_isVisible.IsChecked = setInfo.IsVisible; SetRecSettingCmbo(setInfo.RecSetting); setList = setList ?? Settings.Instance.EpgSettingList; cmb_design.SelectedValuePath = CommonUtil.NameOf(() => setList[0].ID); cmb_design.DisplayMemberPath = CommonUtil.NameOf(() => setList[0].Name); cmb_design.ItemsSource = setList; cmb_design.SelectedIndex = setList.FindIndex(set => set.ID == setInfo.EpgSettingID); if (cmb_design.SelectedIndex < 0) { cmb_design.SelectedIndex = 0; } listBox_serviceView.Items.AddItems(setInfo.ViewServiceList.Select(id => new ServiceViewItem(id))); listBox_jyanruView.Items.AddItems(setInfo.ViewContentList.Select(data => CommonManager.ContentKindInfoForDisplay(data))); }
public void SetViewMode(CustomEpgTabInfo setInfo) { ClearInfo(); setViewInfo = setInfo; this.viewCustServiceList = setInfo.ViewServiceList; this.viewCustContentKindList.Clear(); if (setInfo.ViewContentKindList != null) { foreach (UInt16 val in setInfo.ViewContentKindList) { this.viewCustContentKindList.Add(val, val); } } if (ReloadEpgData() == true) { updateEpgData = false; if (ReloadReserveData() == true) { updateReserveData = false; } } }
public EpgTabItem(CustomEpgTabInfo setInfo, EpgDataView epgview, string selectID = null, EpgViewState state = null) { //この番組表の表示エリアを登録 epgView = new EpgDataView.EpgDataViewInfo(epgview); epgView.grid.Children.Add(grid); viewData.ViewSettingClick += epgView.viewSettingClick; //番組情報を登録 Info = setInfo; if (state != null) { Info.ViewMode = state.viewMode; } if (state != null) { vStates[state.viewMode] = state; } if (base.Uid == selectID) { IsSelected = true; } }
/// <summary> /// タブ生成 /// </summary> private bool CreateTabItem() { try { if (Settings.Instance.UseCustomEpgView == false) { if (CommonManager.Instance.NWMode == true) { if (CommonManager.Instance.NW.IsConnected == false) { return(false); } } ErrCode err = CommonManager.Instance.DB.ReloadEpgData(); if (err == ErrCode.CMD_ERR_CONNECT) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show("サーバー または EpgTimerSrv に接続できませんでした。"); }), null); return(false); } if (err == ErrCode.CMD_ERR_BUSY) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show("EPGデータの読み込みを行える状態ではありません。\r\n(EPGデータ読み込み中。など)"); }), null); return(false); } if (err == ErrCode.CMD_ERR_TIMEOUT) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show("EpgTimerSrvとの接続にタイムアウトしました。"); }), null); return(false); } if (err != ErrCode.CMD_SUCCESS) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show("EPGデータの取得でエラーが発生しました。EPGデータが読み込まれていない可能性があります。"); }), null); return(false); } CommonManager.Instance.DB.ReloadReserveInfo(); bool findTere = false; bool findBS = false; bool findCS = false; bool findOther = false; CustomEpgTabInfo setInfoBS = new CustomEpgTabInfo(); setInfoBS.ViewMode = 0; setInfoBS.TabName = "BS"; setInfoBS.NeedTimeOnlyBasic = false; CustomEpgTabInfo setInfoCS = new CustomEpgTabInfo(); setInfoCS.ViewMode = 0; setInfoCS.TabName = "CS"; setInfoCS.NeedTimeOnlyBasic = false; CustomEpgTabInfo setInfoTere = new CustomEpgTabInfo(); setInfoTere.ViewMode = 0; setInfoTere.TabName = "地デジ"; setInfoTere.NeedTimeOnlyBasic = false; CustomEpgTabInfo setInfoOther = new CustomEpgTabInfo(); setInfoOther.ViewMode = 0; setInfoOther.TabName = "その他"; setInfoOther.NeedTimeOnlyBasic = false; //デフォルト表示 foreach (EpgServiceEventInfo info in CommonManager.Instance.DB.ServiceEventList.Values) { if (info.serviceInfo.ONID == 0x0004) { findBS = true; UInt64 id = CommonManager.Create64Key(info.serviceInfo.ONID, info.serviceInfo.TSID, info.serviceInfo.SID); setInfoBS.ViewServiceList.Add(id); } else if (info.serviceInfo.ONID == 0x0006 || info.serviceInfo.ONID == 0x0007) { findCS = true; UInt64 id = CommonManager.Create64Key(info.serviceInfo.ONID, info.serviceInfo.TSID, info.serviceInfo.SID); setInfoCS.ViewServiceList.Add(id); } else if (0x7880 <= info.serviceInfo.ONID && info.serviceInfo.ONID <= 0x7FE8) { findTere = true; UInt64 id = CommonManager.Create64Key(info.serviceInfo.ONID, info.serviceInfo.TSID, info.serviceInfo.SID); setInfoTere.ViewServiceList.Add(id); } else { findOther = true; UInt64 id = CommonManager.Create64Key(info.serviceInfo.ONID, info.serviceInfo.TSID, info.serviceInfo.SID); setInfoOther.ViewServiceList.Add(id); } } if (findBS == true) { EpgDataViewItem epgView = new EpgDataViewItem(); epgView.SetViewMode(setInfoBS); epgView.ViewSettingClick += new ViewSettingClickHandler(epgView_ViewSettingClick); TabItem tabItem = new TabItem(); tabItem.Header = setInfoBS.TabName; tabItem.Content = epgView; tabControl.Items.Add(tabItem); } if (findCS == true) { EpgDataViewItem epgView = new EpgDataViewItem(); epgView.SetViewMode(setInfoCS); epgView.ViewSettingClick += new ViewSettingClickHandler(epgView_ViewSettingClick); TabItem tabItem = new TabItem(); tabItem.Header = setInfoCS.TabName; tabItem.Content = epgView; tabControl.Items.Add(tabItem); } if (findTere == true) { EpgDataViewItem epgView = new EpgDataViewItem(); epgView.SetViewMode(setInfoTere); epgView.ViewSettingClick += new ViewSettingClickHandler(epgView_ViewSettingClick); TabItem tabItem = new TabItem(); tabItem.Header = setInfoTere.TabName; tabItem.Content = epgView; tabControl.Items.Add(tabItem); } if (findOther == true) { EpgDataViewItem epgView = new EpgDataViewItem(); epgView.SetViewMode(setInfoOther); epgView.ViewSettingClick += new ViewSettingClickHandler(epgView_ViewSettingClick); TabItem tabItem = new TabItem(); tabItem.Header = setInfoOther.TabName; tabItem.Content = epgView; tabControl.Items.Add(tabItem); } if (tabControl.Items.Count > 0) { tabControl.SelectedIndex = 0; } } else { //カスタム表示 foreach (CustomEpgTabInfo info in Settings.Instance.CustomEpgTabList) { EpgDataViewItem epgView = new EpgDataViewItem(); epgView.SetViewMode(info); epgView.ViewSettingClick += new ViewSettingClickHandler(epgView_ViewSettingClick); TabItem tabItem = new TabItem(); tabItem.Header = info.TabName; tabItem.Content = epgView; tabControl.Items.Add(tabItem); } if (tabControl.Items.Count > 0) { tabControl.SelectedIndex = 0; } } } catch (Exception ex) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }), null); } return(true); }
private void button1_Click(object sender, RoutedEventArgs e) { CustomEpgTabInfo setInfo = new CustomEpgTabInfo(); setViewInfo.CopyTo(ref setInfo); setInfo.ViewMode = 0; ViewSettingClick(this, setInfo); }
/// <summary> /// EPGデータの表示モードを設定する /// </summary> /// <param name="setInfo">[IN]表示モードの設定値</param> public void SetViewMode(CustomEpgTabInfo setInfo) { if (viewInfo != null && viewCtrl != null) { if (viewInfo.ViewMode == setInfo.ViewMode) { //表示モード一緒で、絞り込み内容変化 if (viewCtrl.GetType() == typeof(EpgListMainView)) { EpgListMainView item = viewCtrl as EpgListMainView; item.SetViewMode(setInfo); } else if (viewCtrl.GetType() == typeof(EpgMainView)) { EpgMainView item = viewCtrl as EpgMainView; item.SetViewMode(setInfo); } else if (viewCtrl.GetType() == typeof(EpgWeekMainView)) { EpgWeekMainView item = viewCtrl as EpgWeekMainView; item.SetViewMode(setInfo); } viewInfo = setInfo; return; } } viewInfo = setInfo; //情報クリア if (viewCtrl != null) { if (viewCtrl.GetType() == typeof(EpgListMainView)) { EpgListMainView item = viewCtrl as EpgListMainView; item.ClearInfo(); } else if (viewCtrl.GetType() == typeof(EpgMainView)) { EpgMainView item = viewCtrl as EpgMainView; item.ClearInfo(); } else if (viewCtrl.GetType() == typeof(EpgWeekMainView)) { EpgWeekMainView item = viewCtrl as EpgWeekMainView; item.ClearInfo(); } } grid_main.Children.Clear(); viewCtrl = null; switch (setInfo.ViewMode) { case 1: //1週間表示 { EpgWeekMainView item = new EpgWeekMainView(); item.ViewSettingClick += new ViewSettingClickHandler(item_ViewSettingClick); item.SetViewMode(setInfo); grid_main.Children.Add(item); viewCtrl = item; } break; case 2: //リスト表示 { EpgListMainView item = new EpgListMainView(); item.ViewSettingClick += new ViewSettingClickHandler(item_ViewSettingClick); item.SetViewMode(setInfo); grid_main.Children.Add(item); viewCtrl = item; } break; default: //標準ラテ欄表示 { EpgMainView item = new EpgMainView(); item.ViewSettingClick += new ViewSettingClickHandler(item_ViewSettingClick); item.SetViewMode(setInfo); grid_main.Children.Add(item); viewCtrl = item; } break; } }
/// <summary> /// 設定値の取得 /// </summary> /// <param name="setInfo"></param> public void GetSetting(ref CustomEpgTabInfo info) { info.TabName = textBox_tabName.Text; if (radioButton_rate.IsChecked == true) { info.ViewMode = 0; } else if (radioButton_week.IsChecked == true) { info.ViewMode = 1; } else if (radioButton_list.IsChecked == true) { info.ViewMode = 2; } else { info.ViewMode = 0; } if (checkBox_noTimeView_rate.IsChecked == true) { info.NeedTimeOnlyBasic = true; } else { info.NeedTimeOnlyBasic = false; } if (checkBox_noTimeView_week.IsChecked == true) { info.NeedTimeOnlyWeek = true; } else { info.NeedTimeOnlyWeek = false; } info.StartTimeWeek = comboBox_timeH_week.SelectedIndex; if (checkBox_searchMode.IsChecked == true) { info.SearchMode = true; } else { info.SearchMode = false; } info.SearchKey.aimaiFlag = searchKey.aimaiFlag; info.SearchKey.andKey = searchKey.andKey; info.SearchKey.audioList = searchKey.audioList.ToList(); info.SearchKey.contentList = searchKey.contentList.ToList(); info.SearchKey.dateList = searchKey.dateList.ToList(); info.SearchKey.freeCAFlag = searchKey.freeCAFlag; info.SearchKey.notContetFlag = searchKey.notContetFlag; info.SearchKey.notDateFlag = searchKey.notDateFlag; info.SearchKey.notKey = searchKey.notKey; info.SearchKey.regExpFlag = searchKey.regExpFlag; info.SearchKey.serviceList = searchKey.serviceList.ToList(); info.SearchKey.titleOnlyFlag = searchKey.titleOnlyFlag; info.SearchKey.videoList = searchKey.videoList.ToList(); info.ViewServiceList.Clear(); foreach (ChSet5Item item in listBox_serviceView.Items) { info.ViewServiceList.Add(item.Key); } info.ViewContentKindList.Clear(); foreach (ContentKindInfo item in listBox_jyanruView.Items) { info.ViewContentKindList.Add(item.ID); } }
/// <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="setInfo"></param> public void SetDefSetting(CustomEpgTabInfo setInfo) { epgDataViewSetting.SetSetting(setInfo); }
/// <summary> /// 設定値の取得 /// </summary> /// <param name="setInfo"></param> public void GetSetting(ref CustomEpgTabInfo info) { epgDataViewSetting.GetSetting(ref info); }
public override void SetViewMode(CustomEpgTabInfo setInfo) { this.viewCustNeedTimeOnly = setInfo.NeedTimeOnlyBasic; base.SetViewMode(setInfo); }
/// <summary> /// デフォルト表示の設定値 /// </summary> /// <param name="setInfo"></param> public void SetSetting(CustomEpgTabInfo setInfo) { searchKey.aimaiFlag = setInfo.SearchKey.aimaiFlag; searchKey.andKey = setInfo.SearchKey.andKey; searchKey.audioList = setInfo.SearchKey.audioList.ToList(); searchKey.contentList = setInfo.SearchKey.contentList.ToList(); searchKey.dateList = setInfo.SearchKey.dateList.ToList(); searchKey.freeCAFlag = setInfo.SearchKey.freeCAFlag; searchKey.notContetFlag = setInfo.SearchKey.notContetFlag; searchKey.notDateFlag = setInfo.SearchKey.notDateFlag; searchKey.notKey = setInfo.SearchKey.notKey; searchKey.regExpFlag = setInfo.SearchKey.regExpFlag; searchKey.serviceList = setInfo.SearchKey.serviceList.ToList(); searchKey.titleOnlyFlag = setInfo.SearchKey.titleOnlyFlag; searchKey.videoList = setInfo.SearchKey.videoList.ToList(); textBox_tabName.Text = setInfo.TabName; if (setInfo.ViewMode == 1) { radioButton_rate.IsChecked = false; radioButton_week.IsChecked = true; radioButton_list.IsChecked = false; } else if (setInfo.ViewMode == 2) { radioButton_rate.IsChecked = false; radioButton_week.IsChecked = false; radioButton_list.IsChecked = true; } else { radioButton_rate.IsChecked = true; radioButton_week.IsChecked = false; radioButton_list.IsChecked = false; } if (setInfo.NeedTimeOnlyBasic == true) { checkBox_noTimeView_rate.IsChecked = true; } else { checkBox_noTimeView_rate.IsChecked = false; } if (setInfo.NeedTimeOnlyWeek == true) { checkBox_noTimeView_week.IsChecked = true; } else { checkBox_noTimeView_week.IsChecked = false; } comboBox_timeH_week.SelectedIndex = setInfo.StartTimeWeek; if (setInfo.SearchMode == true) { checkBox_searchMode.IsChecked = true; } else { checkBox_searchMode.IsChecked = false; } foreach (UInt64 id in setInfo.ViewServiceList) { if (ChSet5.Instance.ChList.ContainsKey(id) == true) { listBox_serviceView.Items.Add(ChSet5.Instance.ChList[id]); } } foreach (UInt16 id in setInfo.ViewContentKindList) { if (CommonManager.Instance.ContentKindDictionary.ContainsKey(id) == true) { listBox_jyanruView.Items.Add(CommonManager.Instance.ContentKindDictionary[id]); } } }
/// <summary> /// タブ生成 /// </summary> private bool CreateTabItem() { try { if (Settings.Instance.UseCustomEpgView == false) { if (CommonManager.Instance.NWMode == true) { if (CommonManager.Instance.NW.IsConnected == false) { return false; } } ErrCode err = CommonManager.Instance.DB.ReloadEpgData(); if (err == ErrCode.CMD_ERR_CONNECT) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show("サーバー または EpgTimerSrv に接続できませんでした。"); }), null); return false; } if (err == ErrCode.CMD_ERR_BUSY) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show("EPGデータの読み込みを行える状態ではありません。\r\n(EPGデータ読み込み中。など)"); }), null); return false; } if (err == ErrCode.CMD_ERR_TIMEOUT) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show("EpgTimerSrvとの接続にタイムアウトしました。"); }), null); return false; } if (err != ErrCode.CMD_SUCCESS) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show("EPGデータの取得でエラーが発生しました。EPGデータが読み込まれていない可能性があります。"); }), null); return false; } CommonManager.Instance.DB.ReloadReserveInfo(); bool findTere = false; bool findBS = false; bool findCS = false; bool findOther = false; CustomEpgTabInfo setInfoBS = new CustomEpgTabInfo(); setInfoBS.ViewMode = 0; setInfoBS.TabName = "BS"; setInfoBS.NeedTimeOnlyBasic = false; CustomEpgTabInfo setInfoCS = new CustomEpgTabInfo(); setInfoCS.ViewMode = 0; setInfoCS.TabName = "CS"; setInfoCS.NeedTimeOnlyBasic = false; CustomEpgTabInfo setInfoTere = new CustomEpgTabInfo(); setInfoTere.ViewMode = 0; setInfoTere.TabName = "地デジ"; setInfoTere.NeedTimeOnlyBasic = false; CustomEpgTabInfo setInfoOther = new CustomEpgTabInfo(); setInfoOther.ViewMode = 0; setInfoOther.TabName = "その他"; setInfoOther.NeedTimeOnlyBasic = false; //デフォルト表示 foreach (EpgServiceEventInfo info in CommonManager.Instance.DB.ServiceEventList.Values) { if (info.serviceInfo.ONID == 0x0004) { findBS = true; UInt64 id = CommonManager.Create64Key(info.serviceInfo.ONID, info.serviceInfo.TSID, info.serviceInfo.SID); setInfoBS.ViewServiceList.Add(id); } else if (info.serviceInfo.ONID == 0x0006 || info.serviceInfo.ONID == 0x0007) { findCS = true; UInt64 id = CommonManager.Create64Key(info.serviceInfo.ONID, info.serviceInfo.TSID, info.serviceInfo.SID); setInfoCS.ViewServiceList.Add(id); } else if (0x7880 <= info.serviceInfo.ONID && info.serviceInfo.ONID <= 0x7FE8) { findTere = true; UInt64 id = CommonManager.Create64Key(info.serviceInfo.ONID, info.serviceInfo.TSID, info.serviceInfo.SID); setInfoTere.ViewServiceList.Add(id); } else { findOther = true; UInt64 id = CommonManager.Create64Key(info.serviceInfo.ONID, info.serviceInfo.TSID, info.serviceInfo.SID); setInfoOther.ViewServiceList.Add(id); } } if (findBS == true) { EpgDataViewItem epgView = new EpgDataViewItem(); epgView.SetViewMode(setInfoBS); epgView.ViewSettingClick += new ViewSettingClickHandler(epgView_ViewSettingClick); TabItem tabItem = new TabItem(); tabItem.Header = setInfoBS.TabName; tabItem.Content = epgView; tabControl.Items.Add(tabItem); } if (findCS == true) { EpgDataViewItem epgView = new EpgDataViewItem(); epgView.SetViewMode(setInfoCS); epgView.ViewSettingClick += new ViewSettingClickHandler(epgView_ViewSettingClick); TabItem tabItem = new TabItem(); tabItem.Header = setInfoCS.TabName; tabItem.Content = epgView; tabControl.Items.Add(tabItem); } if (findTere == true) { EpgDataViewItem epgView = new EpgDataViewItem(); epgView.SetViewMode(setInfoTere); epgView.ViewSettingClick += new ViewSettingClickHandler(epgView_ViewSettingClick); TabItem tabItem = new TabItem(); tabItem.Header = setInfoTere.TabName; tabItem.Content = epgView; tabControl.Items.Add(tabItem); } if (findOther == true) { EpgDataViewItem epgView = new EpgDataViewItem(); epgView.SetViewMode(setInfoOther); epgView.ViewSettingClick += new ViewSettingClickHandler(epgView_ViewSettingClick); TabItem tabItem = new TabItem(); tabItem.Header = setInfoOther.TabName; tabItem.Content = epgView; tabControl.Items.Add(tabItem); } if (tabControl.Items.Count > 0) { tabControl.SelectedIndex = 0; } } else { //カスタム表示 foreach (CustomEpgTabInfo info in Settings.Instance.CustomEpgTabList) { EpgDataViewItem epgView = new EpgDataViewItem(); epgView.SetViewMode(info); epgView.ViewSettingClick += new ViewSettingClickHandler(epgView_ViewSettingClick); TabItem tabItem = new TabItem(); tabItem.Header = info.TabName; tabItem.Content = epgView; tabControl.Items.Add(tabItem); } if (tabControl.Items.Count > 0) { tabControl.SelectedIndex = 0; } } } catch (Exception ex) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }), null); } return true; }
private void item_ViewSettingClick(object sender, object param) { try { if (param == null) { var dlg = new EpgDataViewSettingWindow(); var topWindow = PresentationSource.FromVisual(this); if (topWindow != null) { dlg.Owner = (Window)topWindow.RootVisual; } dlg.SetDefSetting(this.GetViewMode()); dlg.SetTrySetModeEnable(); if (Settings.Instance.UseCustomEpgView == false) { dlg.SetTrySetModeOnly(); } if (dlg.ShowDialog() == true) { var setInfo = new CustomEpgTabInfo(); ; dlg.GetSetting(ref setInfo); if (Settings.Instance.UseCustomEpgView == true && Settings.Instance.TryEpgSetting == false) { if (setInfo.ID >= 0 && setInfo.ID <= Settings.Instance.CustomEpgTabList.Count) { Settings.Instance.CustomEpgTabList[setInfo.ID] = setInfo; Settings.SaveToXmlFile(); } } this.SetViewMode(setInfo); viewCtrl.UpdateEpgData(); } } else { CustomEpgTabInfo setInfo = param as CustomEpgTabInfo; this.SetViewMode(setInfo); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }