using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;


namespace RODBInterface
{
	/// <summary>
	/// Summary description for userpass.
	/// </summary>
	public class userpass : System.Windows.Forms.Form
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		private System.Windows.Forms.Label uidLbl;
		private System.Windows.Forms.Label pwLbl;
		private System.Windows.Forms.Button OKBtn;
		internal System.Windows.Forms.Button CancelBtn;
		private System.Windows.Forms.TextBox uidTxtBx;
		private System.Windows.Forms.TextBox pwTxtBx;

		//public UidPw UIDPW
		//{
		//	get
		//	{
		//		UidPw up = new UidPw();
		//		up.Password = this.pwTxtBx.Text;
		//		up.UserId = this.uidTxtBx.Text;
		//		return up;
		//	}
		//}

		public string uname=null;
		public string pword=null;
		public userpass()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		public userpass(string PassedInName)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
			uidTxtBx.Text = PassedInName;
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}
	
		#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()
		{
			this.uidTxtBx = new System.Windows.Forms.TextBox();
			this.uidLbl = new System.Windows.Forms.Label();
			this.pwLbl = new System.Windows.Forms.Label();
			this.pwTxtBx = new System.Windows.Forms.TextBox();
			this.OKBtn = new System.Windows.Forms.Button();
			this.CancelBtn = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// uidTxtBx
			// 
			this.uidTxtBx.Location = new System.Drawing.Point(8, 40);
			this.uidTxtBx.Name = "uidTxtBx";
			this.uidTxtBx.Size = new System.Drawing.Size(134, 22);
			this.uidTxtBx.TabIndex = 0;
			this.uidTxtBx.Text = "";
			this.uidTxtBx.KeyUp += new System.Windows.Forms.KeyEventHandler(this.uidTxtBx_KeyUp);
			// 
			// uidLbl
			// 
			this.uidLbl.Location = new System.Drawing.Point(16, 16);
			this.uidLbl.Name = "uidLbl";
			this.uidLbl.Size = new System.Drawing.Size(115, 18);
			this.uidLbl.TabIndex = 1;
			this.uidLbl.Text = "User ID";
			// 
			// pwLbl
			// 
			this.pwLbl.Location = new System.Drawing.Point(184, 16);
			this.pwLbl.Name = "pwLbl";
			this.pwLbl.Size = new System.Drawing.Size(86, 18);
			this.pwLbl.TabIndex = 2;
			this.pwLbl.Text = "Password";
			// 
			// pwTxtBx
			// 
			this.pwTxtBx.AcceptsTab = true;
			this.pwTxtBx.Location = new System.Drawing.Point(176, 40);
			this.pwTxtBx.Name = "pwTxtBx";
			this.pwTxtBx.PasswordChar = '*';
			this.pwTxtBx.Size = new System.Drawing.Size(125, 22);
			this.pwTxtBx.TabIndex = 3;
			this.pwTxtBx.Text = "";
			this.pwTxtBx.KeyUp += new System.Windows.Forms.KeyEventHandler(this.pwTxtBx_KeyUp);
			// 
			// OKBtn
			// 
			this.OKBtn.DialogResult = System.Windows.Forms.DialogResult.OK;
			this.OKBtn.Location = new System.Drawing.Point(336, 16);
			this.OKBtn.Name = "OKBtn";
			this.OKBtn.Size = new System.Drawing.Size(96, 28);
			this.OKBtn.TabIndex = 4;
			this.OKBtn.Text = "OK";
			this.OKBtn.Click += new System.EventHandler(this.OKBtn_Click);
			// 
			// CancelBtn
			// 
			this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.CancelBtn.Location = new System.Drawing.Point(336, 56);
			this.CancelBtn.Name = "CancelBtn";
			this.CancelBtn.Size = new System.Drawing.Size(96, 28);
			this.CancelBtn.TabIndex = 5;
			this.CancelBtn.Text = "Cancel";
			// 
			// userpass
			// 
			this.AccessibleRole = System.Windows.Forms.AccessibleRole.None;
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
			this.ClientSize = new System.Drawing.Size(448, 96);
			this.ControlBox = false;
			this.Controls.Add(this.CancelBtn);
			this.Controls.Add(this.OKBtn);
			this.Controls.Add(this.pwTxtBx);
			this.Controls.Add(this.uidTxtBx);
			this.Controls.Add(this.pwLbl);
			this.Controls.Add(this.uidLbl);
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "userpass";
			this.Text = " Login";
			this.ResumeLayout(false);

		}
		#endregion

		private void OKBtn_Click(object sender, System.EventArgs e)
		{
			uname = this.uidTxtBx.Text;
			pword = this.pwTxtBx.Text;
		}

		private void pwTxtBx_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			// if key pressed was a return - treat as ok button.
			if (e.KeyCode == Keys.Return) this.OKBtn.PerformClick();
		}

		private void uidTxtBx_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			// if key pressed was a return - treat as ok button.
			if (e.KeyCode == Keys.Return) this.OKBtn.PerformClick();
		}
	}
}
