Ejemplo n.º 1
0
        void InitializeComponents()
        {
            var stream = Assembly
                .GetExecutingAssembly()
                .GetManifestResourceStream(AppController.Instance.Config.AppWindow);

            var glade = new Glade.XML(stream, AppController.Instance.Config.AppWindowName, null);
            if (stream != null)
            {
                stream.Close();
            }
            glade.Autoconnect(this);

            mNew.Activated += OnNew;
            mOpen.Activated += OnOpen;
            mSave.Activated += OnSave;
            mSaveAs.Activated += OnSaveAs;
            mQuit.Activated += OnQuit;
            mEnvironment.Activated += OnEnvironment;
            mAbout.Activated += OnAbout;
            mExportToPng.Activated += OnExportToPng;

            rbDefault.Clicked += OnVariableRadiobuttonCliecked;
            rbExisting.Clicked += OnVariableRadiobuttonCliecked;
            rbNew.Clicked += OnVariableRadiobuttonCliecked;

            rbDefault1.Clicked += OnVariableRadiobuttonCliecked1;
            rbExisting1.Clicked += OnVariableRadiobuttonCliecked1;
            rbNew1.Clicked += OnVariableRadiobuttonCliecked1;

            rbDefault2.Clicked += OnVariableRadiobuttonCliecked2;
            rbExisting2.Clicked += OnVariableRadiobuttonCliecked2;
            rbNew2.Clicked += OnVariableRadiobuttonCliecked2;

            rbDefault3.Clicked += OnVariableRadiobuttonCliecked3;
            rbExisting3.Clicked += OnVariableRadiobuttonCliecked3;
            rbNew3.Clicked += OnVariableRadiobuttonCliecked3;

            DisableProperties ();

            cbDefaultVar.Changed += OnVariableComboboxChanged;
            cbExistVar.Changed += OnVariableComboboxChanged;
            etNewVar.Changed += OnVariableComboboxChanged;

            cbDefaultVar1.Changed += OnVariableComboboxChanged;
            cbExistVar1.Changed += OnVariableComboboxChanged;
            etNewVar1.Changed += OnVariableComboboxChanged;

            cbDefaultVar2.Changed += OnVariableComboboxChanged;
            cbExistVar2.Changed += OnVariableComboboxChanged;
            etNewVar2.Changed += OnVariableComboboxChanged;

            cbDefaultVar3.Changed += OnVariableComboboxChanged;
            cbExistVar3.Changed += OnVariableComboboxChanged;
            etNewVar3.Changed += OnVariableComboboxChanged;

            cbFunction.Changed += OnFunctionChanged;
            chbOverride.Toggled += OnOverrideToggled;

            IconList = new[]{ new Gdk.Pixbuf (Assembly.GetExecutingAssembly (), AppController.Instance.Config.Icon) };
            Icon = IconList[0];

            var surfaces = AppController.Instance.GetPalette ();

            var count = (uint)surfaces.Sum (s => s.Segments.Count);
            table1 = new Table (2, count / 2, true);

            var index = 0;
            for (uint i = 0; i < count / 2; i++) {
                for (uint j = 0; j < 2; j++) {
                    if (surfaces.Count() <= index) continue;
                    var surf = surfaces [index++];
                    var el = new ElementDrawing(surf, 2, 2 );
                    table1.Attach (el, i, i+1, j, j+(uint)surf.Segments.Count());
                    el.Show ();
                }
            }

            vboxPalette.Add (table1);

            table1.SetSizeRequest (300, 100);
            table1.Show ();

            _grid = new ElementDrawing(AppController.Instance.Surface, 24, 24);

            scrolledwindow1.AddWithViewport (_grid);

            _grid.Show ();

            var arduino = AppController.Instance.GetArduino ();

            var code = new ElementDrawing(arduino[0], 2, 2 );
            tblArdulino.Attach (code, 0, 1, 0, 1);
            code.CreateCode += CController.Instance.CreateCode;
            code.Show ();
            var t = new System.Threading.Thread(() =>
            {
                System.Threading.Thread.Sleep(2000);
                UpdateHelper.CompareVersions(this);
            });
            t.Start();
        }
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void Build()
		{
			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginWindow));

			this.panel5 = new Fixed();
			//this.groupBox1 = new Gtk.Box();
			this.checkBox2 = new Gtk.CheckButton();
			this.checkBox1 = new Gtk.CheckButton();
			this.nickname_label = new Gtk.Label();
			this.nickname_ent = new Gtk.Entry();
			this.username_label = new Gtk.Label();
			this.username_ent = new Gtk.Entry();
			this.password_label = new Gtk.Label();
			this.password_ent = new Gtk.Entry();
			this.button1 = new Gtk.Button();
			this.LoginButton = new Gtk.Button();
			this.port = new Gtk.Entry();
			this.port_label = new Gtk.Label();
			this.server = new Gtk.Entry();
			this.server_label = new Gtk.Label();

			// Standard strings
			string nickName = "Guest";
			string accountName = "guest";
			string password = "******";
			bool rcmode = true;

		

			if (this.settings != null)
			{
				accountName = this.settings.Account;
				password = this.settings.Password;
				if (!this.settings2.Loaded)
					nickName = this.settings.Nickname;
				else
					nickName = this.settings2.Nickname;
				rcmode = this.settings.RCMode;
			}
			else
			{
				//return null;
			}

			// 
			// checkBox2
			// 
			this.checkBox2.Active = true;
			this.checkBox2.Name = "checkBox2";
			this.checkBox2.Label = "RC Mode?";
			this.checkBox2.Xalign = 0;
			this.checkBox2.Active = rcmode;

			// 
			// checkBox1
			//
			this.checkBox1.Active = false;
			this.checkBox1.Name = "checkBox1";
			this.checkBox1.Label = "Don\'t save password";
			this.checkBox1.Xalign = 0;
			
			// 
			// nickname_label
			// 
			this.nickname_label.Name = "nickname_label";
			this.nickname_label.Xalign = 0;
			this.nickname_label.SetSizeRequest(73, 23);
			this.nickname_label.Text = "Nickname:";

			// 
			// nickname
			// 
			this.nickname_ent.Name = "nickname";
			this.nickname_ent.Text = nickName;
			
			// 
			// username_label
			// 
			this.username_label.Name = "username_label";
			this.username_label.Xalign = 0;
			this.username_label.SetSizeRequest(73, 23);
			this.username_label.Text = "Account:";
			 
			// 
			// username
			// 
			this.username_ent.Name = "username";
			this.username_ent.Text = accountName;
			//this.username.Changed += new System.EventHandler(this.username_TextChanged);
			
			// 
			// password_label
			// 
			this.password_label.Name = "password_label";
			this.password_label.Xalign = 0;
			this.password_label.SetSizeRequest(73, 23);
			this.password_label.Text = "Password:"******"password";
			//this.password_ent.SetSizeRequest(82, 23);
			this.password_ent.Text = password;
			this.password_ent.Visibility = false;
			
			// 
			// button1
			// 
			this.button1.SetSizeRequest(80, 25);
			this.button1.Label = "Cancel";
			this.button1.Clicked += new System.EventHandler(this.Close);
			
			// 
			// LoginButton
			// 
			this.LoginButton.Name = "LoginButton";
			this.LoginButton.SetSizeRequest(80, 25);
			this.LoginButton.Label = "OK";
			this.LoginButton.Clicked += new System.EventHandler(this.LoginButton_Click);

			// 
			// LoginWindow
			// 
			Table table = new Table(2, 1, false);
			Table table2 = new Table(7, 2, false);
			table2.RowSpacing = 1;
			Label spacer = new Label();
			spacer.SetSizeRequest(10, 1);
			table2.Attach(spacer, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 5, 1);
			table2.Attach(this.nickname_label, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 5, 1);
			table2.Attach(this.nickname_ent, 1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 5, 1);
			table2.Attach(this.username_label, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, 5, 1);
			table2.Attach(this.username_ent, 1, 2, 2, 3, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 5, 1);
			table2.Attach(this.password_label, 0, 1, 3, 4, AttachOptions.Fill, AttachOptions.Fill, 5, 1);
			table2.Attach(this.password_ent, 1, 2, 3, 4, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 5, 1);
			table2.Attach(this.checkBox1, 0, 2, 4, 5, AttachOptions.Fill, AttachOptions.Fill, 5, 1);
			table2.Attach(this.checkBox2, 0, 2, 5, 6, AttachOptions.Fill, AttachOptions.Fill, 5, 1);
			HBox hbox = new HBox(true, 5);
			table.BorderWidth = 0;
			table.SetSizeRequest(100, 100);
			Frame frame = new Frame();
			frame.Label = " Options ";

			frame.Add(table2);
			table.Attach(frame, 0, 1, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 5, 5);

			hbox.Add(this.LoginButton);
			hbox.Add(this.button1);

			Alignment halign = new Alignment(1, 0, 0, 0);
			halign.Add(hbox);
			table.Attach(halign, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 5, 5);
			this.Add(table);

			this.SetSizeRequest(280, 220);
			this.DoubleBuffered = true;
			this.Name = "LoginWindow";
			this.SetPosition(Gtk.WindowPosition.Center);
			this.Title = "Graal Server Remote Control";
			this.Icon = global::Gdk.Pixbuf.LoadFromResource("OpenGraal.GraalIM.Resources.rcicon.ico");
			this.DeleteEvent += LoginWindow_Closed;
		}
		/// <summary>
		/// Required designer variable.
		/// </summary>
		//private System.ComponentModel.IContainer components = null;
		/*
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose();
		}
		*/
		#region Windows Form Designer generated code

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginWindow));

			this.checkBox2 = new Gtk.CheckButton();
			this.checkBox1 = new Gtk.CheckButton();

			this.cancelButton = new Gtk.Button();
			this.loginButton = new Gtk.Button();


			// 
			// checkBox2
			// 
			this.checkBox2.Active = true;
			this.checkBox2.Name = "checkBox2";
			this.checkBox2.Label = "Graphical Menu";
			this.checkBox2.Xalign = 0;

			// 
			// checkBox1
			//
			this.checkBox1.Active = false;
			this.checkBox1.Name = "checkBox1";
			this.checkBox1.Label = "Don\'t save password";
			this.checkBox1.Xalign = 0;
			/*
			// 
			// nickname_label
			// 
			this.nickname_label.Name = "nickname_label";
			this.nickname_label.Xalign = 0;
			this.nickname_label.SetSizeRequest(73, 23);
			this.nickname_label.Text = "Nickname:";

			// 
			// nickname
			// 
			this.nickname.Name = "nickname";
			this.nickname.Text = "Guest";
			*/
			
			// 
			// button1
			// 
			this.cancelButton.SetSizeRequest(80, 25);
			this.cancelButton.Label = "Cancel";
			this.cancelButton.Clicked += new System.EventHandler(this.Close);

			// 
			// refreshButton
			// 
			this.refreshButton = new Gtk.Button();
			this.refreshButton.Name = "refreshButton";
			this.refreshButton.SetSizeRequest(80, 25);
			this.refreshButton.Label = "Refresh";
			this.refreshButton.Clicked += new System.EventHandler(this.refreshButton_Click);

			// 
			// LoginButton
			// 
			this.loginButton.Name = "LoginButton";
			this.loginButton.SetSizeRequest(80, 25);
			this.loginButton.Label = "Connect";
			this.loginButton.Clicked += new System.EventHandler(this.loginButton_Click);

			/*
			// 
			// port
			// 
			this.port.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(123)))), ((int)(((byte)(76)))));
			this.port.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.port.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(184)))), ((int)(((byte)(142)))));
			this.port.Location = new System.Drawing.Point(215, 101);
			this.port.Margin = new System.Windows.Forms.Padding(0);
			this.port.MaximumSize = new System.Drawing.Size(50, 25);
			this.port.Name = "port";
			this.port.Size = new System.Drawing.Size(50, 21);
			this.port.TabIndex = 9;
			this.port.Text = "14922";
			this.port.TextChanged += new System.EventHandler(this.port_TextChanged);
			// 
			// port_label
			// 
			this.port_label.AutoSize = true;
			this.port_label.BackColor = System.Drawing.Color.Transparent;
			this.port_label.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(52)))), ((int)(((byte)(16)))));
			this.port_label.Location = new System.Drawing.Point(183, 101);
			this.port_label.Name = "port_label";
			this.port_label.Size = new System.Drawing.Size(29, 15);
			this.port_label.TabIndex = 8;
			this.port_label.Text = "Port";
			// 
			// server
			// 
			this.server.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(123)))), ((int)(((byte)(76)))));
			this.server.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.server.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(184)))), ((int)(((byte)(142)))));
			this.server.Location = new System.Drawing.Point(27, 119);
			this.server.Name = "server";
			this.server.Size = new System.Drawing.Size(170, 21);
			this.server.TabIndex = 7;
			this.server.Text = "listserver.graalonline.com";
			// 
			// server_label
			// 
			this.server_label.AutoSize = true;
			this.server_label.BackColor = System.Drawing.Color.Transparent;
			this.server_label.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(52)))), ((int)(((byte)(16)))));
			this.server_label.Location = new System.Drawing.Point(36, 94);
			this.server_label.Name = "server_label";
			this.server_label.Size = new System.Drawing.Size(42, 15);
			this.server_label.TabIndex = 6;
			this.server_label.Text = "Server";
			this.server_label.Click += new System.EventHandler(this.server_label_Click);
			 * 
			 */

			// 
			// ServerWindow
			// 
			Table table = new Table(2, 1, false);
			Table table2 = new Table(1, 2, false);
			table2.RowSpacing = 1;
			Label spacer = new Label();
			spacer.SetSizeRequest(10, 1);
			table2.Attach(spacer, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 5, 1);
			
			//table2.Attach(this.nickname_label, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 5, 1);
			this.logText = new Gtk.Entry();
			this.logText.SetSizeRequest(230, 230);
			this.tree = new Gtk.NodeView();
		
			this.tree.SetSizeRequest(230, 230);
			
			this.musicListStore = new Gtk.ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(int));
			//this.tree.Selection.Changed += new System.EventHandler(OnSelectionChanged);
			
			this.tree.CursorChanged += new System.EventHandler(OnSelectionChanged);
			this.tree.ButtonPressEvent += new ButtonPressEventHandler(delegate(object o, ButtonPressEventArgs args)
			{
				System.Console.WriteLine(args.ToString());
			});
			Gtk.CellRendererPixbuf pixbufrender = new Gtk.CellRendererPixbuf();
			TreeViewColumn TypeCol = this.tree.AppendColumn("", new Gtk.CellRendererPixbuf(), "pixbuf", 0);
			TypeCol.SortIndicator = true;
			TypeCol.SortColumnId = 0;
			Gtk.CellRendererPixbuf cellpb = new Gtk.CellRendererPixbuf();
			Gtk.CellRendererText cell = new Gtk.CellRendererText();
			TypeCol.PackStart(cellpb, false);
			TypeCol.PackStart(cell, false);
			
			TreeViewColumn NameCol = this.tree.AppendColumn("Name", new Gtk.CellRendererText(), "text", 1);
			NameCol.SortIndicator = true;
			NameCol.SortColumnId = 1;
			TreeViewColumn PCCol = this.tree.AppendColumn("Players", new Gtk.CellRendererText(), "text", 2);
			PCCol.SortIndicator = true;
			PCCol.SortColumnId = 2;
			
			this.tree.FixedHeightMode = false;
			this.tree.HeadersClickable = true;
			this.tree.SearchColumn = 1;
			this.tree.EnableSearch = true;
			this.tree.EnableTreeLines = true;
			this.tree.ShowExpanders = true;
			//this.tree.Vadjustment.
			musicListStore.AppendValues("", "Loading...", "");

			Gtk.Frame frame2 = new Gtk.Frame();
			this.tree.Model = musicListStore;
			
			this.GtkScrolledWindow = new global::Gtk.ScrolledWindow();
			this.GtkScrolledWindow.Name = "GtkScrolledWindow";
			this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1));

			// Container child GtkScrolledWindow.Gtk.Container+ContainerChild

			this.GtkScrolledWindow.Add(this.tree);
			frame2.Add(this.GtkScrolledWindow);
			table2.Attach(this.logText, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 5, 1);
			table2.Attach(frame2, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 5, 1);


			HBox hbox = new HBox(true, 5);
			table.BorderWidth = 0;
			table.SetSizeRequest(100, 100);
			Frame frame = new Frame();
			frame.Label = " Servers ";
			//frame.Add(new Label());
			frame.Add(table2);
			table.Attach(frame, 0, 1, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 5, 5);

			hbox.Add(this.cancelButton);
			hbox.Add(this.refreshButton);
			hbox.Add(this.loginButton);

			Alignment halign = new Alignment(1, 0, 0, 0);
			halign.Add(hbox);
			table.Attach(halign, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 5, 5);
			this.Add(table);

			this.SetSizeRequest(520, 350);

			this.DoubleBuffered = true;
			
			this.Icon = global::Gdk.Pixbuf.LoadFromResource("OpenGraal.GraalIM.Resources.rcicon.ico");

			this.Name = "ServerWindow";
			this.SetPosition(Gtk.WindowPosition.Center);
			this.Title = "Graal Servers";
			this.DeleteEvent += ServerWindow_Closed;
			this.Hidden += ServerWindow_hide;

		}