using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using QC.MMI.MMI_PCBA_Tester_Control;

namespace TableApi;

public class Form1 : Form
{
	private string msg = "";

	private string FilePathName = "";

	private string[] Z_items = new string[2] { "Z1", "Z2" };

	private bool initializing = true;

	public int controlType;

	public int setValue = 1;

	public string control_item = "";

	public USB_IO_Expander myIO = new USB_IO_Expander();

	public string[] single_ctl_list = new string[29]
	{
		"AN_BLUE_DET", "AN_GRN_DET", "AN_RED_DET", "AN_LIGHT_DET1", "AN_LIGHT_DET2", "AN_VIBE_DET", "AUDIO_IN_RLY_A0", "AUDIO_IN_RLY_A1", "AUDIO_IN_RLY_A2", "AUDIO_RLY_EN",
		"AUDIO_OUT_RLY_A0", "AUDIO_OUT_RLY_A1", "AUDIO_OUT_RLY_A2", "CTP_touch", "OTG_VBUS_STAT", "PHOT_LED1", "RLY_CTP", "RLY_HS_DETECT", "RLY_OTG_EN", "RLY_POGO_AMP_N",
		"RLY_SINE_OUT", "RLY_SOLENOID_PWRON", "RLY_SOLENOID_VOL_DN", "RLY_SOLENOID_VOL_UP", "TESTER_ID0", "TESTER_ID1", "TESTER_ID2", "TONE_DET_N", "VBAT_EN_N"
	};

	private xyTable tbl;

	private List<string> buttonNames = new List<string>();

	private IContainer components;

	private ListBox listBox1;

	private MenuStrip menuStrip1;

	private TextBox TextBox_X;

	private Label label1;

	private TextBox TextBox_Y;

	private Label label2;

	private TextBox TextBox_Z;

	private Label label3;

	private ContextMenuStrip contextMenuStrip1;

	private TextBox TextBox_OffsetX;

	private Label label4;

	private TextBox TextBox_OffsetY;

	private Label label5;

	private Label label6;

	private ToolStripMenuItem fileToolStripMenuItem;

	private ToolStripMenuItem openToolStripMenuItem;

	private OpenFileDialog openFileDialog1;

	private GroupBox groupBox1;

	private CheckBox enableOffset1;

	private Button button5;

	private GroupBox groupBox2;

	private Button ZAxisGoTo;

	private Button RetractAllButton;

	private ComboBox comboBox1;

	private Label label18;

	private Label label9;

	private Label LabelComPort;

	private TextBox textBox_TestID;

	private TextBox textBoxComPort;

	private TextBox textBox_DutName;

	private Label label7;

	private TextBox textBox_PartNum;

	private Label label8;

	private TextBox textBox_Z1max;

	private Label label10;

	private TextBox textBox_Z2max;

	private Label label11;

	private TextBox textBox_KOutX1;

	private Label label12;

	private TextBox textBox_KOutX2;

	private Label label13;

	private TextBox textBox_KOY1;

	private Label label14;

	private TextBox textBox_KOY2;

	private Label label15;

	private TextBox textBox_GlobalXoffset;

	private Label label16;

	private TextBox textBox_GlobalYoffset;

	private Label label17;

	private GroupBox groupBox3;

	private Button ReloadConfigFile;

	private ToolStripMenuItem saveSettingsToolStripMenuItem;

	private ToolStripMenuItem saveSettingsAsToolStripMenuItem;

	private SaveFileDialog saveFileDialog1;

	private Button GoHomeButton;

	private Button PortReleaseButton;

	private Button ConnectPortbutton;

	private Button XincButton;

	private Button XdecButton;

	private Button button1;

	private Button button2;

	private Button XoffDecButton;

	private Button YincButton;

	private Button YdecButton;

	private Button button3;

	private Button ZdecButton;

	private Button xOffIncButton;

	private Label label20;

	private Label label19;

	private TextBox Textbox_GlobalZ2Offset;

	private TextBox Textbox_GlobalZ1Offset;

	private CheckBox ChkBxMoveOK;

	private StatusStrip statusStrip1;

	private ToolStripStatusLabel toolStripStatusLabel1;

	private ToolStripStatusLabel toolStripStatusLabel2;

	private Button PowerButton;

	private Button button4;

	public Form1()
	{
		InitializeComponent();
		tbl = new xyTable();
	}

	public void Form1_Load()
	{
	}

	public void InitWithConfig()
	{
		bool flag = true;
		initializing = true;
		if (!tbl.OpenUserDefConfigFile(ref msg))
		{
			MessageBox.Show(msg);
			return;
		}
		toolStripStatusLabel1.Text = "File: " + FilePathName;
		buttonNames = tbl.GetButtonItemNames();
		comboBox1.DataSource = Z_items;
		InitListBox();
		InitSetupItems();
		InitZcomboBox();
		tbl.ClosePort();
		if (!tbl.ControllerPortOk())
		{
			if (!XYConnect())
			{
				return;
			}
			if (!tbl.ControllerPortOk())
			{
				textBoxComPort.BackColor = Color.Pink;
				MessageBox.Show("Could not connect to XY Table Controller COM port \"" + textBoxComPort.Text + "\" ");
				return;
			}
		}
		textBoxComPort.BackColor = Color.White;
		Update();
		initializing = false;
		tbl.zRetractAll();
		tbl.MoveXYHome();
	}

	public void InitListBox()
	{
		listBox1.DataSource = buttonNames;
	}

	public void InitSetupItems()
	{
		string text = "";
		textBoxComPort.Text = tbl.getStringConfigItemValue(Enum.GetName(typeof(xySETUP), xySETUP.comPortName), ref text);
		textBox_TestID.Text = tbl.getStringConfigItemValue(Enum.GetName(typeof(xySETUP), xySETUP.id), ref text);
		textBox_DutName.Text = tbl.getStringConfigItemValue(Enum.GetName(typeof(xySETUP), xySETUP.name), ref text);
		textBox_PartNum.Text = tbl.getStringConfigItemValue(Enum.GetName(typeof(xySETUP), xySETUP.prtnum), ref text);
		textBox_Z1max.Text = tbl.getStringConfigItemValue(Enum.GetName(typeof(xySETUP), xySETUP.Zphone), ref text);
		textBox_Z2max.Text = tbl.getStringConfigItemValue(Enum.GetName(typeof(xySETUP), xySETUP.Zmax), ref text);
		textBox_KOutX1.Text = tbl.getStringConfigItemValue(Enum.GetName(typeof(xySETUP), xySETUP.Q1KEEPOUTX1), ref text);
		textBox_KOutX2.Text = tbl.getStringConfigItemValue(Enum.GetName(typeof(xySETUP), xySETUP.Q1KEEPOUTX2), ref text);
		textBox_KOY1.Text = tbl.getStringConfigItemValue(Enum.GetName(typeof(xySETUP), xySETUP.Q1KEEPOUTY1), ref text);
		textBox_KOY2.Text = tbl.getStringConfigItemValue(Enum.GetName(typeof(xySETUP), xySETUP.Q1KEEPOUTY2), ref text);
		textBox_GlobalXoffset.Text = tbl.getStringConfigItemValue(Enum.GetName(typeof(xySETUP), xySETUP.XrefOffset), ref text);
		textBox_GlobalYoffset.Text = tbl.getStringConfigItemValue(Enum.GetName(typeof(xySETUP), xySETUP.YrefOffset), ref text);
		Textbox_GlobalZ1Offset.Text = tbl.getStringConfigItemValue(Enum.GetName(typeof(xySETUP), xySETUP.Z1GlobalOffset), ref text);
		Textbox_GlobalZ2Offset.Text = tbl.getStringConfigItemValue(Enum.GetName(typeof(xySETUP), xySETUP.Z2GlobalOffset), ref text);
	}

	public zACT GetZEnum(string strZact)
	{
		if (strZact.ToUpper() == "Z1")
		{
			return zACT.TOUCH;
		}
		if (strZact.ToUpper() == "Z2")
		{
			return zACT.LEVERPRESS;
		}
		MessageBox.Show("Z actuator selected is unknown");
		return zACT.TOUCH;
	}

	private void button1_Click(object sender, EventArgs e)
	{
		double newNum = 0.0;
		string text = "";
		if (enableOffset1.Checked)
		{
			text = TextBox_OffsetY.Text;
			if (GetDouble(text, ref newNum))
			{
				newNum += 50.0;
				TextBox_OffsetY.Text = newNum.ToString();
				SetValueandMove();
			}
		}
	}

	private void openToolStripMenuItem_Click(object sender, EventArgs e)
	{
		string text = "C:\\Program Files (x86)\\Qualcomm\\QDART\\Databases";
		if (Directory.Exists(text))
		{
			openFileDialog1.InitialDirectory = text;
		}
		openFileDialog1.FileName = "";
		openFileDialog1.Filter = "Config Files |*.cfg|Text Files |*.txt";
		DialogResult dialogResult = openFileDialog1.ShowDialog();
		if (dialogResult == DialogResult.OK)
		{
			FilePathName = openFileDialog1.FileName;
			tbl.xyTableCfgFullPath = FilePathName;
			toolStripStatusLabel1.Text = "File: " + FilePathName;
			InitWithConfig();
		}
	}

	private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
	{
		int selectedIndex = listBox1.SelectedIndex;
		string itemText = listBox1.GetItemText(listBox1.Items[selectedIndex]);
		tbl.bc = tbl.GetButtonValues(itemText);
		TextBox_X.Text = tbl.bc.GridX;
		TextBox_Y.Text = tbl.bc.GridY;
		TextBox_OffsetX.Text = tbl.bc.OffsetX;
		TextBox_OffsetY.Text = tbl.bc.OffsetY;
		TextBox_Z.Text = tbl.bc.Zmax;
		InitZcomboBox();
	}

