- googlesearch_demo.zip
- googleSearch
- bin
- Debug
- googleSearch.exe
- googleSearch.pdb
- Release
- googleSearch.exe
- googleSearch.csproj
- googleSearch.csproj.user
- googlesearch.glade
- googlesearch.glade.bak
- googlesearch.gladep
- googlesearch.gladep.bak
- googleSearch.sln
- googleSearch.suo
- GtkApp.cs
- obj
- Debug
- googleSearch.exe
- googleSearch.pdb
- googleSearch.projdata
- googleSearch.projdata1
- temp
- TempPE
- Web References.com.google.api.Reference.cs.dll
- Release
- googleSearch.exe
- googleSearch.projdata
- temp
- TempPE
- Web References.com.google.api.Reference.cs.dll
- Web References
- com.google.api
|
using System;
using Gtk;
using Glade;
using googleSearch.com.google.api;
namespace googleSearch
{
/// <summary>
/// Summary description for GtkApp.
/// </summary>
public class GtkApp
{
[Widget]Window mainWindow;
[Widget]Button btnSearch;
[Widget]Button btnClear;
[Widget]Entry entry1;
[Widget]TextView textview1;
/* Main Function */
public static void Main (string[] args)
{
new GtkApp (args);
}
public GtkApp(string []args)
{
Application.Init();
Glade.XML gxml = new Glade.XML (null, "googleSearch.googlesearch.glade", "mainWindow", null);
gxml.Autoconnect (this);
mainWindow.DeleteEvent+=new DeleteEventHandler(mainWindow_DeleteEvent);
btnSearch.Clicked+=new EventHandler(btnSearch_Clicked);
btnClear.Clicked+=new EventHandler(btnClear_Clicked);
Application.Run();
}
private void mainWindow_DeleteEvent(object o, DeleteEventArgs args)
{
Application.Quit ();
args.RetVal = true;
}
private void btnSearch_Clicked(object sender, EventArgs e)
{
try
{
textview1.Buffer.Text="";
//do search
GoogleSearchService svc=new GoogleSearchService();
GoogleSearchResult result=svc.doGoogleSearch("FEkTsl8kwgQtrQIeGHJDSELrTtjNcp1eC",entry1.Text,0,10,true,"",true,"","","");
foreach(ResultElement re in result.resultElements)
{
textview1.Buffer.Text+="Title: "+re.title+"\r\n";
textview1.Buffer.Text+="Summary: "+re.summary+"\r\n";
textview1.Buffer.Text+="URL: "+re.URL+"\r\n";
textview1.Buffer.Text+="==========================\r\n\r\n";
}
}
catch(Exception ex)
{
Gtk.MessageDialog md=new MessageDialog(mainWindow,Gtk.DialogFlags.Modal,Gtk.MessageType.Error,Gtk.ButtonsType.Ok,ex.Message);
md.Show();
}
}
private void btnClear_Clicked(object sender, EventArgs e)
{
textview1.Buffer.Text="";
entry1.Text="";
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Samir Kuthiala founded a Singapore based technology firm Innove Technologies Pte Ltd in 2002. Innove Technologies specialises in providing enterprise level .NET solutions to their clients.