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

namespace Minntech.Comm
{
	/// <summary>
	/// Summary description for dlgSimulatedCommPort.
	/// </summary>
	public class dlgSimulatedCommPort : System.Windows.Forms.Form
	{

		#region declarations

		#region *	custom

		private CommDevices.ICommDevice _device		  = null ;
		private Timer					_timer		  = null ;

		#endregion

		#region *	controls
		internal System.Windows.Forms.ImageList ilistOnOffImages;
		internal System.Timers.Timer timerDisplay;
		internal System.Windows.Forms.Button commandCancel;
		internal System.Windows.Forms.RadioButton optSettings;
		internal System.Windows.Forms.Label lblOnOff;
		internal System.Windows.Forms.RadioButton optControl;
		internal System.Windows.Forms.Button commandConnect;
		internal System.Windows.Forms.PictureBox picOnOff;
		internal System.Windows.Forms.Button commandApply;
		internal System.Windows.Forms.Panel pnlControl;
		internal System.Windows.Forms.TextBox txtResponse;
		internal System.Windows.Forms.Button commandWriteByte;
		internal System.Windows.Forms.Button commandWriteString;
		internal System.Windows.Forms.Label Label16;
		internal System.Windows.Forms.TextBox txtWriteByte;
		internal System.Windows.Forms.Label Label15;
		internal System.Windows.Forms.TextBox txtWriteString;
		internal System.Windows.Forms.Label Label14;
		internal System.Windows.Forms.Panel pnlSettings;
		internal System.Windows.Forms.Label Label12;
		internal System.Windows.Forms.Label Label11;
		internal System.Windows.Forms.Label Label10;
		internal System.Windows.Forms.Label Label9;
		internal System.Windows.Forms.ComboBox comboHandShake;
		internal System.Windows.Forms.ComboBox comboStopBits;
		internal System.Windows.Forms.ComboBox comboParity;
		internal System.Windows.Forms.ComboBox comboDataBits;
		internal System.Windows.Forms.ComboBox comboBaudRate;
		internal System.Windows.Forms.ComboBox comboCommPort;
		internal System.Windows.Forms.Label Label8;
		internal System.Windows.Forms.Label Label13;
		internal System.Windows.Forms.Button commandOK;
		private System.ComponentModel.IContainer components;

		#endregion

		#endregion

		#region construct/init/dispose

		public dlgSimulatedCommPort()
		{
			InitializeComponent();
			_timer = new Timer();
			_timer.Tick += new System.EventHandler(this.ManageConnectDisplay);
			_timer.Interval = 250;
			_timer.Enabled  = true;
		}
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#endregion