	private void InitZcomboBox()
	{
		comboBox1.SelectedIndex = comboBox1.FindStringExact(tbl.bc.Type);
	}

	private void lineShape1_Click(object sender, EventArgs e)
	{
	}

	private void checkBox1_CheckedChanged(object sender, EventArgs e)
	{
	}

	private void button4_Click(object sender, EventArgs e)
	{
	}

	private void button2_Click(object sender, EventArgs e)
	{
		double newNum = 0.0;
		string text = "";
		if (!enableOffset1.Checked)
		{
			return;
		}
		text = TextBox_OffsetY.Text;
		if (GetDouble(text, ref newNum))
		{
			newNum -= 50.0;
			if (newNum < 0.0)
			{
				newNum = 0.0;
			}
			TextBox_OffsetY.Text = newNum.ToString();
			SetValueandMove();
		}
	}

	private void button3_Click(object sender, EventArgs e)
	{
	}

	private void button5_Click(object sender, EventArgs e)
	{
		string text = "";
		bool moveWhileDownOK = false;
		if (!tbl.ControllerPortOk() && !XYConnect())
		{
			return;
		}
		bool useOffset = false;
		ValidateChildren();
		if (enableOffset1.Checked)
		{
			useOffset = true;
		}
		if (tbl.bc != null)
		{
			tbl.bc.GridX = TextBox_X.Text;
			tbl.bc.GridY = TextBox_Y.Text;
			tbl.bc.OffsetX = TextBox_OffsetX.Text;
			tbl.bc.OffsetY = TextBox_OffsetY.Text;
			tbl.bc.Zmax = TextBox_Z.Text;
			tbl.bc.Type = comboBox1.Text;
			tbl.SetButtonValues(tbl.bc);
			string name = tbl.bc.Name;
			if (enableOffset1.Checked)
			{
				useOffset = true;
			}
			if (ChkBxMoveOK.Checked)
			{
				moveWhileDownOK = true;
			}
			tbl.WaitForCmd = false;
			if (!tbl.MoveToXY(name, useOffset, ref text, moveDiagnal: false, moveWhileDownOK))
			{
				MessageBox.Show(text);
			}
		}
	}

	public void MoveHome()
	{
		tbl.MoveXYHome();
	}

	public bool XYConnect()
	{
		if (!tbl.Connect())
		{
			textBoxComPort.BackColor = Color.Pink;
			MessageBox.Show("Could not connect to XY Table Controller COM port \"" + textBoxComPort.Text + "\" ");
			return false;
		}
		textBoxComPort.BackColor = Color.White;
		return true;
	}

	private void ZAxisGoTo_Click(object sender, EventArgs e)
	{
		int selectedIndex = listBox1.SelectedIndex;
		string itemText = listBox1.GetItemText(listBox1.Items[selectedIndex]);
		if (tbl.ControllerPortOk() || XYConnect())
		{
			ValidateChildren();
			string strZact = comboBox1.Text;
			zACT zEnum = GetZEnum(strZact);
			if (!tbl.zUpDown(zEnum, TextBox_Z.Text, down: true))
			{
				MessageBox.Show("Error in send command for Z actuator.");
			}
		}
	}

	private void SetXY_Click(object sender, EventArgs e)
	{
		if (!checkIsNumeric(TextBox_X.Text))
		{
			TextBox_X.Text = "";
			MessageBox.Show("The X Location must be numeric");
		}
		else
		{
			tbl.bc.GridX = TextBox_X.Text;
			tbl.SetButtonValues(tbl.bc);
		}
		if (!checkIsNumeric(TextBox_Y.Text))
		{
			MessageBox.Show("The Y Location must be numeric");
		}
		else
		{
			tbl.bc.GridY = TextBox_Y.Text;
			tbl.SetButtonValues(tbl.bc);
		}
		if (!checkIsNumeric(TextBox_OffsetX.Text))
		{
			MessageBox.Show("The X Offset Location must be numeric");
		}
		else
		{
			tbl.bc.OffsetX = TextBox_OffsetX.Text;
			tbl.SetButtonValues(tbl.bc);
		}
		if (!checkIsNumeric(TextBox_OffsetY.Text))
		{
			MessageBox.Show("The Y Offset Location must be numeric");
			return;
		}
		tbl.bc.OffsetY = TextBox_OffsetY.Text;
		tbl.SetButtonValues(tbl.bc);
	}

	private bool checkIsNumeric(string numericText)
	{
		double result = 0.0;
		if (!double.TryParse(numericText, out result))
		{
			return false;
		}
		return true;
	}

	private bool checkLimitOk(string numericText, string limit)
	{
		double result = 0.0;
		double result2 = 0.0;
		if (!double.TryParse(numericText, out result))
		{
			return false;
		}
		if (!double.TryParse(limit, out result2))
		{
			return false;
		}
		if (result2 <= result)
		{
			return false;
		}
		return true;
	}

	private void RetractAllButton_Click(object sender, EventArgs e)
	{
		if ((tbl.ControllerPortOk() || XYConnect()) && !tbl.zRetractAll())
		{
			MessageBox.Show("Error in send command for zRetractAll(). COM port may not be connected.");
		}
	}

	private void SetZ_Click(object sender, EventArgs e)
	{
		_ = comboBox1.Text;
		tbl.bc.Type = comboBox1.Text;
		if (!checkIsNumeric(TextBox_Z.Text))
		{
			MessageBox.Show("The Z Location must be numeric");
			return;
		}
		tbl.bc.Zmax = TextBox_Z.Text;
		tbl.SetButtonValues(tbl.bc);
	}

	private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
	{
		if (!initializing)
		{
			tbl.bc.Type = comboBox1.Text;
			tbl.SetButtonValues(tbl.bc);
		}
	}

	private void textBox5_TextChanged(object sender, EventArgs e)
	{
	}

	private void textBox5_Validating(object sender, CancelEventArgs e)
	{
		tbl.UpdateSetupItem(xySETUP.id, textBox_TestID.Text);
	}

	private void label15_Click(object sender, EventArgs e)
	{
	}

	private void textBoxComPort_Validating(object sender, CancelEventArgs e)
	{
		tbl.UpdateSetupItem(xySETUP.comPortName, textBoxComPort.Text);
	}

	private void textBox_GlobalYoffset_TextChanged(object sender, EventArgs e)
	{
	}

	private void textBox_GlobalYoffset_Validating(object sender, CancelEventArgs e)
	{
		if (!checkIsNumeric(textBox_GlobalYoffset.Text))
		{
			MessageBox.Show("Entry must be numeric.");
			textBox_GlobalYoffset.Text = "";
			textBox_GlobalYoffset.Focus();
		}
		else
		{
			tbl.UpdateSetupItem(xySETUP.YrefOffset, textBox_GlobalYoffset.Text);
		}
	}

	private void textBox_Z1max_TextChanged(object sender, EventArgs e)
	{
	}

	private void textBox_Z1max_Validating(object sender, CancelEventArgs e)
	{
		if (!checkIsNumeric(textBox_Z1max.Text))
		{
			MessageBox.Show("Entry must be numeric.");
			textBox_Z1max.Text = "";
			textBox_Z1max.Focus();
		}
		else
		{
			tbl.UpdateSetupItem(xySETUP.Zphone, textBox_Z1max.Text);
		}
	}

	private void textBox_Z2max_TextChanged(object sender, EventArgs e)
	{
	}

	private void textBox_Z2max_Validating(object sender, CancelEventArgs e)
	{
		if (!checkIsNumeric(textBox_Z2max.Text))
		{
			MessageBox.Show("Entry must be numeric.");
			textBox_Z2max.Text = "";
			textBox_Z2max.Focus();
		}
		else
		{
			tbl.UpdateSetupItem(xySETUP.Zmax, textBox_Z2max.Text);
		}
	}

	private void textBox_KOutX1_TextChanged(object sender, EventArgs e)
	{
	}

	private void textBox_KOutX1_Validating(object sender, CancelEventArgs e)
	{
		if (!checkIsNumeric(textBox_KOutX1.Text))
		{
			MessageBox.Show("Entry must be numeric.");
			textBox_KOutX1.Text = "";
			textBox_KOutX1.Focus();
		}
		else
		{
			tbl.UpdateSetupItem(xySETUP.Q1KEEPOUTX1, textBox_KOutX1.Text);
		}
	}

	private void textBox_KOutX2_TextChanged(object sender, EventArgs e)
	{
	}

	private void textBox_KOutX2_Validating(object sender, CancelEventArgs e)
	{
		if (!checkIsNumeric(textBox_KOutX2.Text))
		{
			MessageBox.Show("Entry must be numeric.");
			textBox_KOutX2.Text = "";
			textBox_KOutX2.Focus();
		}
		else
		{
			tbl.UpdateSetupItem(xySETUP.Q1KEEPOUTX2, textBox_KOutX2.Text);
		}
	}

	private void textBox_KOY1_TextChanged(object sender, EventArgs e)
	{
	}

	private void textBox_KOY1_Validating(object sender, CancelEventArgs e)
	{
		if (!checkIsNumeric(textBox_KOY1.Text))
		{
			MessageBox.Show("Entry must be numeric.");
			textBox_KOY1.Text = "";
			textBox_KOY1.Focus();
		}
		else
		{
			tbl.UpdateSetupItem(xySETUP.Q1KEEPOUTY1, textBox_KOY1.Text);
		}
	}

	private void textBox_KOY2_TextChanged(object sender, EventArgs e)
	{
	}

