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; } } }
public static bool ChgGenre(List <EpgSearchKeyInfo> infoList, UIElement owner = null) { try { var dlg = new SetSearchPresetWindow(owner); dlg.SetSettingMode("まとめてジャンル設定を変更", 0); dlg.DataView.SetSearchKey(infoList[0]); if (dlg.ShowDialog() == false) { return(false); } EpgSearchKeyInfo setData = dlg.DataView.GetSearchKey(); infoList.ForEach(info => info.contentList = setData.contentList.DeepClone()); return(true); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } return(false); }