public SearchWindow(EpgAutoAddData data = null, AutoAddMode mode = AutoAddMode.Find) : base(data, mode) { InitializeComponent(); try { buttonID = "検索"; base.SetParam(true, checkBox_windowPinned, checkBox_dataReplace); //スプリッタ位置設定。操作不可能な値をセットしないよう努める。 if (Settings.Instance.SearchWndTabsHeight > grid_Tabs.Height.Value) { grid_Tabs.Height = new GridLength(Math.Min(Settings.Instance.SearchWndTabsHeight, Height)); } //リストビュー関連の設定 var list_columns = Resources["ReserveItemViewColumns"] as GridViewColumnList; list_columns.AddRange(Resources["RecSettingViewColumns"] as GridViewColumnList); lstCtrl = new ListViewController <SearchItem>(this); lstCtrl.SetSavePath(CommonUtil.NameOf(() => Settings.Instance.SearchWndColumn) , CommonUtil.NameOf(() => Settings.Instance.SearchColumnHead) , CommonUtil.NameOf(() => Settings.Instance.SearchSortDirection)); lstCtrl.SetViewSetting(listView_result, gridView_result, true, true, list_columns); lstCtrl.SetSelectedItemDoubleClick(EpgCmds.ShowDialog); //ステータス変更の設定 lstCtrl.SetSelectionChangedEventHandler((sender, e) => this.UpdateStatus(1)); //最初にコマンド集の初期化 mc = new CmdExeReserve(this); mc.SetFuncGetSearchList(isAll => (isAll == true ? lstCtrl.dataList.ToList() : lstCtrl.GetSelectedItemsList())); mc.SetFuncSelectSingleSearchData(lstCtrl.SelectSingleItem); mc.SetFuncReleaseSelectedData(() => listView_result.UnselectAll()); mc.recSettingView = this.recSettingView; //コマンド集に無いもの mc.AddReplaceCommand(EpgCmds.ReSearch, mc_Research); mc.AddReplaceCommand(EpgCmds.ReSearch2, mc_Research); mc.AddReplaceCommand(EpgCmds.Search, button_search_Click); mc.AddReplaceCommand(EpgCmds.AddInDialog, autoadd_add); mc.AddReplaceCommand(EpgCmds.ChangeInDialog, autoadd_chg, (sender, e) => e.CanExecute = winMode == AutoAddMode.Change); mc.AddReplaceCommand(EpgCmds.DeleteInDialog, autoadd_del1, (sender, e) => e.CanExecute = winMode == AutoAddMode.Change); mc.AddReplaceCommand(EpgCmds.Delete2InDialog, autoadd_del2, (sender, e) => e.CanExecute = winMode == AutoAddMode.Change); mc.AddReplaceCommand(EpgCmds.BackItem, (sender, e) => MoveViewNextItem(-1)); mc.AddReplaceCommand(EpgCmds.NextItem, (sender, e) => MoveViewNextItem(1)); mc.AddReplaceCommand(EpgCmds.Cancel, (sender, e) => this.Close()); mc.AddReplaceCommand(EpgCmds.ChgOnOffCheck, (sender, e) => lstCtrl.ChgOnOffFromCheckbox(e.Parameter, EpgCmds.ChgOnOff)); //コマンド集を振り替えるもの mc.AddReplaceCommand(EpgCmds.JumpReserve, (sender, e) => mc_JumpTab(CtxmCode.ReserveView)); mc.AddReplaceCommand(EpgCmds.JumpTuner, (sender, e) => mc_JumpTab(CtxmCode.TunerReserveView)); mc.AddReplaceCommand(EpgCmds.JumpTable, (sender, e) => mc_JumpTab(CtxmCode.EpgView)); //コマンド集からコマンドを登録。 mc.ResetCommandBindings(this, listView_result.ContextMenu); //コンテキストメニューを開く時の設定 listView_result.ContextMenu.Opened += new RoutedEventHandler(mc.SupportContextMenuLoading); //ボタンの設定 mBinds.View = CtxmCode.SearchWindow; mBinds.SetCommandToButton(button_search, EpgCmds.Search); mBinds.SetCommandToButton(button_add_reserve, EpgCmds.Add); mBinds.SetCommandToButton(button_delall_reserve, EpgCmds.DeleteAll); mBinds.SetCommandToButton(button_add_epgAutoAdd, EpgCmds.AddInDialog); mBinds.SetCommandToButton(button_chg_epgAutoAdd, EpgCmds.ChangeInDialog); mBinds.SetCommandToButton(button_del_epgAutoAdd, EpgCmds.DeleteInDialog); mBinds.SetCommandToButton(button_del2_epgAutoAdd, EpgCmds.Delete2InDialog); mBinds.SetCommandToButton(button_up_epgAutoAdd, EpgCmds.BackItem); mBinds.SetCommandToButton(button_down_epgAutoAdd, EpgCmds.NextItem); mBinds.SetCommandToButton(button_cancel, EpgCmds.Cancel); //メニューの作成、ショートカットの登録 RefreshMenu(); //予約ウィンドウからのリスト検索、ジャンプ関連の対応 DataListView = new AutoAddWinListView(listView_result); this.grid_main.Children.Add(DataListView); //その他のショートカット(検索ダイアログ固有の設定)。コマンドだとコンボボックスアイテムの処理と協調しにくいので‥。 //searchKeyView.InputBindings.Add(new InputBinding(EpgCmds.Search, new KeyGesture(Key.Enter))); searchKeyView.KeyUp += (sender, e) => { if (e.Key == Key.Enter) { button_search_Click(null, null); } }; listView_result.PreviewKeyDown += (sender, e) => ViewUtil.OnKyeMoveNextReserve(sender, e, DataListView); //録画設定タブ関係の設定 recSettingView.SelectedPresetChanged += SetRecSettingTabHeader; recSettingTabHeader.MouseRightButtonUp += recSettingView.OpenPresetSelectMenuOnMouseEvent; //ステータスバーの登録 StatusManager.RegisterStatusbar(this.statusBar, this); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public SetContextMenuWindow(Visual owner = null, MenuSettingData data = null) { InitializeComponent(); try { this.Owner = CommonUtil.GetTopWindow(owner); if (data != null) { info = data.DeepClone(); } //共通設定画面用の設定 Action <StackPanel, StackPanel> CopyStackItem = (src, trg) => { foreach (var item in src.Children.OfType <Control>().Where(i => i is Label != true)) { var newItem = (Control)Activator.CreateInstance(item.GetType()); newItem.Style = item.Style; if (item is CheckBox) { newItem.Visibility = Visibility.Hidden; } trg.Children.Add(newItem); } }; CopyStackItem(stackPanel_menu, stackPanel_gesture); CopyStackItem(stackPanel_menu, stackPanel_gesture2); stackItems_menu = stackPanel_menu.Children.OfType <CheckBox>().ToList(); stackItems_ges1 = stackPanel_gesture.Children.OfType <CheckBox>().ToList(); stackItems_ges2 = stackPanel_gesture2.Children.OfType <CheckBox>().ToList(); //個別設定画面用の設定 this.comboBoxViewSelect.DisplayMemberPath = CommonUtil.NameOf(() => new ComboItem().Value); this.comboBoxViewSelect.SelectedValuePath = CommonUtil.NameOf(() => new ComboItem().Key); var bx = new BoxExchangeEditor(this.listBox_Default, this.listBox_Setting, true, true, true, true); bx.AllowDuplication(StringItem.Items(EpgCmdsEx.SeparatorString), StringItem.Cloner, StringItem.Comparator); button_reset.Click += new RoutedEventHandler(bx.button_Reset_Click); button_add.Click += new RoutedEventHandler(bx.button_Add_Click); button_ins.Click += new RoutedEventHandler(bx.button_Insert_Click); button_del.Click += new RoutedEventHandler(bx.button_Delete_Click); button_delAll.Click += new RoutedEventHandler(bx.button_DeleteAll_Click); button_top.Click += new RoutedEventHandler(bx.button_Top_Click); button_up.Click += new RoutedEventHandler(bx.button_Up_Click); button_down.Click += new RoutedEventHandler(bx.button_Down_Click); button_bottom.Click += new RoutedEventHandler(bx.button_Bottom_Click); //その他画面用の設定 foreach (var item in MenuCodeToTitle.Where(i => i.Key != CtxmCode.EditChgMenu)) { var chkbox = new CheckBox(); chkbox.Tag = item.Key; chkbox.Content = item.Value; chkbox.Checked += new RoutedEventHandler(checkBox_IsManualMenuCode_Checked); chkbox.Unchecked += new RoutedEventHandler(checkBox_IsManualMenuCode_Checked); wrapPanel_IsManualMenu.Children.Add(chkbox); } //細かいオプションの設定 checkBox_NoMessageKeyGesture.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.NoMessageKeyGesture)); checkBox_NoMessageDeleteAll.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.NoMessageDeleteAll)); checkBox_NoMessageDelete2.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.NoMessageDelete2)); checkBox_NoMessageAdjustRes.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.NoMessageAdjustRes)); checkBox_SetJunreToAutoAdd.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.SetJunreToAutoAdd)); checkBox_SetJunreContentToAutoAdd.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.SetJunreContentToAutoAdd)); checkBox_CancelAutoAddOff.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.CancelAutoAddOff)); checkBox_AutoAddFazySearch.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.AutoAddFazySearch)); checkBox_AutoAddSearchToolTip.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.AutoAddSearchToolTip)); checkBox_AutoAddSearchSkipSubMenu.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.AutoAddSearchSkipSubMenu)); checkBox_ReserveSearchToolTip.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.ReserveSearchToolTip)); checkBox_EpgKeyword_Trim.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.Keyword_Trim)); checkBox_CopyTitle_Trim.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.CopyTitle_Trim)); checkBox_CopyContentBasic.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.CopyContentBasic)); checkBox_InfoSearchTtile_Trim.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.InfoSearchTitle_Trim)); checkBox_SearchTtile_Trim.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.SearchTitle_Trim)); textBox_SearchURI.SetBinding(TextBox.TextProperty, CommonUtil.NameOf(() => info.SearchURI)); checkBox_NoMessageNotKEY.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.NoMessageNotKEY)); checkBox_OpenParentFolder.SetBinding(CheckBox.IsCheckedProperty, CommonUtil.NameOf(() => info.OpenParentFolder)); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public static void UpdateInfo(uint?srvStatus = null, bool updateTray = true) { if (srvStatus != null) { srvState = (uint)srvStatus; } if (Settings.Instance.ShowTray == false || updateTray == false) { return; } var sortList = CommonManager.Instance.DB.ReserveList.Values .Where(info => info.IsEnabled == true && info.IsOver() == false) .OrderBy(info => info.StartTimeActual).ToList(); bool isOnPreRec = false; string infoText = IsSrvLost == true ? "[未接続]\r\n(?)" : ""; infoText += srvState == 2 ? "EPG取得中\r\n" : ""; if (sortList.Count == 0) { infoText += "次の予約なし"; } else { if (sortList[0].IsOnRec() == true) { sortList = sortList.FindAll(info => info.IsOnRec()); infoText += "録画中:"; } else { var PreRecTime = DateTime.UtcNow.AddHours(9).AddMinutes(Settings.Instance.RecAppWakeTime); isOnPreRec = sortList[0].OnTime(PreRecTime) >= 0; if (isOnPreRec == true) //録画準備中 { sortList = sortList.FindAll(info => info.OnTime(PreRecTime) >= 0); //あまり意味無い infoText += "録画準備中:"; } else if (Settings.Instance.UpdateTaskText == true && sortList[0].OnTime(PreRecTime.AddMinutes(30)) >= 0) //30分以内に録画準備に入るもの { sortList = sortList.FindAll(info => info.OnTime(PreRecTime.AddMinutes(30)) >= 0); infoText += "まもなく録画:"; } else { sortList = sortList.Take(1).ToList(); infoText += "次の予約:"; } } //FindAll()が順次検索、OrderBy()は安定ソートなのでこれでOK ReserveData first = sortList.OrderBy(info => info.IsWatchMode).First(); infoText += first.StationName + " " + new ReserveItem(first).StartTimeShort + " " + first.Title; string endText = (sortList.Count() <= 1 ? "" : "\r\n他" + (sortList.Count() - 1).ToString()); infoText = CommonUtil.LimitLenString(infoText, 63 - endText.Length) + endText; if (first.IsWatchMode == true) { infoText = infoText.Replace("録画", "視聴"); } } taskTray.Text = infoText; if (IsSrvLost == true) { taskTray.IconUri = new Uri("pack://application:,,,/Resources/TaskIconGray.ico"); } else if (srvState == 1) { taskTray.IconUri = new Uri("pack://application:,,,/Resources/TaskIconRed.ico"); } else if (isOnPreRec == true) { taskTray.IconUri = new Uri("pack://application:,,,/Resources/TaskIconOrange.ico"); } else if (srvState == 2) { taskTray.IconUri = new Uri("pack://application:,,,/Resources/TaskIconGreen.ico"); } else { taskTray.IconUri = new Uri("pack://application:,,,/Resources/EpgTimer_Bon_Vista_blue_rev2.ico"); } }
public void InitWindow(InfoSearchSettingData searchInfo, string searchWord = null, bool noSave = false) { InitializeComponent(); try { buttonID = "予約情報検索"; base.SetParam(false, checkBox_windowPinned); //リストビュー関連の設定 var list_columns = Resources["ReserveItemViewColumns"] as GridViewColumnList; list_columns.AddRange(Resources["RecSettingViewColumns"] as GridViewColumnList); list_columns.RenameHeader("StartTime", "日時/次の予約"); list_columns.RenameHeader("EventName", "番組名/ANDキーワード"); list_columns.RenameHeader("ProgramContent", "番組内容/その他情報"); list_columns.RenameHeader("IsEnabled", "有効・プロテクト", "有効・無効/プロテクト切替え"); list_columns.RenameHeader("Comment", "予約/録画状況"); list_columns.RenameHeader("RecFileName", "予定/録画ファイル名"); lstCtrl = new ListViewController <InfoSearchItem>(this); lstCtrl.SetSavePath(CommonUtil.NameOf(() => Settings.Instance.InfoSearchWndColumn) , CommonUtil.NameOf(() => Settings.Instance.InfoSearchColumnHead) , CommonUtil.NameOf(() => Settings.Instance.InfoSearchSortDirection)); lstCtrl.SetViewSetting(listView_result, gridView_result, true, true, list_columns); lstCtrl.SetSelectedItemDoubleClick((sender, e) => { var cmd = (selectedType == typeof(RecFileInfo) && Settings.Instance.PlayDClick == true) ? EpgCmds.Play : EpgCmds.ShowDialog; cmd.Execute(sender, listView_result); }); //ステータス変更の設定 lstCtrl.SetSelectionChangedEventHandler((sender, e) => this.UpdateStatus(1)); //最初にコマンド集の初期化 mc = new CmdExe <InfoSearchItem>(this); mc.SetFuncGetDataList(isAll => isAll == true ? lstCtrl.dataList : lstCtrl.GetSelectedItemsList()); mc.SetFuncSelectSingleData((noChange) => lstCtrl.SelectSingleItem(noChange)); mc.SetFuncReleaseSelectedData(() => listView_result.UnselectAll()); //コマンド集に無いもの mc.AddReplaceCommand(EpgCmds.JumpListView, mc_JumpListView); mc.AddReplaceCommand(EpgCmds.ReSearch, mc_ReSearch); mc.AddReplaceCommand(EpgCmds.ReSearch2, mc_ReSearch); mc.AddReplaceCommand(EpgCmds.Search, mc_Search); mc.AddReplaceCommand(EpgCmds.Cancel, (sender, e) => this.Close()); mc.AddReplaceCommand(EpgCmds.ChgOnOffCheck, (sender, e) => lstCtrl.ChgOnOffFromCheckbox(e.Parameter, EpgCmds.ChgOnOff)); //コマンド集を振り替えるもの mc.AddReplaceCommand(EpgCmds.ShowDialog, mc_ShowDialog);//Enterキーからの実行が無ければ省略できる mc.AddReplaceCommand(EpgCmds.ChgOnOff, mc_ChgOnOff); mc.AddReplaceCommand(EpgCmds.Delete, mc_Delete); mc.AddReplaceCommand(EpgCmds.SetRecTag, mc_SetRecTag); //ボタンの設定 mBinds.View = CtxmCode.InfoSearchWindow; mBinds.SetCommandToButton(button_search, EpgCmds.Search); mBinds.AddInputCommand(EpgCmds.Cancel);//ショートカット登録 //コンテキストメニューを開く時の設定 listView_result.ContextMenu.Opened += (sender, e) => dic_mc[selectedType].SupportContextMenuLoading(sender, e); //タイプごとの個別コマンド処理用データの設定 dic_mc.Add(typeof(InfoSearchItem), mc); dic_mc.Add(typeof(ReserveData), new CmdExeReserve(this)); dic_mc.Add(typeof(RecFileInfo), new CmdExeRecinfo(this)); dic_mc.Add(typeof(EpgAutoAddData), new CmdExeEpgAutoAdd(this)); dic_mc.Add(typeof(ManualAutoAddData), new CmdExeManualAutoAdd(this)); foreach (var data in dic_mc.Values.Skip(1)) { data.SetFuncGetDataList(isAll => { return((isAll == true ? lstCtrl.dataList : lstCtrl.GetSelectedItemsList()).Select(d => d.Data)); }); data.SetFuncSelectSingleData(noChange => { InfoSearchItem item = lstCtrl.SelectSingleItem(noChange); return(item == null ? null : item.Data); }); data.SetFuncReleaseSelectedData(() => listView_result.UnselectAll()); data.AddReplaceCommand(EpgCmds.ChgOnOff, mc_ChgOnOff); data.AddReplaceCommand(EpgCmds.JumpReserve, (sender, e) => mc_JumpTab(CtxmCode.ReserveView)); data.AddReplaceCommand(EpgCmds.JumpTuner, (sender, e) => mc_JumpTab(CtxmCode.TunerReserveView)); data.AddReplaceCommand(EpgCmds.JumpTable, (sender, e) => mc_JumpTab(CtxmCode.EpgView)); } //タイプごとのショートカット情報を登録 dic_mBinds.Add(typeof(InfoSearchItem), mBinds); dic_mBinds.Add(typeof(ReserveData), new MenuBinds { View = CtxmCode.ReserveView }); dic_mBinds.Add(typeof(RecFileInfo), new MenuBinds { View = CtxmCode.RecInfoView }); dic_mBinds.Add(typeof(EpgAutoAddData), new MenuBinds { View = CtxmCode.EpgAutoAddView }); dic_mBinds.Add(typeof(ManualAutoAddData), new MenuBinds { View = CtxmCode.ManualAutoAddView }); //メニューの作成、ショートカットの登録 this.RefreshMenu(); //選択状態に合わせてコマンドなどをセットするようにする。 //lstCtrl.SetSelectionChangedEventHandler()は遅延実行なので使わない。 this.listView_result.SelectionChanged += (sender, e) => ResetMenu(); //その他設定 checkBox_ShowToolTip.IsChecked = Settings.Instance.InfoSearchItemTooltip; DataContext = (searchInfo ?? Settings.Instance.InfoSearchData).DeepCloneObj(); if (searchWord != null) { SearchInfo.SearchWord = searchWord; } startSearch = searchInfo != null || searchWord != null; noSearchSettingSave = noSave; //ステータスバーの登録 StatusManager.RegisterStatusbar(this.statusBar, this); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void epgView_ViewSettingClick(int param) { try { var tab = tabControl.SelectedItem as EpgTabItem; if (tab == null) { return; } if (param < -2 || 2 < param) { return; } CustomEpgTabInfo info = null; if (param == -1) { //表示設定変更ダイアログから var dlg = new EpgDataViewSettingWindow(tab.Info); dlg.Owner = CommonUtil.GetTopWindow(this); dlg.SetTryMode(Settings.Instance.UseCustomEpgView == false); if (dlg.ShowDialog() == false) { return; } info = dlg.GetSetting(); if (info.Uid != tab.Uid) { return; //保険 } //設定の保存。 if (Settings.Instance.UseCustomEpgView == true && Settings.Instance.TryEpgSetting == false && info.ID >= 0 && info.ID < tabInfo.Count && info.ID < Settings.Instance.CustomEpgTabList.Count) { tabInfo[info.ID] = info; Settings.Instance.CustomEpgTabList[info.ID] = info; Settings.SaveToXmlFile(); SettingWindow.UpdatesInfo("番組表関連の変更"); } if (info.IsVisible == false) { tabControl.Items.Remove(tab); return; } } else if (param == -2) { info = tabInfo.Find(tinfo => tinfo.ID == tab.Info.ID); if (info == null) { return; } } //選択用タブの選択を切り替え。 tab_viewMode_ChangeTabOnly(info != null ? info.ViewMode : param); tab.ChangeContent(info, param); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
protected override DateTime LimitedStart(IBasicPgInfo info) { return(CommonUtil.Max(info.PgStartTime, ViewPeriod.Start)); }
private static IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { TaskTrayClass self = hwndDictionary.SingleOrDefault(a => a.Value.Handle == hwnd).Key; if (msg == WM_APP_TRAY && self != null) { const int WM_LBUTTONUP = 0x0202; const int WM_RBUTTONUP = 0x0205; const int NIN_BALLOONSHOW = 0x0402; const int NIN_BALLOONHIDE = 0x0403; const int NIN_BALLOONTIMEOUT = 0x0404; switch (lParam.ToInt32() & 0xFFFF) { case WM_LBUTTONUP: if (self.targetWindow is ITaskTrayClickHandler) { ((ITaskTrayClickHandler)self.targetWindow).TaskTrayLeftClick(); } break; case WM_RBUTTONUP: if (self.targetWindow is ITaskTrayClickHandler) { ((ITaskTrayClickHandler)self.targetWindow).TaskTrayRightClick(); } break; case NIN_BALLOONSHOW: if (self.ForceHideBalloonTipSec > 0) { // 指定タイムアウトでバルーンチップを強制的に閉じる if (self.balloonTimer == null) { self.balloonTimer = new System.Windows.Threading.DispatcherTimer(); self.balloonTimer.Tick += (sender, e) => { if (self.Visible) { self.Visible = false; self.Visible = true; } self.balloonTimer.Stop(); }; } self.balloonTimer.Interval = TimeSpan.FromSeconds(self.ForceHideBalloonTipSec); self.balloonTimer.Start(); } break; case NIN_BALLOONHIDE: case NIN_BALLOONTIMEOUT: if (self.balloonTimer != null) { self.balloonTimer.Stop(); } break; } } else if (msg == (int)CommonUtil.RegisterTaskbarCreatedWindowMessage() && self != null) { self.Visible = self.Visible; } return(IntPtr.Zero); }
public EpgDataViewSettingWindow(CustomEpgTabInfo setInfo = null, List <EpgSetting> setList = null) { InitializeComponent(); DataContext = new CustomEpgTabInfo(); button_ok.Click += new RoutedEventHandler((sender, e) => DialogResult = true); button_cancel.Click += new RoutedEventHandler((sender, e) => DialogResult = false); checkBox_tryEpgSetting.Visibility = Visibility.Hidden; comboBox_timeH_week.ItemsSource = Enumerable.Range(0, 24); foreach (var item in ChSet5.ChListSelected.Select(item => new ServiceViewItem(item))) { if (item.ServiceInfo.IsDttv) { listBox_serviceDttv.Items.Add(item); } if (item.ServiceInfo.IsBS) { listBox_serviceBS.Items.Add(item); } if (item.ServiceInfo.IsCS) { listBox_serviceCS.Items.Add(item); } if (item.ServiceInfo.IsSPHD) { listBox_serviceSP.Items.Add(item); } if (item.ServiceInfo.IsOther) { listBox_serviceOther.Items.Add(item); } listBox_serviceAll.Items.Add(item); } int i = 0; var spItems = Enum.GetValues(typeof(EpgServiceInfo.SpecialViewServices)).Cast <ulong>().Select(id => new ServiceViewItem(id)).ToList(); var spItemsOther = spItems.ToList(); foreach (TabItem tab in tab_ServiceList.Items.OfType <TabItem>().Take(4)) { var listbox = (ListView)tab.Content; if (listbox.Items.Count != 0) { listbox.Items.Insert(0, spItems[i]); spItemsOther.Remove(spItems[i]); } tab.Visibility = listbox.Items.Count == 0 ? Visibility.Collapsed : Visibility.Visible; i++; } listBox_serviceOther.Items.InsertItems(0, spItemsOther); listBox_jyanru.ItemsSource = CommonManager.ContentKindList; RadioButtonTagConverter.SetBindingButtons(CommonUtil.NameOf(() => new CustomEpgTabInfo().ViewMode), PanelDisplaySet); listBox_Button_Set(); listBox_serviceView_ContextMenu_Set(); SetSetting(setInfo ?? new CustomEpgTabInfo(), setList); }