private void button_searchKey_Click(object sender, RoutedEventArgs e)
{
var dlg = new SetDefSearchSettingWindow();
dlg.Owner = CommonUtil.GetTopWindow(this);
EpgSearchKeyInfo setKey = searchKey.Clone();
if (checkBox_searchServiceFromView.IsChecked == true)
{
setKey.serviceList = listBox_serviceView.Items.OfType <ChSet5Item>().Select(ch => (long)ch.Key).ToList();
}
dlg.SetDefSetting(setKey);
if (dlg.ShowDialog() == true)
{
searchKey = dlg.GetSetting();
if (checkBox_searchServiceFromView.IsChecked == true)
{
var oldList = listBox_serviceView.Items.OfType <object>().ToList();
var searchList = new List <object>();
foreach (ulong sv in searchKey.serviceList)
{
if (ChSet5.ChList.ContainsKey(sv) == true)
{
searchList.Add(ChSet5.ChList[sv]);
}
}
listBox_serviceView.UnselectAll();
listBox_serviceView.Items.RemoveItems(oldList.Where(sv => searchList.Contains(sv) == false));
listBox_serviceView.Items.AddItems(searchList.Where(sv => oldList.Contains(sv) == false));
}
}
}