protected override void ProcessRecord()
        {
            switch (this.ParameterSetName)
            {
            case "Search":
                WriteVerbose(String.Format(@"Searching for ""{0}""", this.Query));
                s_results = new List <GoogleResult>();
                IList <IWebResult> results = GwebSearcher.Search(this.Query, this.MaxResults);
                if (results.Count == 0)
                {
                    WriteWarning("No results found.");
                }
                else
                {
                    foreach (IWebResult result in results)
                    {
                        GoogleResult googleResult = new GoogleResult(s_resultIndex++, result);
                        WriteObject(googleResult);
                        s_results.Add(googleResult);
                    }
                }
                break;

            case "GotoResult":
                foreach (GoogleResult googleResult in s_results)
                {
                    if (googleResult.Index == this.GotoResult)
                    {
                        Help.ShowHelp(null, googleResult.Url);
                        return;
                    }
                }
                throw new Exception(String.Format("Result index {0} not available", this.GotoResult));
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Google.API.Language.Turkish.ToString();
            IList <IWebResult> ListGoogle = GwebSearcher.Search(textBox.Text, 5);

            foreach (Google.API.Search.IWebResult result in ListGoogle)
            {
                listBox1.Items.Add(result.Title);
                listBox2.Items.Add(result.Url);
                listBox3.Items.Add(result.Content);
                listBox4.Items.Add(result.VisibleUrl);
            }
        }