	private void textBox_KOY2_Validating(object sender, CancelEventArgs e)
	{
		if (!checkIsNumeric(textBox_KOY2.Text))
		{
			MessageBox.Show("Entry must be numeric.");
			textBox_KOY2.Text = "";
			textBox_KOY2.Focus();
		}
		else
		{
			tbl.UpdateSetupItem(xySETUP.Q1KEEPOUTY2, textBox_KOY2.Text);
		}
	}

	private void textBox_GlobalXoffset_TextChanged(object sender, EventArgs e)
	{
	}

	private void textBox_GlobalXoffset_Validating(object sender, CancelEventArgs e)
	{
		if (!checkIsNumeric(textBox_GlobalXoffset.Text))
		{
			MessageBox.Show("Entry must be numeric.");
			textBox_GlobalXoffset.Text = "";
			textBox_GlobalXoffset.Focus();
		}
		else
		{
			tbl.UpdateSetupItem(xySETUP.XrefOffset, textBox_GlobalXoffset.Text);
		}
	}

	private void SaveSetupItems_Click(object sender, EventArgs e)
	{
	}

	private void textBox_DutName_TextChanged(object sender, EventArgs e)
	{
	}

	private void textBox_DutName_Validating(object sender, CancelEventArgs e)
	{
		tbl.UpdateSetupItem(xySETUP.name, textBox_DutName.Text);
	}

	private void textBox_PartNum_TextChanged(object sender, EventArgs e)
	{
	}

	private void textBox_PartNum_Validating(object sender, CancelEventArgs e)
	{
		tbl.UpdateSetupItem(xySETUP.prtnum, textBox_PartNum.Text);
	}

	private void ReloadConfigFile_Click(object sender, EventArgs e)
	{
		tbl.OpenUserDefConfigFile(ref msg);
		toolStripStatusLabel1.Text = "File: " + FilePathName;
		InitWithConfig();
	}

	private void TextBox_X_TextChanged(object sender, EventArgs e)
	{
	}

	private void TextBox_X_Validating(object sender, CancelEventArgs e)
	{
		if (!checkIsNumeric(TextBox_X.Text))
		{
			TextBox_X.Text = "";
			MessageBox.Show("The X Location must be numeric");
		}
		else if (tbl.bc != null)
		{
			tbl.bc.GridX = TextBox_X.Text;
			tbl.SetButtonValues(tbl.bc);
		}
	}

	private void TextBox_Y_TextChanged(object sender, EventArgs e)
	{
	}

	private void TextBox_Y_Validating(object sender, CancelEventArgs e)
	{
		if (!checkIsNumeric(TextBox_Y.Text))
		{
			TextBox_Y.Text = "";
			MessageBox.Show("The Y Location must be numeric");
		}
		else if (tbl.bc != null)
		{
			tbl.bc.GridY = TextBox_Y.Text;
			tbl.SetButtonValues(tbl.bc);
		}
	}

	private void TextBox_OffsetX_TextChanged(object sender, EventArgs e)
	{
	}

	private void TextBox_OffsetX_Validating(object sender, CancelEventArgs e)
	{
		if (!checkIsNumeric(TextBox_OffsetX.Text))
		{
			TextBox_OffsetX.Text = "";
			MessageBox.Show("The X Offset Location must be numeric");
		}
		else if (tbl.bc != null)
		{
			tbl.bc.OffsetX = TextBox_OffsetX.Text;
			tbl.SetButtonValues(tbl.bc);
		}
	}

	private void TextBox_OffsetY_Validating(object sender, CancelEventArgs e)
	{
		if (!checkIsNumeric(TextBox_OffsetY.Text))
		{
			TextBox_OffsetY.Text = "";
			MessageBox.Show("The Y Offset Location must be numeric");
		}
		else if (tbl.bc != null)
		{
			tbl.bc.OffsetY = TextBox_OffsetY.Text;
			tbl.SetButtonValues(tbl.bc);
		}
	}

	private void TextBox_Z_TextChanged(object sender, EventArgs e)
	{
	}

