All pastes #32023 Raw Edit

bipolar

public text v1 · immutable
#32023 ·published 2005-12-01 20:42 UTC
rendered paste body
using System;
using System.Data;
using Gtk;
using Glade;
using Gdk;
using MySql.Data;
using MySql.Data.MySqlClient;
using Mono.Data;

namespace Expector
{
	public partial class cl_mainwindow
	{
	[Glade.Widget] Gtk.Image img_logo;
	[Glade.Widget] public 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;
	
	Gtk.ListStore ls_myissues = new Gtk.ListStore (typeof(string), typeof (string), typeof (string), typeof (string), typeof (string));
	Gtk.ListStore ls_sentissues = new Gtk.ListStore (typeof(string), typeof (string), typeof (string), typeof (string), typeof (string));
	Gtk.ListStore ls_issuesforreview = new Gtk.ListStore (typeof(string), typeof (string), typeof (string), typeof (string), typeof (string));
	
		public cl_mainwindow (string[] args)
		{
			if(Expector.cl_Vars.debug == 1){Console.WriteLine(this + ".MainWindow(string[] args)");}
			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;
            
		}
		public cl_mainwindow (int number)
		{
			if(Expector.cl_Vars.debug == 1){Console.WriteLine(this + ".MainWindow(int number)");}
		}
		
		private void on_tv_myissues_row_activated (object sender, RowActivatedArgs args)
		{
			if(Expector.cl_Vars.debug == 1){Console.WriteLine(this + ".on_tv_myissues_row_activated()");}
			TreeIter iter = new TreeIter();
			TreeModel m = tv_myissues.Model;
			m.GetIter(out iter, args.Path);
			string col0 = (string)m.GetValue(iter, 0);
			Console.WriteLine(col0);
			cl_issuewindow issuewindow = new cl_issuewindow(1, col0, this);
		}
		
		private void on_tv_sentissues_row_activated (object sender, RowActivatedArgs args)
		{
			if(Expector.cl_Vars.debug == 1){Console.WriteLine(this + ".on_tv_sentissues_row_activated()");}
			TreeIter iter = new TreeIter();
			TreeModel m = tv_sentissues.Model;
			m.GetIter(out iter, args.Path);
			string col0 = (string)m.GetValue(iter, 0);
			Console.WriteLine(col0);
			cl_issuewindow issuewindow = new cl_issuewindow(2, col0, this);
		}
		
		private void on_tv_issuesforreview_row_activated (object sender, RowActivatedArgs args)
		{
			if(Expector.cl_Vars.debug == 1){Console.WriteLine(this + ".on_tv_issuesforreview_row_activated()");}
			TreeIter iter = new TreeIter();
			TreeModel m = tv_issuesforreview.Model;
			m.GetIter(out iter, args.Path);
			string col0 = (string)m.GetValue(iter, 0);
			Console.WriteLine(col0);
			cl_issuewindow issuewindow = new cl_issuewindow(3, col0, this);
		}
		
		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();
		}
		
		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();
			sqlbox.sql_window();
			
		}
		
		private void on_test_window_activate (object sender, EventArgs args)
		{
		cl_TestWindow test = new cl_TestWindow();
		test.TestWindow();
		}
		
		
	}	
	
	public class AboutDialog : Dialog
	{
        public AboutDialog (string description,
                            string [] authors, 
                            string pixResource,
                            string copyRight,
                            string version)
                            
        {
        		if (cl_Vars.debug == 1)
				{
					Console.WriteLine(this + ".AboutDialog()");
				}
                this.Title = "About";
                this.Resizable = false;
                this.Modal = true;
                
                VBox v = new VBox ();
                v.Spacing = 12;
                v.BorderWidth = 6;
                
                HBox h = new HBox ();
                h.Spacing = 6;
                v.PackStart (h);
                

                if (pixResource != null) {
                        Gdk.Pixbuf buf = new Gdk.Pixbuf (null, pixResource);
                        Gtk.Image img = new Gtk.Image ();
                        img.Pixbuf = buf;
                        h.PackStart (img);
                }

                Label l = new Label ("<span weight='bold'>" + description + "</span>");
                l.UseMarkup = true;
                h.PackEnd (l);

                v.PackEnd (new Label (copyRight));
                v.PackEnd (new Label ("Version = " + version));
                
                if (authors.Length > 0) {
                        string auth = "<span>Authors:\n";
                        foreach (String str in authors)
                                auth += "         " + str + "\n";
                        auth += "</span>";
                        l = new Label (auth);
                        l.UseMarkup = true;
                        v.PackEnd (l);
                }

                this.VBox.Add (v);
                v.ShowAll ();
                
                this.AddButton (Stock.Ok, ResponseType.Ok);
                
        }
	}
}