示例#1
0
        public static void Test()
        {
            YahooSearchService yahoo = new YahooSearchService();

            Yahoo.API.ImageSearchResponse.ResultSet resultSet = yahoo.ImageSearch("YahooExample", "satriani", "all", 10, 1, "any", true);

            StringWriter sw = new StringWriter();
            foreach (Yahoo.API.ImageSearchResponse.ResultType result in resultSet.Result)
            {
                System.Diagnostics.Debug.WriteLine("Title: {0}", result.Title);
                System.Diagnostics.Debug.WriteLine("Summary: {0}", result.Summary);
                System.Diagnostics.Debug.WriteLine("URL: {0}", result.Url);
                System.Diagnostics.Debug.WriteLine("==============================================================");
            }
        }
示例#2
0
        private void btnImage_Click(object sender, System.EventArgs e)
        {
            YahooSearchService yahoo = new YahooSearchService();

            Yahoo.API.ImageSearchResponse.ResultSet resultSet = yahoo.ImageSearch("YahooExample", "maddona", "all", 10, 1, "any", true );

            StringWriter sw = new StringWriter();
            foreach (Yahoo.API.ImageSearchResponse.ResultType result in resultSet.Result)
            {
                sw.WriteLine("Title: {0}", result.Title);
                sw.WriteLine("Summary: {0}", result.Summary);
                sw.WriteLine("URL: {0}", result.Url);
                sw.WriteLine("===============================================================");
            }

            txtResult.Text = sw.ToString();
        }
示例#3
0
        public void OnSearch(ref SearchParams param, System.ComponentModel.BackgroundWorker bw)
        {
            if (param.Act == SearchParams.Action.aContinue)
            {
                SearchNext(bw);
                return;
            }

            try
            {
                if (yahoo == null) yahoo = new YahooSearchService();

                pattern = param.Pattern + " " + control.SelectedSize;

                resultCount = 0;
                start = 0;
                imagesFound = 0;
                imagesToLoad.Clear();

                SearchNext(bw);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("error in search: " + e);
            }
        }
示例#4
0
        private void btnLocal_Click(object sender, System.EventArgs e)
        {
            YahooSearchService yahoo = new YahooSearchService();

            Yahoo.API.LocalSearchResponse.ResultSet resultSet = yahoo.LocalSearch("YahooExample", "pizza", 10, 1, (float)10.0, "", "", "", "94306", "");

            StringWriter sw = new StringWriter();
            foreach (Yahoo.API.LocalSearchResponse.ResultType result in resultSet.Result)
            {
                sw.WriteLine("Title: {0}", result.Title);
                sw.WriteLine("Address: {0}", result.Address);
                sw.WriteLine("URL: {0}", result.Url);
                sw.WriteLine("===============================================================");
            }

            txtResult.Text = sw.ToString();
        }
示例#5
0
        private void btnTermExtraction_Click(object sender, System.EventArgs e)
        {
            YahooSearchService yahoo = new YahooSearchService();

            Yahoo.API.TermExtractionResponse.ResultSet resultSet = yahoo.TermExtraction("YahooExample", "maddona", "Italian sculptors and painters of the renaissance favored the Virgin Mary for inspiration.");

            StringWriter sw = new StringWriter();
            foreach (string result in resultSet.Result)
            {
                sw.WriteLine("{0}", result);
            }

            txtResult.Text = sw.ToString();
        }
示例#6
0
        private void btnSpelling_Click(object sender, System.EventArgs e)
        {
            YahooSearchService yahoo = new YahooSearchService();

            Yahoo.API.WebSearchSpellingResponse.ResultSet resultSet = yahoo.WebSearchSpelling("YahooExample", "madnna");

            StringWriter sw = new StringWriter();
            sw.WriteLine("Spelling Suggestion: {0}", resultSet.Result);

            txtResult.Text = sw.ToString();
        }
示例#7
0
        private void btnRelatedSuggestions_Click(object sender, System.EventArgs e)
        {
            YahooSearchService yahoo = new YahooSearchService();

            Yahoo.API.WebSearchRelatedResponse.ResultSet resultSet = yahoo.WebSearchRelated("YahooExample", "madonna", 10);

            StringWriter sw = new StringWriter();
            foreach (string result in resultSet.Result)
            {
                sw.WriteLine("Related Suggestion: {0}", result);
                sw.WriteLine("===============================================================");
            }

            txtResult.Text = sw.ToString();
        }