	private void TextBox_Z_Validating(object sender, CancelEventArgs e)
	{
		string text = comboBox1.Text;
		string limit = "";
		if (text == "")
		{
			MessageBox.Show("The 'Actuator' box is not initialized. There must be an actuator selected or load the config file");
			return;
		}
		if (tbl.bc != null)
		{
			tbl.bc.Type = comboBox1.Text;
		}
		if (!checkIsNumeric(TextBox_Z.Text))
		{
			TextBox_Z.Text = "";
			MessageBox.Show("The Z Location must be numeric");
			return;
		}
		if (comboBox1.Text == "Z1")
		{
			limit = textBox_Z1max.Text;
		}
		else if (comboBox1.Text == "Z2")
		{
			limit = textBox_Z2max.Text;
		}
		if (!checkLimitOk(TextBox_Z.Text, limit))
		{
			DialogResult dialogResult = MessageBox.Show("The actuator value entered exceeds the Z max limit. Do you wish to override this?", "Limit Check", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
			if (dialogResult == DialogResult.No)
			{
				return;
			}
		}
		if (tbl.bc != null)
		{
			tbl.bc.Zmax = TextBox_Z.Text;
			tbl.SetButtonValues(tbl.bc);
		}
	}

	private void button1_Click_1(object sender, EventArgs e)
	{
	}

	private void SaveConfigSettings()
	{
		string text = "";
		Path.GetFileName(FilePathName);
		if (FilePathName != "")
		{
			if (!tbl.SaveConfigFile("", ref text))
			{
				MessageBox.Show(text);
				return;
			}
			toolStripStatusLabel1.Text = "File: " + FilePathName;
			MessageBox.Show("File saved successfully.");
		}
		else
		{
			MessageBox.Show("Error in file name.");
		}
	}

	private bool GetDouble(string numToConvert, ref double newNum)
	{
		if (!double.TryParse(numToConvert, out newNum))
		{
			return false;
		}
		return true;
	}

	private void SaveSettingsAs()
	{
		saveFileDialog1.Filter = "QTI_ Files|  QTI_* .cfg | QTI_ Files| QTI_*.txt";
		if (saveFileDialog1.ShowDialog() != DialogResult.OK)
		{
			return;
		}
		string text = "";
		string text2 = saveFileDialog1.FileName;
		string fileName = Path.GetFileName(text2);
		string text3 = "";
		if (!fileName.ToUpper().StartsWith("QTI_"))
		{
			text3 = "QTI_" + fileName;
			text2 = text2.Replace(fileName, text3);
		}
		if (FilePathName != "")
		{
			if (!tbl.SaveConfigFile(text2, ref text))
			{
				MessageBox.Show(text);
				return;
			}
			FilePathName = text2;
			text2 = "";
			toolStripStatusLabel1.Text = "File: " + FilePathName;
			MessageBox.Show("File saved successfully.");
		}
	}

	private void saveSettingsToolStripMenuItem_Click(object sender, EventArgs e)
	{
		if (textBoxComPort.Text == "")
		{
			MessageBox.Show("ComPort can't be empty!");
			return;
		}
		ValidateChildren();
		SaveConfigSettings();
	}

	private void textBoxComPort_TextChanged(object sender, EventArgs e)
	{
	}

	private void saveSettingsAsToolStripMenuItem_Click(object sender, EventArgs e)
	{
		if (textBoxComPort.Text == "")
		{
			MessageBox.Show("ComPort can't be empty!");
		}
		else
		{
			SaveSettingsAs();
		}
	}

	private void GoHomeButton_Click(object sender, EventArgs e)
	{
		if (!tbl.ControllerPortOk())
		{
			XYConnect();
		}
		else
		{
			MoveHome();
		}
	}

	private void SaveButton_Click(object sender, EventArgs e)
	{
		tbl.xyTableCfgFullPath = FilePathName;
		SaveConfigSettings();
		tbl.OpenUserDefConfigFile(ref msg);
	}

	private void PortReleaseButton_Click(object sender, EventArgs e)
	{
		if (tbl.ControllerPortOk())
		{
			tbl.ClosePort();
			textBoxComPort.BackColor = Color.Pink;
		}
	}

	private void LabelComPort_Click(object sender, EventArgs e)
	{
	}

	private void ConnectPortbutton_Click(object sender, EventArgs e)
	{
		tbl.ClosePort();
		if (!tbl.ControllerPortOk() && XYConnect() && !tbl.ControllerPortOk())
		{
			textBoxComPort.BackColor = Color.Pink;
			MessageBox.Show("Could not connect to XY Table Controller COM port \"" + textBoxComPort.Text + "\" ");
		}
	}

	private void XdecButton_Click(object sender, EventArgs e)
	{
		double newNum = 0.0;
		string text = "";
		text = TextBox_X.Text;
		if (GetDouble(text, ref newNum))
		{
			newNum -= 50.0;
			if (newNum < 0.0)
			{
				newNum = 0.0;
			}
			TextBox_X.Text = newNum.ToString();
			SetValueandMove();
		}
	}

	private void SetValueandMove()
	{
		if (!tbl.ControllerPortOk() && !XYConnect())
		{
			return;
		}
		bool useOffset = false;
		ValidateChildren();
		if (enableOffset1.Checked)
		{
			useOffset = true;
		}
		if (tbl.bc != null)
		{
			tbl.bc.GridX = TextBox_X.Text;
			tbl.bc.GridY = TextBox_Y.Text;
			tbl.bc.OffsetX = TextBox_OffsetX.Text;
			tbl.bc.OffsetY = TextBox_OffsetY.Text;
			tbl.bc.Zmax = TextBox_Z.Text;
			tbl.bc.Type = comboBox1.Text;
			tbl.SetButtonValues(tbl.bc);
			string name = tbl.bc.Name;
			if (enableOffset1.Checked)
			{
				useOffset = true;
			}
			tbl.WaitForCmd = false;
			if (!tbl.MoveToXY(name, useOffset, ref msg, moveDiagnal: false, moveWhileDownOK: false))
			{
				MessageBox.Show(msg);
			}
		}
	}

	private void XincButton_Click(object sender, EventArgs e)
	{
		double newNum = 0.0;
		string text = "";
		text = TextBox_X.Text;
		if (GetDouble(text, ref newNum))
		{
			newNum += 50.0;
			if (newNum < 0.0)
			{
				newNum = 0.0;
			}
			TextBox_X.Text = newNum.ToString();
			SetValueandMove();
		}
	}

	private void YdecButton_Click(object sender, EventArgs e)
	{
		double newNum = 0.0;
		string text = "";
		text = TextBox_Y.Text;
		if (GetDouble(text, ref newNum))
		{
			newNum -= 50.0;
			if (newNum < 0.0)
			{
				newNum = 0.0;
			}
			TextBox_Y.Text = newNum.ToString();
			SetValueandMove();
		}
	}

	private void YincButton_Click(object sender, EventArgs e)
	{
		double newNum = 0.0;
		string text = "";
		text = TextBox_Y.Text;
		if (GetDouble(text, ref newNum))
		{
			newNum += 50.0;
			if (newNum < 0.0)
			{
				newNum = 0.0;
			}
			TextBox_Y.Text = newNum.ToString();
			SetValueandMove();
		}
	}

	private void XoffDecButton_Click(object sender, EventArgs e)
	{
		double newNum = 0.0;
		string text = "";
		if (enableOffset1.Checked)
		{
			text = TextBox_OffsetX.Text;
			if (GetDouble(text, ref newNum))
			{
				newNum -= 50.0;
				TextBox_OffsetX.Text = newNum.ToString();
				SetValueandMove();
			}
		}
	}

	private void TextBox_OffsetY_TextChanged(object sender, EventArgs e)
	{
	}

	private void button4_Click_1(object sender, EventArgs e)
	{
		double newNum = 0.0;
		string text = "";
		if (tbl.bc == null)
		{
			return;
		}
		text = TextBox_Z.Text;
		if (GetDouble(text, ref newNum))
		{
			newNum -= 25.0;
			if (newNum < 0.0)
			{
				newNum = 0.0;
			}
			TextBox_Z.Text = newNum.ToString();
			MoveZ();
		}
	}

	private void MoveZ()
	{
		if (tbl.ControllerPortOk() || XYConnect())
		{
			ValidateChildren();
			string strZact = comboBox1.Text;
			zACT zEnum = GetZEnum(strZact);
			if (!tbl.zUpDown(zEnum, TextBox_Z.Text, down: true))
			{
				MessageBox.Show("Error in send command for Z actuator.");
			}
		}
	}

	private void button3_Click_1(object sender, EventArgs e)
	{
		double newNum = 0.0;
		string text = "";
		if (tbl.bc == null)
		{
			return;
		}
		text = TextBox_Z.Text;
		if (GetDouble(text, ref newNum))
		{
			newNum += 25.0;
			if (newNum < 0.0)
			{
				newNum = 0.0;
			}
			TextBox_Z.Text = newNum.ToString();
			MoveZ();
		}
	}

	private void button1_Click_2(object sender, EventArgs e)
	{
		double newNum = 0.0;
		string text = "";
		if (enableOffset1.Checked)
		{
			text = TextBox_OffsetY.Text;
			if (GetDouble(text, ref newNum))
			{
				newNum += 50.0;
				TextBox_OffsetY.Text = newNum.ToString();
				SetValueandMove();
			}
		}
	}

	private void button2_Click_1(object sender, EventArgs e)
	{
		double newNum = 0.0;
		string text = "";
		if (enableOffset1.Checked)
		{
			text = TextBox_OffsetY.Text;
			if (GetDouble(text, ref newNum))
			{
				newNum -= 50.0;
				TextBox_OffsetY.Text = newNum.ToString();
				SetValueandMove();
			}
		}
	}

	private void xOffIncButton_Click(object sender, EventArgs e)
	{
		double newNum = 0.0;
		string text = "";
		if (enableOffset1.Checked)
		{
			text = TextBox_OffsetX.Text;
			if (GetDouble(text, ref newNum))
			{
				newNum += 50.0;
				TextBox_OffsetX.Text = newNum.ToString();
				SetValueandMove();
			}
		}
	}

	private void Textbox_GlobalZ2Offset_TextChanged(object sender, EventArgs e)
	{
	}

	private void Textbox_GlobalZ1Offset_TextChanged(object sender, EventArgs e)
	{
	}

	private void TextBox_GlobalZ1offset_Validating(object sender, CancelEventArgs e)
	{
		if (!checkIsNumeric(Textbox_GlobalZ1Offset.Text))
		{
			MessageBox.Show("Entry must be numeric.");
			Textbox_GlobalZ1Offset.Text = "";
			Textbox_GlobalZ1Offset.Focus();
		}
		else
		{
			tbl.UpdateSetupItem(xySETUP.Z1GlobalOffset, Textbox_GlobalZ1Offset.Text);
		}
	}

	private void TextBox_GlobalZ2offset_Validating(object sender, CancelEventArgs e)
	{
		if (!checkIsNumeric(Textbox_GlobalZ2Offset.Text))
		{
			MessageBox.Show("Entry must be numeric.");
			Textbox_GlobalZ2Offset.Text = "";
			Textbox_GlobalZ2Offset.Focus();
		}
		else
		{
			tbl.UpdateSetupItem(xySETUP.Z2GlobalOffset, Textbox_GlobalZ2Offset.Text);
		}
	}

	private void checkBox1_CheckedChanged_1(object sender, EventArgs e)
	{
	}

	private void fileToolStripMenuItem_Click(object sender, EventArgs e)
	{
	}

	private void toolStripStatusLabel1_Click(object sender, EventArgs e)
	{
	}

	private void button4_Click_2(object sender, EventArgs e)
	{
		string text = "";
		int percent = 50;
		tbl.RetractZ_ByPercent(zACT.LEVERPRESS, percent, ref text);
	}

	private void PowerButton_Click(object sender, EventArgs e)
	{
		bool IO_OUT = true;
		control_item = "RLY_SOLENOID_PWRON";
		USB_IO_Expander.IndividualControl i_ctl = USB_IO_Expander.IndividualControl.NOT_USED;
		USB_IO_Expander.SetValue setValue = USB_IO_Expander.SetValue.LOW;
		if (this.setValue == 1)
		{
			setValue = USB_IO_Expander.SetValue.HIGH;
		}
		string[] names = Enum.GetNames(typeof(USB_IO_Expander.IndividualControl));
		for (int i = 0; i < names.Count(); i++)
		{
			if (names[i] == control_item)
			{
				i_ctl = (USB_IO_Expander.IndividualControl)i;
				break;
			}
		}
		if (!tbl.ControllerPortOk())
		{
			textBoxComPort.BackColor = Color.Pink;
			setValue = USB_IO_Expander.SetValue.HIGH;
			if (!myIO.Individual_Control(i_ctl, ref setValue, ref IO_OUT))
			{
				MessageBox.Show("Error attempting to turn on XY Controller power. Make sure the Tester Interconnect CCA ID is set to 0 and USB is connected");
			}
			else
			{
				Thread.Sleep(1000);
			}
		}
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		this.components = new System.ComponentModel.Container();
		this.listBox1 = new System.Windows.Forms.ListBox();
		this.menuStrip1 = new System.Windows.Forms.MenuStrip();
		this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.saveSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.saveSettingsAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.TextBox_X = new System.Windows.Forms.TextBox();
		this.label1 = new System.Windows.Forms.Label();
		this.TextBox_Y = new System.Windows.Forms.TextBox();
		this.label2 = new System.Windows.Forms.Label();
		this.TextBox_Z = new System.Windows.Forms.TextBox();
		this.label3 = new System.Windows.Forms.Label();
		this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
		this.TextBox_OffsetX = new System.Windows.Forms.TextBox();
		this.label4 = new System.Windows.Forms.Label();
		this.TextBox_OffsetY = new System.Windows.Forms.TextBox();
		this.label5 = new System.Windows.Forms.Label();
		this.label6 = new System.Windows.Forms.Label();
		this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
		this.groupBox1 = new System.Windows.Forms.GroupBox();
		this.xOffIncButton = new System.Windows.Forms.Button();
		this.button1 = new System.Windows.Forms.Button();
		this.button2 = new System.Windows.Forms.Button();
		this.XoffDecButton = new System.Windows.Forms.Button();
		this.YincButton = new System.Windows.Forms.Button();
		this.YdecButton = new System.Windows.Forms.Button();
		this.XincButton = new System.Windows.Forms.Button();
		this.XdecButton = new System.Windows.Forms.Button();
		this.button5 = new System.Windows.Forms.Button();
		this.enableOffset1 = new System.Windows.Forms.CheckBox();
		this.groupBox2 = new System.Windows.Forms.GroupBox();
		this.button3 = new System.Windows.Forms.Button();
		this.comboBox1 = new System.Windows.Forms.ComboBox();
		this.ZdecButton = new System.Windows.Forms.Button();
		this.RetractAllButton = new System.Windows.Forms.Button();
		this.ZAxisGoTo = new System.Windows.Forms.Button();
		this.label18 = new System.Windows.Forms.Label();
		this.label9 = new System.Windows.Forms.Label();
		this.LabelComPort = new System.Windows.Forms.Label();
		this.textBox_TestID = new System.Windows.Forms.TextBox();
		this.textBoxComPort = new System.Windows.Forms.TextBox();
		this.textBox_DutName = new System.Windows.Forms.TextBox();
		this.label7 = new System.Windows.Forms.Label();
		this.textBox_PartNum = new System.Windows.Forms.TextBox();
		this.label8 = new System.Windows.Forms.Label();
		this.textBox_Z1max = new System.Windows.Forms.TextBox();
		this.label10 = new System.Windows.Forms.Label();
		this.textBox_Z2max = new System.Windows.Forms.TextBox();
		this.label11 = new System.Windows.Forms.Label();
		this.textBox_KOutX1 = new System.Windows.Forms.TextBox();
		this.label12 = new System.Windows.Forms.Label();
		this.textBox_KOutX2 = new System.Windows.Forms.TextBox();
		this.label13 = new System.Windows.Forms.Label();
		this.textBox_KOY1 = new System.Windows.Forms.TextBox();
		this.label14 = new System.Windows.Forms.Label();
		this.textBox_KOY2 = new System.Windows.Forms.TextBox();
		this.label15 = new System.Windows.Forms.Label();
		this.textBox_GlobalXoffset = new System.Windows.Forms.TextBox();
		this.label16 = new System.Windows.Forms.Label();
		this.textBox_GlobalYoffset = new System.Windows.Forms.TextBox();
		this.label17 = new System.Windows.Forms.Label();
		this.groupBox3 = new System.Windows.Forms.GroupBox();
		this.label20 = new System.Windows.Forms.Label();
		this.label19 = new System.Windows.Forms.Label();
		this.Textbox_GlobalZ2Offset = new System.Windows.Forms.TextBox();
		this.Textbox_GlobalZ1Offset = new System.Windows.Forms.TextBox();
		this.ConnectPortbutton = new System.Windows.Forms.Button();
		this.PortReleaseButton = new System.Windows.Forms.Button();
		this.ReloadConfigFile = new System.Windows.Forms.Button();
		this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
		this.GoHomeButton = new System.Windows.Forms.Button();
		this.ChkBxMoveOK = new System.Windows.Forms.CheckBox();
		this.statusStrip1 = new System.Windows.Forms.StatusStrip();
		this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
		this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
		this.PowerButton = new System.Windows.Forms.Button();
		this.button4 = new System.Windows.Forms.Button();
		this.menuStrip1.SuspendLayout();
		this.groupBox1.SuspendLayout();
		this.groupBox2.SuspendLayout();
		this.groupBox3.SuspendLayout();
		this.statusStrip1.SuspendLayout();
		base.SuspendLayout();
		this.listBox1.FormattingEnabled = true;
		this.listBox1.ItemHeight = 16;
		this.listBox1.Location = new System.Drawing.Point(473, 86);
		this.listBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.listBox1.Name = "listBox1";
		this.listBox1.Size = new System.Drawing.Size(188, 484);
		this.listBox1.TabIndex = 4;
		this.listBox1.SelectedIndexChanged += new System.EventHandler(listBox1_SelectedIndexChanged);
		this.menuStrip1.BackColor = System.Drawing.SystemColors.Control;
		this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[1] { this.fileToolStripMenuItem });
		this.menuStrip1.Location = new System.Drawing.Point(0, 0);
		this.menuStrip1.Name = "menuStrip1";
		this.menuStrip1.Padding = new System.Windows.Forms.Padding(8, 2, 0, 2);
		this.menuStrip1.Size = new System.Drawing.Size(1251, 28);
		this.menuStrip1.TabIndex = 5;
		this.menuStrip1.Text = "menuStrip1";
		this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[3] { this.openToolStripMenuItem, this.saveSettingsToolStripMenuItem, this.saveSettingsAsToolStripMenuItem });
		this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
		this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24);
		this.fileToolStripMenuItem.Text = "File";
		this.fileToolStripMenuItem.Click += new System.EventHandler(fileToolStripMenuItem_Click);
		this.openToolStripMenuItem.Name = "openToolStripMenuItem";
		this.openToolStripMenuItem.Size = new System.Drawing.Size(186, 24);
		this.openToolStripMenuItem.Text = "Open";
		this.openToolStripMenuItem.Click += new System.EventHandler(openToolStripMenuItem_Click);
		this.saveSettingsToolStripMenuItem.Name = "saveSettingsToolStripMenuItem";
		this.saveSettingsToolStripMenuItem.Size = new System.Drawing.Size(186, 24);
		this.saveSettingsToolStripMenuItem.Text = "Save Settings";
		this.saveSettingsToolStripMenuItem.Click += new System.EventHandler(saveSettingsToolStripMenuItem_Click);
		this.saveSettingsAsToolStripMenuItem.Name = "saveSettingsAsToolStripMenuItem";
		this.saveSettingsAsToolStripMenuItem.Size = new System.Drawing.Size(186, 24);
		this.saveSettingsAsToolStripMenuItem.Text = "Save Settings As";
		this.saveSettingsAsToolStripMenuItem.Click += new System.EventHandler(saveSettingsAsToolStripMenuItem_Click);
		this.TextBox_X.Location = new System.Drawing.Point(33, 49);
		this.TextBox_X.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.TextBox_X.Name = "TextBox_X";
		this.TextBox_X.Size = new System.Drawing.Size(93, 22);
		this.TextBox_X.TabIndex = 6;
		this.TextBox_X.TextChanged += new System.EventHandler(TextBox_X_TextChanged);
		this.TextBox_X.Validating += new System.ComponentModel.CancelEventHandler(TextBox_X_Validating);
		this.label1.AutoSize = true;
		this.label1.Location = new System.Drawing.Point(33, 30);
		this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(75, 17);
		this.label1.TabIndex = 7;
		this.label1.Text = "X Location";
		this.TextBox_Y.Location = new System.Drawing.Point(37, 119);
		this.TextBox_Y.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.TextBox_Y.Name = "TextBox_Y";
		this.TextBox_Y.Size = new System.Drawing.Size(89, 22);
		this.TextBox_Y.TabIndex = 8;
		this.TextBox_Y.TextChanged += new System.EventHandler(TextBox_Y_TextChanged);
		this.TextBox_Y.Validating += new System.ComponentModel.CancelEventHandler(TextBox_Y_Validating);
		this.label2.AutoSize = true;
		this.label2.Location = new System.Drawing.Point(33, 100);
		this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label2.Name = "label2";
		this.label2.Size = new System.Drawing.Size(75, 17);
		this.label2.TabIndex = 9;
		this.label2.Text = "Y Location";
		this.TextBox_Z.Location = new System.Drawing.Point(33, 47);
		this.TextBox_Z.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.TextBox_Z.Name = "TextBox_Z";
		this.TextBox_Z.Size = new System.Drawing.Size(89, 22);
		this.TextBox_Z.TabIndex = 10;
		this.TextBox_Z.TextChanged += new System.EventHandler(TextBox_Z_TextChanged);
		this.TextBox_Z.Validating += new System.ComponentModel.CancelEventHandler(TextBox_Z_Validating);
		this.label3.AutoSize = true;
		this.label3.Location = new System.Drawing.Point(29, 27);
		this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label3.Name = "label3";
		this.label3.Size = new System.Drawing.Size(75, 17);
		this.label3.TabIndex = 11;
		this.label3.Text = "Z Location";
		this.contextMenuStrip1.Name = "contextMenuStrip1";
		this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4);
		this.TextBox_OffsetX.Location = new System.Drawing.Point(37, 183);
		this.TextBox_OffsetX.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.TextBox_OffsetX.Name = "TextBox_OffsetX";
		this.TextBox_OffsetX.Size = new System.Drawing.Size(89, 22);
		this.TextBox_OffsetX.TabIndex = 13;
		this.TextBox_OffsetX.TextChanged += new System.EventHandler(TextBox_OffsetX_TextChanged);
		this.TextBox_OffsetX.Validating += new System.ComponentModel.CancelEventHandler(TextBox_OffsetX_Validating);
		this.label4.AutoSize = true;
		this.label4.Location = new System.Drawing.Point(33, 164);
		this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label4.Name = "label4";
		this.label4.Size = new System.Drawing.Size(59, 17);
		this.label4.TabIndex = 14;
		this.label4.Text = "X Offset";
		this.TextBox_OffsetY.Location = new System.Drawing.Point(37, 251);
		this.TextBox_OffsetY.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.TextBox_OffsetY.Name = "TextBox_OffsetY";
		this.TextBox_OffsetY.Size = new System.Drawing.Size(89, 22);
		this.TextBox_OffsetY.TabIndex = 15;
		this.TextBox_OffsetY.TextChanged += new System.EventHandler(TextBox_OffsetY_TextChanged);
		this.TextBox_OffsetY.Validating += new System.ComponentModel.CancelEventHandler(TextBox_OffsetY_Validating);
		this.label5.AutoSize = true;
		this.label5.Location = new System.Drawing.Point(33, 231);
		this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label5.Name = "label5";
		this.label5.Size = new System.Drawing.Size(59, 17);
		this.label5.TabIndex = 16;
		this.label5.Text = "Y Offset";
		this.label6.AutoSize = true;
		this.label6.Location = new System.Drawing.Point(29, 106);
		this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label6.Name = "label6";
		this.label6.Size = new System.Drawing.Size(61, 17);
		this.label6.TabIndex = 18;
		this.label6.Text = "Actuator";
		this.openFileDialog1.FileName = "openFileDialog1";
		this.groupBox1.Controls.Add(this.xOffIncButton);
		this.groupBox1.Controls.Add(this.button1);
		this.groupBox1.Controls.Add(this.button2);
		this.groupBox1.Controls.Add(this.XoffDecButton);
		this.groupBox1.Controls.Add(this.YincButton);
		this.groupBox1.Controls.Add(this.YdecButton);
		this.groupBox1.Controls.Add(this.XincButton);
		this.groupBox1.Controls.Add(this.XdecButton);
		this.groupBox1.Controls.Add(this.button5);
		this.groupBox1.Controls.Add(this.enableOffset1);
		this.groupBox1.Controls.Add(this.TextBox_Y);
		this.groupBox1.Controls.Add(this.TextBox_X);
		this.groupBox1.Controls.Add(this.label1);
		this.groupBox1.Controls.Add(this.label2);
		this.groupBox1.Controls.Add(this.TextBox_OffsetX);
		this.groupBox1.Controls.Add(this.label5);
		this.groupBox1.Controls.Add(this.label4);
		this.groupBox1.Controls.Add(this.TextBox_OffsetY);
		this.groupBox1.Location = new System.Drawing.Point(688, 86);
		this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.groupBox1.Name = "groupBox1";
		this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.groupBox1.Size = new System.Drawing.Size(391, 300);
		this.groupBox1.TabIndex = 20;
		this.groupBox1.TabStop = false;
		this.groupBox1.Text = "XY Locate";
		this.xOffIncButton.Location = new System.Drawing.Point(173, 180);
		this.xOffIncButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.xOffIncButton.Name = "xOffIncButton";
		this.xOffIncButton.Size = new System.Drawing.Size(28, 28);
		this.xOffIncButton.TabIndex = 28;
		this.xOffIncButton.Text = "+";
		this.xOffIncButton.UseVisualStyleBackColor = true;
		this.xOffIncButton.Click += new System.EventHandler(xOffIncButton_Click);
		this.button1.Location = new System.Drawing.Point(172, 247);
		this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.button1.Name = "button1";
		this.button1.Size = new System.Drawing.Size(29, 28);
		this.button1.TabIndex = 27;
		this.button1.Text = "+";
		this.button1.UseVisualStyleBackColor = true;
		this.button1.Click += new System.EventHandler(button1_Click_2);
		this.button2.Location = new System.Drawing.Point(141, 247);
		this.button2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.button2.Name = "button2";
		this.button2.Size = new System.Drawing.Size(28, 28);
		this.button2.TabIndex = 26;
		this.button2.Text = "-";
		this.button2.UseVisualStyleBackColor = true;
		this.button2.Click += new System.EventHandler(button2_Click_1);
		this.XoffDecButton.Location = new System.Drawing.Point(141, 180);
		this.XoffDecButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.XoffDecButton.Name = "XoffDecButton";
		this.XoffDecButton.Size = new System.Drawing.Size(28, 28);
		this.XoffDecButton.TabIndex = 24;
		this.XoffDecButton.Text = "-";
		this.XoffDecButton.UseVisualStyleBackColor = true;
		this.XoffDecButton.Click += new System.EventHandler(XoffDecButton_Click);
		this.YincButton.Location = new System.Drawing.Point(173, 116);
		this.YincButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.YincButton.Name = "YincButton";
		this.YincButton.Size = new System.Drawing.Size(28, 28);
		this.YincButton.TabIndex = 23;
		this.YincButton.Text = "+";
		this.YincButton.UseVisualStyleBackColor = true;
		this.YincButton.Click += new System.EventHandler(YincButton_Click);
		this.YdecButton.Location = new System.Drawing.Point(141, 116);
		this.YdecButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.YdecButton.Name = "YdecButton";
		this.YdecButton.Size = new System.Drawing.Size(28, 28);
		this.YdecButton.TabIndex = 22;
		this.YdecButton.Text = "-";
		this.YdecButton.UseVisualStyleBackColor = true;
		this.YdecButton.Click += new System.EventHandler(YdecButton_Click);
		this.XincButton.Location = new System.Drawing.Point(172, 47);
		this.XincButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.XincButton.Name = "XincButton";
		this.XincButton.Size = new System.Drawing.Size(29, 28);
		this.XincButton.TabIndex = 21;
		this.XincButton.Text = "+";
		this.XincButton.UseVisualStyleBackColor = true;
		this.XincButton.Click += new System.EventHandler(XincButton_Click);
		this.XdecButton.Location = new System.Drawing.Point(141, 47);
		this.XdecButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.XdecButton.Name = "XdecButton";
		this.XdecButton.Size = new System.Drawing.Size(28, 28);
		this.XdecButton.TabIndex = 20;
		this.XdecButton.Text = "-";
		this.XdecButton.UseVisualStyleBackColor = true;
		this.XdecButton.Click += new System.EventHandler(XdecButton_Click);
		this.button5.Location = new System.Drawing.Point(253, 80);
		this.button5.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.button5.Name = "button5";
		this.button5.Size = new System.Drawing.Size(91, 47);
		this.button5.TabIndex = 19;
		this.button5.Text = "Go To XY";
		this.button5.UseVisualStyleBackColor = true;
		this.button5.Click += new System.EventHandler(button5_Click);
		this.enableOffset1.AutoSize = true;
		this.enableOffset1.Location = new System.Drawing.Point(235, 212);
		this.enableOffset1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.enableOffset1.Name = "enableOffset1";
		this.enableOffset1.Size = new System.Drawing.Size(123, 21);
		this.enableOffset1.TabIndex = 17;
		this.enableOffset1.Text = "Enable Offsets";
		this.enableOffset1.UseVisualStyleBackColor = true;
		this.enableOffset1.CheckedChanged += new System.EventHandler(checkBox1_CheckedChanged);
		this.groupBox2.Controls.Add(this.button3);
		this.groupBox2.Controls.Add(this.comboBox1);
		this.groupBox2.Controls.Add(this.ZdecButton);
		this.groupBox2.Controls.Add(this.RetractAllButton);
		this.groupBox2.Controls.Add(this.ZAxisGoTo);
		this.groupBox2.Controls.Add(this.TextBox_Z);
		this.groupBox2.Controls.Add(this.label3);
		this.groupBox2.Controls.Add(this.label6);
		this.groupBox2.Location = new System.Drawing.Point(688, 394);
		this.groupBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.groupBox2.Name = "groupBox2";
		this.groupBox2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.groupBox2.Size = new System.Drawing.Size(391, 171);
		this.groupBox2.TabIndex = 21;
		this.groupBox2.TabStop = false;
		this.groupBox2.Text = "Z Axis";
		this.button3.Location = new System.Drawing.Point(172, 44);
		this.button3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.button3.Name = "button3";
		this.button3.Size = new System.Drawing.Size(29, 28);
		this.button3.TabIndex = 29;
		this.button3.Text = "+";
		this.button3.UseVisualStyleBackColor = true;
		this.button3.Click += new System.EventHandler(button3_Click_1);
		this.comboBox1.FormattingEnabled = true;
		this.comboBox1.Location = new System.Drawing.Point(33, 126);
		this.comboBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.comboBox1.Name = "comboBox1";
		this.comboBox1.Size = new System.Drawing.Size(89, 24);
		this.comboBox1.TabIndex = 22;
		this.comboBox1.SelectedIndexChanged += new System.EventHandler(comboBox1_SelectedIndexChanged);
		this.ZdecButton.Location = new System.Drawing.Point(141, 44);
		this.ZdecButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.ZdecButton.Name = "ZdecButton";
		this.ZdecButton.Size = new System.Drawing.Size(28, 28);
		this.ZdecButton.TabIndex = 28;
		this.ZdecButton.Text = "-";
		this.ZdecButton.UseVisualStyleBackColor = true;
		this.ZdecButton.Click += new System.EventHandler(button4_Click_1);
		this.RetractAllButton.Location = new System.Drawing.Point(248, 111);
		this.RetractAllButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.RetractAllButton.Name = "RetractAllButton";
		this.RetractAllButton.Size = new System.Drawing.Size(100, 28);
		this.RetractAllButton.TabIndex = 20;
		this.RetractAllButton.Text = "Retract All";
		this.RetractAllButton.UseVisualStyleBackColor = true;
		this.RetractAllButton.Click += new System.EventHandler(RetractAllButton_Click);
		this.ZAxisGoTo.Location = new System.Drawing.Point(253, 52);
		this.ZAxisGoTo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.ZAxisGoTo.Name = "ZAxisGoTo";
		this.ZAxisGoTo.Size = new System.Drawing.Size(91, 46);
		this.ZAxisGoTo.TabIndex = 19;
		this.ZAxisGoTo.Text = "Go To Z";
		this.ZAxisGoTo.UseVisualStyleBackColor = true;
		this.ZAxisGoTo.Click += new System.EventHandler(ZAxisGoTo_Click);
		this.label18.AutoSize = true;
		this.label18.Location = new System.Drawing.Point(505, 68);
		this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label18.Name = "label18";
		this.label18.Size = new System.Drawing.Size(105, 17);
		this.label18.TabIndex = 21;
		this.label18.Text = "Location Points";
		this.label9.AutoSize = true;
		this.label9.Location = new System.Drawing.Point(39, 129);
		this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label9.Name = "label9";
		this.label9.Size = new System.Drawing.Size(70, 17);
		this.label9.TabIndex = 29;
		this.label9.Text = "Tester ID:";
		this.LabelComPort.AutoSize = true;
		this.LabelComPort.Location = new System.Drawing.Point(20, 52);
		this.LabelComPort.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.LabelComPort.Name = "LabelComPort";
		this.LabelComPort.Size = new System.Drawing.Size(95, 17);
		this.LabelComPort.TabIndex = 23;
		this.LabelComPort.Text = "XY COM Port:";
		this.LabelComPort.Click += new System.EventHandler(LabelComPort_Click);
		this.textBox_TestID.Location = new System.Drawing.Point(121, 126);
		this.textBox_TestID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.textBox_TestID.Name = "textBox_TestID";
		this.textBox_TestID.Size = new System.Drawing.Size(132, 22);
		this.textBox_TestID.TabIndex = 30;
		this.textBox_TestID.TextChanged += new System.EventHandler(textBox5_TextChanged);
		this.textBox_TestID.Validating += new System.ComponentModel.CancelEventHandler(textBox5_Validating);
		this.textBoxComPort.Location = new System.Drawing.Point(125, 49);
		this.textBoxComPort.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.textBoxComPort.Name = "textBoxComPort";
		this.textBoxComPort.Size = new System.Drawing.Size(132, 22);
		this.textBoxComPort.TabIndex = 22;
		this.textBoxComPort.TextChanged += new System.EventHandler(textBoxComPort_TextChanged);
		this.textBoxComPort.Validating += new System.ComponentModel.CancelEventHandler(textBoxComPort_Validating);
		this.textBox_DutName.Location = new System.Drawing.Point(121, 155);
		this.textBox_DutName.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.textBox_DutName.Name = "textBox_DutName";
		this.textBox_DutName.Size = new System.Drawing.Size(132, 22);
		this.textBox_DutName.TabIndex = 31;
		this.textBox_DutName.TextChanged += new System.EventHandler(textBox_DutName_TextChanged);
		this.textBox_DutName.Validating += new System.ComponentModel.CancelEventHandler(textBox_DutName_Validating);
		this.label7.AutoSize = true;
		this.label7.Location = new System.Drawing.Point(32, 158);
		this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label7.Name = "label7";
		this.label7.Size = new System.Drawing.Size(82, 17);
		this.label7.TabIndex = 32;
		this.label7.Text = "DUT Name:";
		this.textBox_PartNum.Location = new System.Drawing.Point(121, 185);
		this.textBox_PartNum.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.textBox_PartNum.Name = "textBox_PartNum";
		this.textBox_PartNum.Size = new System.Drawing.Size(132, 22);
		this.textBox_PartNum.TabIndex = 33;
		this.textBox_PartNum.TextChanged += new System.EventHandler(textBox_PartNum_TextChanged);
		this.textBox_PartNum.Validating += new System.ComponentModel.CancelEventHandler(textBox_PartNum_Validating);
		this.label8.AutoSize = true;
		this.label8.Location = new System.Drawing.Point(17, 190);
		this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label8.Name = "label8";
		this.label8.Size = new System.Drawing.Size(97, 17);
		this.label8.TabIndex = 34;
		this.label8.Text = "DUT Part No.:";
		this.textBox_Z1max.Location = new System.Drawing.Point(121, 214);
		this.textBox_Z1max.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.textBox_Z1max.Name = "textBox_Z1max";
		this.textBox_Z1max.Size = new System.Drawing.Size(132, 22);
		this.textBox_Z1max.TabIndex = 35;
		this.textBox_Z1max.TextChanged += new System.EventHandler(textBox_Z1max_TextChanged);
		this.textBox_Z1max.Validating += new System.ComponentModel.CancelEventHandler(textBox_Z1max_Validating);
		this.label10.AutoSize = true;
		this.label10.Location = new System.Drawing.Point(49, 218);
		this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label10.Name = "label10";
		this.label10.Size = new System.Drawing.Size(58, 17);
		this.label10.TabIndex = 36;
		this.label10.Text = "Z1 Max:";
		this.textBox_Z2max.Location = new System.Drawing.Point(121, 247);
		this.textBox_Z2max.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.textBox_Z2max.Name = "textBox_Z2max";
		this.textBox_Z2max.Size = new System.Drawing.Size(132, 22);
		this.textBox_Z2max.TabIndex = 37;
		this.textBox_Z2max.TextChanged += new System.EventHandler(textBox_Z2max_TextChanged);
		this.textBox_Z2max.Validating += new System.ComponentModel.CancelEventHandler(textBox_Z2max_Validating);
		this.label11.AutoSize = true;
		this.label11.Location = new System.Drawing.Point(49, 251);
		this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label11.Name = "label11";
		this.label11.Size = new System.Drawing.Size(58, 17);
		this.label11.TabIndex = 38;
		this.label11.Text = "Z2 Max:";
		this.textBox_KOutX1.Location = new System.Drawing.Point(121, 298);
		this.textBox_KOutX1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.textBox_KOutX1.Name = "textBox_KOutX1";
		this.textBox_KOutX1.Size = new System.Drawing.Size(132, 22);
		this.textBox_KOutX1.TabIndex = 39;
		this.textBox_KOutX1.TextChanged += new System.EventHandler(textBox_KOutX1_TextChanged);
		this.textBox_KOutX1.Validating += new System.ComponentModel.CancelEventHandler(textBox_KOutX1_Validating);
		this.label12.AutoSize = true;
		this.label12.Location = new System.Drawing.Point(29, 302);
		this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label12.Name = "label12";
		this.label12.Size = new System.Drawing.Size(86, 17);
		this.label12.TabIndex = 40;
		this.label12.Text = "X1 Keepout:";
		this.textBox_KOutX2.Location = new System.Drawing.Point(121, 326);
		this.textBox_KOutX2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.textBox_KOutX2.Name = "textBox_KOutX2";
		this.textBox_KOutX2.Size = new System.Drawing.Size(132, 22);
		this.textBox_KOutX2.TabIndex = 41;
		this.textBox_KOutX2.TextChanged += new System.EventHandler(textBox_KOutX2_TextChanged);
		this.textBox_KOutX2.Validating += new System.ComponentModel.CancelEventHandler(textBox_KOutX2_Validating);
		this.label13.AutoSize = true;
		this.label13.Location = new System.Drawing.Point(29, 330);
		this.label13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label13.Name = "label13";
		this.label13.Size = new System.Drawing.Size(86, 17);
		this.label13.TabIndex = 42;
		this.label13.Text = "X2 Keepout:";
		this.textBox_KOY1.Location = new System.Drawing.Point(121, 354);
		this.textBox_KOY1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.textBox_KOY1.Name = "textBox_KOY1";
		this.textBox_KOY1.Size = new System.Drawing.Size(132, 22);
		this.textBox_KOY1.TabIndex = 43;
		this.textBox_KOY1.TextChanged += new System.EventHandler(textBox_KOY1_TextChanged);
		this.textBox_KOY1.Validating += new System.ComponentModel.CancelEventHandler(textBox_KOY1_Validating);
		this.label14.AutoSize = true;
		this.label14.Location = new System.Drawing.Point(29, 358);
		this.label14.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label14.Name = "label14";
		this.label14.Size = new System.Drawing.Size(86, 17);
		this.label14.TabIndex = 44;
		this.label14.Text = "Y1 Keepout:";
		this.textBox_KOY2.Location = new System.Drawing.Point(121, 383);
		this.textBox_KOY2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.textBox_KOY2.Name = "textBox_KOY2";
		this.textBox_KOY2.Size = new System.Drawing.Size(132, 22);
		this.textBox_KOY2.TabIndex = 45;
		this.textBox_KOY2.TextChanged += new System.EventHandler(textBox_KOY2_TextChanged);
		this.label15.AutoSize = true;
		this.label15.Location = new System.Drawing.Point(29, 386);
		this.label15.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label15.Name = "label15";
		this.label15.Size = new System.Drawing.Size(86, 17);
		this.label15.TabIndex = 46;
		this.label15.Text = "Y2 Keepout:";
		this.label15.Click += new System.EventHandler(label15_Click);
		this.textBox_GlobalXoffset.Location = new System.Drawing.Point(147, 442);
		this.textBox_GlobalXoffset.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.textBox_GlobalXoffset.Name = "textBox_GlobalXoffset";
		this.textBox_GlobalXoffset.Size = new System.Drawing.Size(132, 22);
		this.textBox_GlobalXoffset.TabIndex = 47;
		this.textBox_GlobalXoffset.TextChanged += new System.EventHandler(textBox_GlobalXoffset_TextChanged);
		this.textBox_GlobalXoffset.Validating += new System.ComponentModel.CancelEventHandler(textBox_GlobalXoffset_Validating);
		this.label16.AutoSize = true;
		this.label16.Location = new System.Drawing.Point(28, 446);
		this.label16.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label16.Name = "label16";
		this.label16.Size = new System.Drawing.Size(108, 17);
		this.label16.TabIndex = 48;
		this.label16.Text = "Global X Offset:";
		this.textBox_GlobalYoffset.Location = new System.Drawing.Point(147, 466);
		this.textBox_GlobalYoffset.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.textBox_GlobalYoffset.Name = "textBox_GlobalYoffset";
		this.textBox_GlobalYoffset.Size = new System.Drawing.Size(132, 22);
		this.textBox_GlobalYoffset.TabIndex = 49;
		this.textBox_GlobalYoffset.TextChanged += new System.EventHandler(textBox_GlobalYoffset_TextChanged);
		this.textBox_GlobalYoffset.Validating += new System.ComponentModel.CancelEventHandler(textBox_GlobalYoffset_Validating);
		this.label17.AutoSize = true;
		this.label17.Location = new System.Drawing.Point(28, 471);
		this.label17.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label17.Name = "label17";
		this.label17.Size = new System.Drawing.Size(108, 17);
		this.label17.TabIndex = 50;
		this.label17.Text = "Global Y Offset:";
		this.groupBox3.Controls.Add(this.label20);
		this.groupBox3.Controls.Add(this.label19);
		this.groupBox3.Controls.Add(this.Textbox_GlobalZ2Offset);
		this.groupBox3.Controls.Add(this.Textbox_GlobalZ1Offset);
		this.groupBox3.Controls.Add(this.ConnectPortbutton);
		this.groupBox3.Controls.Add(this.PortReleaseButton);
		this.groupBox3.Controls.Add(this.label17);
		this.groupBox3.Controls.Add(this.textBox_GlobalYoffset);
		this.groupBox3.Controls.Add(this.label16);
		this.groupBox3.Controls.Add(this.textBox_GlobalXoffset);
		this.groupBox3.Controls.Add(this.label15);
		this.groupBox3.Controls.Add(this.textBox_KOY2);
		this.groupBox3.Controls.Add(this.label14);
		this.groupBox3.Controls.Add(this.textBox_KOY1);
		this.groupBox3.Controls.Add(this.label13);
		this.groupBox3.Controls.Add(this.textBox_KOutX2);
		this.groupBox3.Controls.Add(this.label12);
		this.groupBox3.Controls.Add(this.textBox_KOutX1);
		this.groupBox3.Controls.Add(this.label11);
		this.groupBox3.Controls.Add(this.textBox_Z2max);
		this.groupBox3.Controls.Add(this.label10);
		this.groupBox3.Controls.Add(this.textBox_Z1max);
		this.groupBox3.Controls.Add(this.label8);
		this.groupBox3.Controls.Add(this.textBox_PartNum);
		this.groupBox3.Controls.Add(this.label7);
		this.groupBox3.Controls.Add(this.textBox_DutName);
		this.groupBox3.Controls.Add(this.textBoxComPort);
		this.groupBox3.Controls.Add(this.textBox_TestID);
		this.groupBox3.Controls.Add(this.LabelComPort);
		this.groupBox3.Controls.Add(this.label9);
		this.groupBox3.Location = new System.Drawing.Point(41, 63);
		this.groupBox3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.groupBox3.Name = "groupBox3";
		this.groupBox3.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.groupBox3.Size = new System.Drawing.Size(381, 576);
		this.groupBox3.TabIndex = 31;
		this.groupBox3.TabStop = false;
		this.groupBox3.Text = "Setup Items";
		this.label20.AutoSize = true;
		this.label20.Location = new System.Drawing.Point(20, 537);
		this.label20.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label20.Name = "label20";
		this.label20.Size = new System.Drawing.Size(116, 17);
		this.label20.TabIndex = 55;
		this.label20.Text = "Global Z2 Offset:";
		this.label19.AutoSize = true;
		this.label19.Location = new System.Drawing.Point(20, 510);
		this.label19.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label19.Name = "label19";
		this.label19.Size = new System.Drawing.Size(116, 17);
		this.label19.TabIndex = 54;
		this.label19.Text = "Global Z1 Offset:";
		this.Textbox_GlobalZ2Offset.Location = new System.Drawing.Point(147, 534);
		this.Textbox_GlobalZ2Offset.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.Textbox_GlobalZ2Offset.Name = "Textbox_GlobalZ2Offset";
		this.Textbox_GlobalZ2Offset.Size = new System.Drawing.Size(132, 22);
		this.Textbox_GlobalZ2Offset.TabIndex = 53;
		this.Textbox_GlobalZ2Offset.TextChanged += new System.EventHandler(Textbox_GlobalZ2Offset_TextChanged);
		this.Textbox_GlobalZ2Offset.Validating += new System.ComponentModel.CancelEventHandler(TextBox_GlobalZ2offset_Validating);
		this.Textbox_GlobalZ1Offset.Location = new System.Drawing.Point(147, 506);
		this.Textbox_GlobalZ1Offset.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.Textbox_GlobalZ1Offset.Name = "Textbox_GlobalZ1Offset";
		this.Textbox_GlobalZ1Offset.Size = new System.Drawing.Size(132, 22);
		this.Textbox_GlobalZ1Offset.TabIndex = 52;
		this.Textbox_GlobalZ1Offset.TextChanged += new System.EventHandler(Textbox_GlobalZ1Offset_TextChanged);
		this.Textbox_GlobalZ1Offset.Validating += new System.ComponentModel.CancelEventHandler(TextBox_GlobalZ1offset_Validating);
		this.ConnectPortbutton.Location = new System.Drawing.Point(268, 33);
		this.ConnectPortbutton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.ConnectPortbutton.Name = "ConnectPortbutton";
		this.ConnectPortbutton.Size = new System.Drawing.Size(95, 28);
		this.ConnectPortbutton.TabIndex = 51;
		this.ConnectPortbutton.Text = "Connect";
		this.ConnectPortbutton.UseVisualStyleBackColor = true;
		this.ConnectPortbutton.Click += new System.EventHandler(ConnectPortbutton_Click);
		this.PortReleaseButton.Location = new System.Drawing.Point(268, 69);
		this.PortReleaseButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.PortReleaseButton.Name = "PortReleaseButton";
		this.PortReleaseButton.Size = new System.Drawing.Size(95, 28);
		this.PortReleaseButton.TabIndex = 34;
		this.PortReleaseButton.Text = "Disconnect";
		this.PortReleaseButton.UseVisualStyleBackColor = true;
		this.PortReleaseButton.Click += new System.EventHandler(PortReleaseButton_Click);
		this.ReloadConfigFile.Location = new System.Drawing.Point(1116, 492);
		this.ReloadConfigFile.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.ReloadConfigFile.Name = "ReloadConfigFile";
		this.ReloadConfigFile.Size = new System.Drawing.Size(100, 47);
		this.ReloadConfigFile.TabIndex = 32;
		this.ReloadConfigFile.Text = "Reload Config File";
		this.ReloadConfigFile.UseVisualStyleBackColor = true;
		this.ReloadConfigFile.Click += new System.EventHandler(ReloadConfigFile_Click);
		this.GoHomeButton.Location = new System.Drawing.Point(1116, 225);
		this.GoHomeButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.GoHomeButton.Name = "GoHomeButton";
		this.GoHomeButton.Size = new System.Drawing.Size(100, 47);
		this.GoHomeButton.TabIndex = 33;
		this.GoHomeButton.Text = "Home";
		this.GoHomeButton.UseVisualStyleBackColor = true;
		this.GoHomeButton.Click += new System.EventHandler(GoHomeButton_Click);
		this.ChkBxMoveOK.AutoSize = true;
		this.ChkBxMoveOK.Location = new System.Drawing.Point(909, 583);
		this.ChkBxMoveOK.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.ChkBxMoveOK.Name = "ChkBxMoveOK";
		this.ChkBxMoveOK.Size = new System.Drawing.Size(160, 21);
		this.ChkBxMoveOK.TabIndex = 29;
		this.ChkBxMoveOK.Text = "Move while down OK";
		this.ChkBxMoveOK.UseVisualStyleBackColor = true;
		this.ChkBxMoveOK.CheckedChanged += new System.EventHandler(checkBox1_CheckedChanged_1);
		this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[2] { this.toolStripStatusLabel1, this.toolStripStatusLabel2 });
		this.statusStrip1.Location = new System.Drawing.Point(0, 668);
		this.statusStrip1.Name = "statusStrip1";
		this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 19, 0);
		this.statusStrip1.Size = new System.Drawing.Size(1251, 22);
		this.statusStrip1.SizingGrip = false;
		this.statusStrip1.TabIndex = 34;
		this.statusStrip1.Text = "statusStrip1";
		this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
		this.toolStripStatusLabel1.Size = new System.Drawing.Size(0, 17);
		this.toolStripStatusLabel1.Click += new System.EventHandler(toolStripStatusLabel1_Click);
		this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
		this.toolStripStatusLabel2.Size = new System.Drawing.Size(0, 17);
		this.PowerButton.AllowDrop = true;
		this.PowerButton.Location = new System.Drawing.Point(1116, 558);
		this.PowerButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.PowerButton.Name = "PowerButton";
		this.PowerButton.Size = new System.Drawing.Size(100, 44);
		this.PowerButton.TabIndex = 35;
		this.PowerButton.Text = "XY Power";
		this.PowerButton.UseVisualStyleBackColor = true;
		this.PowerButton.Click += new System.EventHandler(PowerButton_Click);
		this.button4.Location = new System.Drawing.Point(1116, 361);
		this.button4.Margin = new System.Windows.Forms.Padding(4);
		this.button4.Name = "button4";
		this.button4.Size = new System.Drawing.Size(100, 47);
		this.button4.TabIndex = 33;
		this.button4.Text = "Save";
		this.button4.UseVisualStyleBackColor = true;
		this.button4.Click += new System.EventHandler(SaveButton_Click);
		base.AutoScaleDimensions = new System.Drawing.SizeF(8f, 16f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(1251, 690);
		base.Controls.Add(this.PowerButton);
		base.Controls.Add(this.statusStrip1);
		base.Controls.Add(this.ChkBxMoveOK);
		base.Controls.Add(this.button4);
		base.Controls.Add(this.GoHomeButton);
		base.Controls.Add(this.ReloadConfigFile);
		base.Controls.Add(this.label18);
		base.Controls.Add(this.groupBox3);
		base.Controls.Add(this.groupBox2);
		base.Controls.Add(this.groupBox1);
		base.Controls.Add(this.listBox1);
		base.Controls.Add(this.menuStrip1);
		base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
		base.MainMenuStrip = this.menuStrip1;
		base.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		base.Name = "Form1";
		this.Text = "XYZ Table Setup";
		this.menuStrip1.ResumeLayout(false);
		this.menuStrip1.PerformLayout();
		this.groupBox1.ResumeLayout(false);
		this.groupBox1.PerformLayout();
		this.groupBox2.ResumeLayout(false);
		this.groupBox2.PerformLayout();
		this.groupBox3.ResumeLayout(false);
		this.groupBox3.PerformLayout();
		this.statusStrip1.ResumeLayout(false);
		this.statusStrip1.PerformLayout();
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
