本文整理汇总了C#中SearchMode.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SearchMode.ToString方法的具体用法?C# SearchMode.ToString怎么用?C# SearchMode.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchMode
的用法示例。
在下文中一共展示了SearchMode.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BasicSearch
/// <summary>
/// A Basic Amazon Search
/// </summary>
/// <param name="mode">The search mode to use</param>
/// <param name="search">The search</param>
/// <see cref="http://msdn.microsoft.com/coding4fun/web/services/article.aspx?articleid=912260"/>
public string BasicSearch(SearchMode mode, string search)
{
System.Text.StringBuilder details = new StringBuilder("Search Results:\n\n");
try
{
AmazonWebService.KeywordRequest request = new AmazonWebService.KeywordRequest();
request.locale = "us";
request.type = "lite";
request.sort = "reviewrank";
request.mode = mode.ToString();
request.keyword = search;
request.tag = accessKeyId;
request.devtag = accessKeyId;
AmazonWebService.AmazonSearchService searchService = new Alexandria.Amazon.AmazonWebService.AmazonSearchService();
AmazonWebService.ProductInfo info = searchService.KeywordSearchRequest(request);
foreach(AmazonWebService.Details detail in info.Details)
{
details.Append(detail.ProductName + " [ ASIN: " + detail.Asin);
if (!string.IsNullOrEmpty(detail.OurPrice))
details.Append(" Amazon: " + detail.OurPrice);
int usedCount;
int.TryParse(detail.UsedCount, out usedCount);
if (usedCount > 0 && !string.IsNullOrEmpty(detail.UsedPrice))
details.Append(", Used: " + detail.UsedPrice);
details.Append("]\n");
System.Diagnostics.Debug.WriteLine("Product Name: " + detail.ProductName);
}
return details.ToString();
}
catch (Exception ex)
{
throw new AlexandriaException("The was an error attempting to search Amazon", ex);
}
}
示例2: GetSearchThreadUrl
public static string GetSearchThreadUrl(string codeName, int threadID, int postID, SearchMode mode, string searchText)
{
return GetThreadUrl(codeName, threadID) + "?postID=" + postID + "&page=1&SearchMode=" + mode.ToString() + "&searchText=" + searchText;
//return BbsRouter.GetUrl(string.Format("showthread/{0}/tid-{1}/{2}/pid-{3}/smode-{4}/keyword-{5}", codeName, threadID, 1, postID,mode.ToString(),searchText));
//string threadUrl = UrlManager.GetFriendlyUrl("ShowThread.html?codename={0}&ThreadID={1}&postID={2}&page=1&SearchMode={3}&searchText={4}", true);
//return string.Format(threadUrl, codeName, threadID, postID, mode.ToString(), searchText);
}