rendered paste bodypublic class cl_mainwindow
{
[Glade.Widget] Gtk.Image img_logo;
[Glade.Widget] Gtk.Label lbl_main;
[Glade.Widget] Gtk.Label lbl_myisseus;
[Glade.Widget] Gtk.Label lbl_sentissues;
[Glade.Widget] Gtk.Label lbl_issuesforreview;
[Glade.Widget] Gtk.TreeView tv_myissues;
[Glade.Widget] Gtk.TreeView tv_sentissues;
[Glade.Widget] Gtk.TreeView tv_issuesforreview;
public void MainWindow (string[] args)
{
if(Expector.cl_Vars.debug == 1){Console.WriteLine(this + ".MainWindow()");}
if(Expector.cl_Vars.debug == 1)
{
Console.WriteLine("Using Logo: " + cl_Vars.Logo);
}
Glade.XML gxml = new Glade.XML (null, "gui.glade", "wdw_mainwindow", null);
gxml.Autoconnect (this);
Gdk.Pixbuf buf = new Gdk.Pixbuf (null, cl_Vars.Logo);
img_logo.Pixbuf = buf;
if (cl_Vars.ConnectionString == null)
{
cl_loginwindow login = new cl_loginwindow();
login.LoginScreen();
}
else
{
cl_getdata getdata = new cl_getdata();
getdata.getmynumber(cl_Vars.UserName);
}
}
private void on_quit_item_activate (object sender, EventArgs args)
{
if(Expector.cl_Vars.debug == 1){Console.WriteLine(this + ".on_quit_item_activate()");}
Application.Quit();
}
private void OnWindowDeleteEvent (object sender, DeleteEventArgs a)
{
Application.Quit ();
a.RetVal = true;
}
private void on_quit1_activate (object sender, EventArgs args)
{
if(Expector.cl_Vars.debug == 1){Console.WriteLine(this + ".on_quit1_activate");}
Application.Quit ();
}
private void on_about1_activate (object sender, EventArgs args)
{
if(Expector.cl_Vars.debug == 1){Console.WriteLine(this + ".on_about1_activate");}
string message = "This is the next version of Expector, which will finaly replace that crappy MS Access App.";
string [] authors = {"Benjamin Long (bflong@SSCsince73.com)"};
AboutDialog dlg = new AboutDialog (message, authors, "Logo.png", "(c) Security Service Company", "2.0.a1");
dlg.Run ();
dlg.Destroy ();
}
private void on_login_activate (object sender, EventArgs args)
{
if(Expector.cl_Vars.debug == 1){Console.WriteLine(this + ".on_login_activate");}
cl_loginwindow login = new cl_loginwindow();
login.LoginScreen();
}
private void on_runtest1_activate (object sender, EventArgs args)
{
if(Expector.cl_Vars.debug == 1){Console.WriteLine(this + ".on_runtest1_activate");}
MySqlConnection myConnection = new MySqlConnection(Expector.cl_Vars.ConnectionString);
string mySelect = "SELECT * FROM testtable";
MySqlCommand myCommand = new MySqlCommand(mySelect);
myCommand.Connection = myConnection;
myConnection.Open();
myCommand.ExecuteNonQuery();
myCommand.Connection.Close();
Console.WriteLine ("Run Test Activated");
}
private void on_sql1_activate (object sender, EventArgs args)
{
cl_sqlbrowser sqlbox = new cl_sqlbrowser();
//ns_datafunctions.cl_sqlbrowser sqlbox = new ns_datafunctions.cl_sqlbrowser();
//sql_browser sqlbox = new sql_browser();
sqlbox.sql_window();
}
private void on_test_window_activate (object sender, EventArgs args)
{
cl_TestWindow test = new cl_TestWindow();
test.TestWindow();
}
public void populateissues ()
{
Gtk.TreeViewColumn col_ID = new Gtk.TreeViewColumn ();
col_ID.Title = "ID";
Gtk.TreeViewColumn col_From = new Gtk.TreeViewColumn ();
col_From.Title = "From";
Gtk.TreeViewColumn col_Subject = new Gtk.TreeViewColumn ();
col_Subject.Title = "Subject";
Gtk.TreeViewColumn col_Date = new Gtk.TreeViewColumn ();
col_Date.Title = "Date";
tv_myissues.AppendColumn (col_ID);
tv_myissues.AppendColumn (col_Date);
tv_myissues.AppendColumn (col_From);
tv_myissues.AppendColumn (col_Subject);
Gtk.ListStore ls_myissues = new Gtk.ListStore (typeof (string), typeof (string), typeof (string), typeof (string));
tv_myissues.Model = ls_myissues;
string query = "SELECT ID,Date_Opened,Issue_From,Subject FROM tbl_issues WHERE Date_Closed IS NULL AND Issue_To = '" + cl_Vars.EmployeeNumber + "';";
Console.WriteLine("ConnectionString is " + cl_Vars.ConnectionString);
Console.WriteLine("Query is " + query);
DataSet ds;
MySqlConnection myConnection = new MySqlConnection(cl_Vars.ConnectionString);
try
{
ds = MySqlHelper.ExecuteDataset(myConnection, query, null);
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
if(Expector.cl_Vars.debug == 1)
{
Console.WriteLine("Got Exception " + ex.Number);
Console.WriteLine(ex.Message);
}
return;
}
ds = MySqlHelper.ExecuteDataset(myConnection, query, null);
Console.WriteLine(ds.GetXml());
}
}