本文整理汇总了C#中SearchParameters.Add方法的典型用法代码示例。如果您正苦于以下问题:C# SearchParameters.Add方法的具体用法?C# SearchParameters.Add怎么用?C# SearchParameters.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchParameters
的用法示例。
在下文中一共展示了SearchParameters.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoSimpleSearch
private void DoSimpleSearch(string searchText)
{
SearchParameters searchParams = new SearchParameters();
searchParams.Add(new SearchOptions(SearchType.Theme, searchText) { FindAll = true });
searchParams.Location = "All Themes";
Stopwatch time = Stopwatch.StartNew();
IEnumerable<TmNode> nodes =
themesTreeView.RootNodes.SelectMany(n => n.Recurse(node => node.Children)
.Where(x => x.Matches(searchParams))
);
DisplaySearchResults(searchParams, nodes);
time.Stop(); Trace.TraceInformation("Time for simple search: {0}ms", time.Elapsed.Milliseconds);
}
示例2: BuildSearchParameters
private SearchParameters BuildSearchParameters()
{
var sp = new SearchParameters
{
MatchAll = (andOrButton1.Text == Resources.SearchForm_AndOrButtons_And),
SearchThemes = searchThemesCheckBox.Checked,
SearchCategories = searchCategoriesCheckBox.Checked
};
SearchOptions so;
if (HaveThemeSearch)
{
if (themeNameCheckBox.Checked &&
themeDescriptionCheckBox.Checked &&
themeSummaryCheckBox.Checked &&
themeKeywordsCheckBox.Checked)
{
so = new SearchOptions(SearchType.Theme, themeNameTextBox.Text) { FindAll = allThemeNamesRadioButton.Checked };
sp.Add(so);
}
else
{
if (themeNameCheckBox.Checked)
{
so = new SearchOptions(SearchType.ThemeName, themeNameTextBox.Text) { FindAll = allThemeNamesRadioButton.Checked };
sp.Add(so);
}
if (themeDescriptionCheckBox.Checked)
{
so = new SearchOptions(SearchType.ThemeDescription, themeNameTextBox.Text) { FindAll = allThemeNamesRadioButton.Checked };
sp.Add(so);
}
if (themeSummaryCheckBox.Checked)
{
so = new SearchOptions(SearchType.ThemeSummary, themeNameTextBox.Text) { FindAll = allThemeNamesRadioButton.Checked };
sp.Add(so);
}
if (themeKeywordsCheckBox.Checked)
{
so = new SearchOptions(SearchType.ThemeTags, themeNameTextBox.Text) { FindAll = allThemeNamesRadioButton.Checked };
sp.Add(so);
}
}
}
if (HaveMetaSearch)
{
if (MetadataAllSectionsCheckBox.Checked)
sp.Add(MetaSearch("")); // search the whole document
else
{
if (metadataAbstactsCheckBox.Checked)
sp.Add(MetaSearch("abstract")); // /metadata/idinfo/descript/abstract
if (metadataPlaceKeywordsCheckBox.Checked)
sp.Add(MetaSearch("placekey"));// /metadata/idinfo/keywords/place/placekey
if (metadataThemeKeywordsCheckBox.Checked)
sp.Add(MetaSearch("themekey")); // /metadata/idinfo/keywords/theme/themekey
}
}
if (HaveDateSearch)
{
so = new SearchOptions(SearchType.PubDate, null);
if (pubDateAfter.Checked)
so.MaxDaysSinceEdit = (DateTime.Now - pubDateAfter.Value).Days;
if (pubDateBefore.Checked)
{
so.MinDaysSinceEdit = (DateTime.Now - pubDateBefore.Value).Days;
if (so.MinDaysSinceEdit < 0)
so.MinDaysSinceEdit = 0;
}
sp.Add(so);
}
if (HaveParkCode)
{
// Xpath in FGDC Metadata: /metadata/NPS_Info/NPS_Unit/UnitCode
so = new SearchOptions(SearchType.Metadata, parkUnitCodeTextBox.Text) {XmlElement = "UnitCode"};
sp.Add(so);
}
return sp;
}