private void OnSearch(FinderNode finderNode) { if (this.NewsItemSearch != null) { this.NewsItemSearch(this, new NewsItemSearchEventArgs(finderNode)); } }
public NewsItemSearchEventArgs(FinderNode finderNode) : base() { this.FinderNode = finderNode; }
public void SearchDialogSetSearchCriterias(FinderNode node) { if (node == null) { return; } SearchCriteriaCollection criterias = node.Finder.SearchCriterias; string searchName = node.Finder.FullPath; ResetControlState(); Queue itemAgeCriterias = new Queue(2); foreach (ISearchCriteria criteria in criterias) { SearchCriteriaString str = criteria as SearchCriteriaString; if (str != null) { SearchStringElement where = str.Where; if ((where & SearchStringElement.Title) == SearchStringElement.Title) { checkBoxRssSearchInTitle.Checked = true; } else { checkBoxRssSearchInTitle.Checked = false; } if ((where & SearchStringElement.Content) == SearchStringElement.Content) { checkBoxRssSearchInDesc.Checked = true; } else { checkBoxRssSearchInDesc.Checked = false; } if ((where & SearchStringElement.Subject) == SearchStringElement.Subject) { checkBoxRssSearchInCategory.Checked = true; } else { checkBoxRssSearchInCategory.Checked = false; } if ((where & SearchStringElement.Link) == SearchStringElement.Link) { checkBoxRssSearchInLink.Checked = true; } else { checkBoxRssSearchInLink.Checked = false; } SearchFieldsGroupExpanded = true; // if (str.WhatKind == StringExpressionKind.Text) // radioRssSearchSimpleText.Checked = true; // else if (str.WhatKind == StringExpressionKind.RegularExpression) // radioRssSearchRegEx.Checked = true; // else if (str.WhatKind == StringExpressionKind.XPathExpression) // radioRssSearchExprXPath.Checked = true; // // if (!radioRssSearchSimpleText.Checked) // this.collapsiblePanelRssSearchExprKindEx.Collapsed = false; textSearchExpression.Text = str.What; } SearchCriteriaProperty prop = criteria as SearchCriteriaProperty; if (prop != null) { if (prop.WhatKind == PropertyExpressionKind.Unread) { if (!prop.BeenRead) { checkBoxRssSearchUnreadItems.Checked = true; } else { checkBoxRssSearchUnreadItems.Checked = false; } } IsAdvancedOptionReadStatusActive = true; AdvancedOptionsGroupExpanded = true; } SearchCriteriaAge age = criteria as SearchCriteriaAge; if (age != null) { if (age.WhatRelativeToToday.CompareTo(TimeSpan.Zero) != 0) { // relative item age specified IsAdvancedOptionItemAgeActive = true; if (age.WhatKind == DateExpressionKind.NewerThan) { this.optionSetItemAge.CheckedIndex = 0; } else { this.optionSetItemAge.CheckedIndex = 1; } this.comboRssSearchItemAge.SelectedIndex = Utils.RssSearchItemAgeToIndex(age.WhatRelativeToToday); } else { // absolute item age or range specified, queue for later handling itemAgeCriterias.Enqueue(age); } if (!AdvancedOptionsGroupExpanded) { AdvancedOptionsGroupExpanded = true; } } } if (itemAgeCriterias.Count > 0) { // absolute date specified IsAdvancedOptionItemPostedActive = true; SearchCriteriaAge ageAbs = (SearchCriteriaAge)itemAgeCriterias.Dequeue(); if (ageAbs.WhatKind == DateExpressionKind.Equal) { this.comboBoxRssSearchItemPostedOperator.SelectedIndex = 0; } else if (ageAbs.WhatKind == DateExpressionKind.OlderThan) { this.comboBoxRssSearchItemPostedOperator.SelectedIndex = 1; } else if (ageAbs.WhatKind == DateExpressionKind.NewerThan) { this.comboBoxRssSearchItemPostedOperator.SelectedIndex = 2; } else // between (range): { this.comboBoxRssSearchItemPostedOperator.SelectedIndex = 3; } this.dateTimeRssSearchItemPost.Value = ageAbs.What; if (itemAgeCriterias.Count > 1) { // range specified SearchCriteriaAge ageFrom = (SearchCriteriaAge)itemAgeCriterias.Dequeue(); SearchCriteriaAge ageTo = (SearchCriteriaAge)itemAgeCriterias.Dequeue(); this.dateTimeRssSearchItemPost.Value = ageFrom.What; this.dateTimeRssSearchPostBefore.Value = ageTo.What; } } itemAgeCriterias.Clear(); if (!node.IsTempFinderNode) { textFinderCaption.Text = searchName; } if (textFinderCaption.Text.Length > 0) { SaveSearchGroupExpanded = true; } PopulateTreeRssSearchScope(); // init, all checked. Common case if (this.treeRssSearchScope.Nodes.Count == 0 || (node.Finder.CategoryPathScope == null || node.Finder.CategoryPathScope.Count == 0) && (node.Finder.FeedUrlScope == null || node.Finder.FeedUrlScope.Count == 0)) { return; } this.treeRssSearchScope.Nodes[0].Checked = false; // uncheck all. TreeHelper.CheckChildNodes(this.treeRssSearchScope.Nodes[0], false); TreeHelper.SetCheckedNodes(this.treeRssSearchScope.Nodes[0], node.Finder.CategoryPathScope, node.Finder.FeedUrlScope); }
public void InitFromFinders(ArrayList finderList, ContextMenuStrip menu) { var categories = new Hashtable(); foreach (RssFinder finder in finderList) { TreeFeedsNodeBase parent = this; finder.Container = null; // may contain old node references on a re-populate call if (finder.FullPath.IndexOf(FeedSource.CategorySeparator) > 0) { // one with category string[] a = finder.FullPath.Split(FeedSource.CategorySeparator.ToCharArray()); int aLen = a.GetLength(0); string sCat = String.Join(FeedSource.CategorySeparator, a, 0, aLen - 1); if (categories.ContainsKey(sCat)) { parent = (TreeFeedsNodeBase)categories[sCat]; } else { // create category/categories var sb = new StringBuilder(); sb.Append(a[0]); for (int i = 0; i <= aLen - 2; i++) { sCat = sb.ToString(); if (categories.ContainsKey(sCat)) { parent = (TreeFeedsNodeBase)categories[sCat]; } else { TreeFeedsNodeBase cn = new FinderCategoryNode(a[i], 2, 3, menu); // menu??? categories.Add(sCat, cn); parent.Nodes.Add(cn); // cn.Cells[0].Value = cn.Text; // cn.Cells[0].Appearance.Image = cn.Override.NodeAppearance.Image; // cn.Cells[0].Appearance.Cursor = WinGuiMain.CursorHand; parent = cn; } sb.Append(FeedSource.CategorySeparator + a[i + 1]); } } } var n = new FinderNode(finder.Text, 10, 10, menu) { Finder = finder }; finder.Container = n; parent.Nodes.Add(n); // n.Cells[0].Value = n.Text; // n.Cells[0].Appearance.Image = n.Override.NodeAppearance.Image; // n.Cells[0].Appearance.Cursor = WinGuiMain.CursorHand; } //foreach finder }