		#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.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(dlgSimulatedCommPort));
			this.ilistOnOffImages = new System.Windows.Forms.ImageList(this.components);
			this.timerDisplay = new System.Timers.Timer();
			this.commandCancel = new System.Windows.Forms.Button();
			this.optSettings = new System.Windows.Forms.RadioButton();
			this.lblOnOff = new System.Windows.Forms.Label();
			this.optControl = new System.Windows.Forms.RadioButton();
			this.commandConnect = new System.Windows.Forms.Button();
			this.picOnOff = new System.Windows.Forms.PictureBox();
			this.commandApply = new System.Windows.Forms.Button();
			this.pnlControl = new System.Windows.Forms.Panel();
			this.txtResponse = new System.Windows.Forms.TextBox();
			this.commandWriteByte = new System.Windows.Forms.Button();
			this.commandWriteString = new System.Windows.Forms.Button();
			this.Label16 = new System.Windows.Forms.Label();
			this.txtWriteByte = new System.Windows.Forms.TextBox();
			this.Label15 = new System.Windows.Forms.Label();
			this.txtWriteString = new System.Windows.Forms.TextBox();
			this.Label14 = new System.Windows.Forms.Label();
			this.pnlSettings = new System.Windows.Forms.Panel();
			this.Label12 = new System.Windows.Forms.Label();
			this.Label11 = new System.Windows.Forms.Label();
			this.Label10 = new System.Windows.Forms.Label();
			this.Label9 = new System.Windows.Forms.Label();
			this.comboHandShake = new System.Windows.Forms.ComboBox();
			this.comboStopBits = new System.Windows.Forms.ComboBox();
			this.comboParity = new System.Windows.Forms.ComboBox();
			this.comboDataBits = new System.Windows.Forms.ComboBox();
			this.comboBaudRate = new System.Windows.Forms.ComboBox();
			this.comboCommPort = new System.Windows.Forms.ComboBox();
			this.Label8 = new System.Windows.Forms.Label();
			this.Label13 = new System.Windows.Forms.Label();
			this.commandOK = new System.Windows.Forms.Button();
			((System.ComponentModel.ISupportInitialize)(this.timerDisplay)).BeginInit();
			this.pnlControl.SuspendLayout();
			this.pnlSettings.SuspendLayout();
			this.SuspendLayout();
			// 
			// ilistOnOffImages
			// 
			this.ilistOnOffImages.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
			this.ilistOnOffImages.ImageSize = new System.Drawing.Size(16, 16);
			this.ilistOnOffImages.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ilistOnOffImages.ImageStream")));
			this.ilistOnOffImages.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// timerDisplay
			// 
			this.timerDisplay.Enabled = true;
			this.timerDisplay.SynchronizingObject = this;
			// 
			// commandCancel
			// 
			this.commandCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
			this.commandCancel.BackColor = System.Drawing.SystemColors.Control;
			this.commandCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.commandCancel.Font = new System.Drawing.Font("Tahoma", 9F);
			this.commandCancel.Location = new System.Drawing.Point(236, 327);
			this.commandCancel.Name = "commandCancel";
			this.commandCancel.Size = new System.Drawing.Size(64, 23);
			this.commandCancel.TabIndex = 27;
			this.commandCancel.Text = "&Cancel";
			// 
			// optSettings
			// 
			this.optSettings.AllowDrop = true;
			this.optSettings.Appearance = System.Windows.Forms.Appearance.Button;
			this.optSettings.BackColor = System.Drawing.SystemColors.Desktop;
			this.optSettings.Checked = true;
			this.optSettings.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.optSettings.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.optSettings.Location = new System.Drawing.Point(4, 7);
			this.optSettings.Name = "optSettings";
			this.optSettings.Size = new System.Drawing.Size(72, 24);
			this.optSettings.TabIndex = 21;
			this.optSettings.TabStop = true;
			this.optSettings.Text = "Settings";
			this.optSettings.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// lblOnOff
			// 
			this.lblOnOff.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.lblOnOff.BackColor = System.Drawing.Color.Black;
			this.lblOnOff.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.lblOnOff.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblOnOff.ForeColor = System.Drawing.Color.Red;
			this.lblOnOff.Location = new System.Drawing.Point(300, 7);
			this.lblOnOff.Name = "lblOnOff";
			this.lblOnOff.Size = new System.Drawing.Size(64, 24);
			this.lblOnOff.TabIndex = 29;
			this.lblOnOff.Text = "Off";
			this.lblOnOff.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// optControl
			// 
			this.optControl.Appearance = System.Windows.Forms.Appearance.Button;
			this.optControl.BackColor = System.Drawing.SystemColors.Desktop;
			this.optControl.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.optControl.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.optControl.Location = new System.Drawing.Point(76, 7);
			this.optControl.Name = "optControl";
			this.optControl.Size = new System.Drawing.Size(72, 24);
			this.optControl.TabIndex = 23;
			this.optControl.Text = "Control";
			this.optControl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// commandConnect
			// 
			this.commandConnect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.commandConnect.BackColor = System.Drawing.SystemColors.Control;
			this.commandConnect.ForeColor = System.Drawing.SystemColors.ControlText;
			this.commandConnect.Location = new System.Drawing.Point(236, 7);
			this.commandConnect.Name = "commandConnect";
			this.commandConnect.Size = new System.Drawing.Size(64, 23);
			this.commandConnect.TabIndex = 25;
			this.commandConnect.Text = "Open";
			this.commandConnect.Click += new System.EventHandler(this.commandConnect_Click);
			// 
			// picOnOff
			// 
			this.picOnOff.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.picOnOff.BackColor = System.Drawing.Color.Black;
			this.picOnOff.Location = new System.Drawing.Point(316, 7);
			this.picOnOff.Name = "picOnOff";
			this.picOnOff.Size = new System.Drawing.Size(22, 20);
			this.picOnOff.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
			this.picOnOff.TabIndex = 30;
			this.picOnOff.TabStop = false;
			// 
			// commandApply
			// 
			this.commandApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
			this.commandApply.BackColor = System.Drawing.SystemColors.Control;
			this.commandApply.Enabled = false;
			this.commandApply.Font = new System.Drawing.Font("Tahoma", 9F);
			this.commandApply.Location = new System.Drawing.Point(300, 327);
			this.commandApply.Name = "commandApply";
			this.commandApply.Size = new System.Drawing.Size(64, 23);
			this.commandApply.TabIndex = 28;
			this.commandApply.Text = "&Apply";
			// 
			// pnlControl
			// 
			this.pnlControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.pnlControl.Controls.Add(this.txtResponse);
			this.pnlControl.Controls.Add(this.commandWriteByte);
			this.pnlControl.Controls.Add(this.commandWriteString);
			this.pnlControl.Controls.Add(this.Label16);
			this.pnlControl.Controls.Add(this.txtWriteByte);
			this.pnlControl.Controls.Add(this.Label15);
			this.pnlControl.Controls.Add(this.txtWriteString);
			this.pnlControl.Controls.Add(this.Label14);
			this.pnlControl.Location = new System.Drawing.Point(4, 39);
			this.pnlControl.Name = "pnlControl";
			this.pnlControl.Size = new System.Drawing.Size(360, 288);
			this.pnlControl.TabIndex = 22;
			// 
			// txtResponse
			// 
			this.txtResponse.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.txtResponse.Location = new System.Drawing.Point(8, 120);
			this.txtResponse.Multiline = true;
			this.txtResponse.Name = "txtResponse";
			this.txtResponse.Size = new System.Drawing.Size(344, 160);
			this.txtResponse.TabIndex = 4;
			this.txtResponse.Text = "";
			// 
			// commandWriteByte
			// 
			this.commandWriteByte.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.commandWriteByte.BackColor = System.Drawing.SystemColors.Control;
			this.commandWriteByte.Font = new System.Drawing.Font("Tahoma", 9F);
			this.commandWriteByte.Location = new System.Drawing.Point(312, 72);
			this.commandWriteByte.Name = "commandWriteByte";
			this.commandWriteByte.Size = new System.Drawing.Size(44, 20);
			this.commandWriteByte.TabIndex = 3;
			this.commandWriteByte.Text = "Write";
			// 
			// commandWriteString
			// 
			this.commandWriteString.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.commandWriteString.BackColor = System.Drawing.SystemColors.Control;
			this.commandWriteString.Font = new System.Drawing.Font("Tahoma", 9F);
			this.commandWriteString.Location = new System.Drawing.Point(312, 24);
			this.commandWriteString.Name = "commandWriteString";
			this.commandWriteString.Size = new System.Drawing.Size(44, 20);
			this.commandWriteString.TabIndex = 1;
			this.commandWriteString.Text = "Write";
			// 
			// Label16
			// 
			this.Label16.Location = new System.Drawing.Point(8, 104);
			this.Label16.Name = "Label16";
			this.Label16.Size = new System.Drawing.Size(336, 16);
			this.Label16.TabIndex = 4;
			this.Label16.Text = "Response";
			// 
			// txtWriteByte
			// 
			this.txtWriteByte.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.txtWriteByte.Location = new System.Drawing.Point(8, 72);
			this.txtWriteByte.MaxLength = 3;
			this.txtWriteByte.Name = "txtWriteByte";
			this.txtWriteByte.Size = new System.Drawing.Size(296, 20);
			this.txtWriteByte.TabIndex = 2;
			this.txtWriteByte.Text = "";
			// 
			// Label15
			// 
			this.Label15.Location = new System.Drawing.Point(8, 56);
			this.Label15.Name = "Label15";
			this.Label15.Size = new System.Drawing.Size(336, 16);
			this.Label15.TabIndex = 2;
			this.Label15.Text = "Write Byte (0-255)";
			// 
			// txtWriteString
			// 
			this.txtWriteString.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.txtWriteString.Location = new System.Drawing.Point(8, 24);
			this.txtWriteString.Name = "txtWriteString";
			this.txtWriteString.Size = new System.Drawing.Size(296, 20);
			this.txtWriteString.TabIndex = 0;
			this.txtWriteString.Text = "";
			// 
			// Label14
			// 
			this.Label14.Location = new System.Drawing.Point(8, 8);
			this.Label14.Name = "Label14";
			this.Label14.Size = new System.Drawing.Size(336, 16);
			this.Label14.TabIndex = 0;
			this.Label14.Text = "Write String";
			// 
			// pnlSettings
			// 
			this.pnlSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.pnlSettings.Controls.Add(this.Label12);
			this.pnlSettings.Controls.Add(this.Label11);
			this.pnlSettings.Controls.Add(this.Label10);
			this.pnlSettings.Controls.Add(this.Label9);
			this.pnlSettings.Controls.Add(this.comboHandShake);
			this.pnlSettings.Controls.Add(this.comboStopBits);
			this.pnlSettings.Controls.Add(this.comboParity);
			this.pnlSettings.Controls.Add(this.comboDataBits);
			this.pnlSettings.Controls.Add(this.comboBaudRate);
			this.pnlSettings.Controls.Add(this.comboCommPort);
			this.pnlSettings.Controls.Add(this.Label8);
			this.pnlSettings.Controls.Add(this.Label13);
			this.pnlSettings.Location = new System.Drawing.Point(4, 39);
			this.pnlSettings.Name = "pnlSettings";
			this.pnlSettings.Size = new System.Drawing.Size(360, 288);
			this.pnlSettings.TabIndex = 24;
			// 
			// Label12
			// 
			this.Label12.Location = new System.Drawing.Point(0, 192);
			this.Label12.Name = "Label12";
			this.Label12.Size = new System.Drawing.Size(360, 16);
			this.Label12.TabIndex = 10;
			this.Label12.Text = "Stop Bits";
			// 
			// Label11
			// 
			this.Label11.Location = new System.Drawing.Point(0, 146);
			this.Label11.Name = "Label11";
			this.Label11.Size = new System.Drawing.Size(360, 16);
			this.Label11.TabIndex = 9;
			this.Label11.Text = "Parity";
			// 
			// Label10
			// 
			this.Label10.Location = new System.Drawing.Point(0, 100);
			this.Label10.Name = "Label10";
			this.Label10.Size = new System.Drawing.Size(360, 16);
			this.Label10.TabIndex = 8;
			this.Label10.Text = "Data Bits";
			// 
			// Label9
			// 
			this.Label9.Location = new System.Drawing.Point(0, 54);
			this.Label9.Name = "Label9";
			this.Label9.Size = new System.Drawing.Size(360, 16);
			this.Label9.TabIndex = 7;
			this.Label9.Text = "Baud Rate";
			// 
			// comboHandShake
			// 
			this.comboHandShake.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.comboHandShake.Location = new System.Drawing.Point(0, 254);
			this.comboHandShake.Name = "comboHandShake";
			this.comboHandShake.Size = new System.Drawing.Size(360, 21);
			this.comboHandShake.TabIndex = 5;
			// 
			// comboStopBits
			// 
			this.comboStopBits.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.comboStopBits.Location = new System.Drawing.Point(0, 208);
			this.comboStopBits.Name = "comboStopBits";
			this.comboStopBits.Size = new System.Drawing.Size(360, 21);
			this.comboStopBits.TabIndex = 4;
			// 
			// comboParity
			// 
			this.comboParity.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.comboParity.Location = new System.Drawing.Point(0, 162);
			this.comboParity.Name = "comboParity";
			this.comboParity.Size = new System.Drawing.Size(360, 21);
			this.comboParity.TabIndex = 3;
			// 
			// comboDataBits
			// 
			this.comboDataBits.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.comboDataBits.Location = new System.Drawing.Point(0, 116);
			this.comboDataBits.Name = "comboDataBits";
			this.comboDataBits.Size = new System.Drawing.Size(360, 21);
			this.comboDataBits.TabIndex = 2;
			// 
			// comboBaudRate
			// 
			this.comboBaudRate.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.comboBaudRate.Location = new System.Drawing.Point(0, 70);
			this.comboBaudRate.Name = "comboBaudRate";
			this.comboBaudRate.Size = new System.Drawing.Size(360, 21);
			this.comboBaudRate.TabIndex = 1;
			// 
			// comboCommPort
			// 
			this.comboCommPort.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.comboCommPort.Location = new System.Drawing.Point(0, 24);
			this.comboCommPort.Name = "comboCommPort";
			this.comboCommPort.Size = new System.Drawing.Size(360, 21);
			this.comboCommPort.TabIndex = 0;
			// 
			// Label8
			// 
			this.Label8.Location = new System.Drawing.Point(0, 8);
			this.Label8.Name = "Label8";
			this.Label8.Size = new System.Drawing.Size(360, 16);
			this.Label8.TabIndex = 6;
			this.Label8.Text = "Comm Port";
			// 
			// Label13
			// 
			this.Label13.Location = new System.Drawing.Point(0, 238);
			this.Label13.Name = "Label13";
			this.Label13.Size = new System.Drawing.Size(360, 16);
			this.Label13.TabIndex = 11;
			this.Label13.Text = "Handshake";
			// 
			// commandOK
			// 
			this.commandOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
			this.commandOK.BackColor = System.Drawing.SystemColors.Control;
			this.commandOK.Font = new System.Drawing.Font("Tahoma", 9F);
			this.commandOK.Location = new System.Drawing.Point(164, 327);
			this.commandOK.Name = "commandOK";
			this.commandOK.Size = new System.Drawing.Size(64, 23);
			this.commandOK.TabIndex = 26;
			this.commandOK.Text = "&OK";
			// 
			// dlgSimulatedCommPort
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(368, 357);
			this.Controls.Add(this.commandCancel);
			this.Controls.Add(this.optSettings);
			this.Controls.Add(this.lblOnOff);
			this.Controls.Add(this.optControl);
			this.Controls.Add(this.commandConnect);
			this.Controls.Add(this.picOnOff);
			this.Controls.Add(this.commandApply);
			this.Controls.Add(this.commandOK);
			this.Controls.Add(this.pnlControl);
			this.Controls.Add(this.pnlSettings);
			this.Name = "dlgSimulatedCommPort";
			this.Text = "dlgSerialPort";
			((System.ComponentModel.ISupportInitialize)(this.timerDisplay)).EndInit();
			this.pnlControl.ResumeLayout(false);
			this.pnlSettings.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		//imbedded device that this form manages
		internal CommDevices.ICommDevice Device
		{
			get { return this._device; }
			set 
			{
				try
				{

					this._device = value;
					ManageConnectDisplay(this, null);
				}
				catch ( Exception SerialEx )
				{
					MessageBox.Show(this._device.Settings.Device.ToString() + " reports exception opening in Manager form: " + SerialEx.Message);
				}
			}
		}

		private void ManageConnectDisplay(object sender, EventArgs e)
		{

			if ( ( this._device != null ) && this._device.IsOpen )
			{
				this.lblOnOff.Text		= "On";
				this.lblOnOff.ForeColor	= Color.Lime;
				this.commandConnect.Text= "Close";
			}
			else
			{
				this.lblOnOff.Text		= "Off";
				this.lblOnOff.ForeColor = Color.Red;
				this.commandConnect.Text= "Open";
			}
		}

		private void commandConnect_Click(object sender, System.EventArgs e)
		{
			if ( this._device != null )
			{
				if ( this._device.IsOpen )
					this._device.CloseCommPort();
				else
					this._device.OpenCommPort();				
			}
		}
	}
}
