using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;

namespace QDART_MFG_CfgEditor;

public class GpsPanel : UserControl
{
	public delegate void TargetFileChangedEventHandler(string targetfile);

	public const string GPIB = "GPIB";

	public const string IP = "IP";

	private string default_file;

	private string target_file;

	private Dictionary<string, string> emlist = new Dictionary<string, string>();

	private Dictionary<string, string> pslist = new Dictionary<string, string>();

	private Dictionary<string, string> ctlist = new Dictionary<string, string>();

	private EquipmentSet es = new EquipmentSet();

	private bool use_ps;

	private string name_ps;

	private string remote_ps;

	private string pad_ps;

	private string name_em;

	private string remote_em;

	private string pad_em;

	private string ip_em;

	private bool use_ct;

	private string name_ct;

	private string remote_ct;

	private string pad_ct;

	private IContainer components;

	public ComboBox cb_em_pad;

	public ComboBox cb_em_remote;

	public ComboBox cb_em_name;

	public Label label9;

	public Label tb_em_pad;

	public Label label7;

	private Label label1;

	private Panel pl_ps;

	public Label label2;

	public Label label3;

	public Label label4;

	public ComboBox cb_ps_pad;

	public ComboBox cb_ps_remote;

	public ComboBox cb_ps_name;

	public CheckBox cb_ps;

	public ComboBox cmb_ct_name;

	public ComboBox cmb_ct_remote;

	public ComboBox cmb_ct_pad;

	public Label label5;

	public Label label6;

	public Label label10;

	public CheckBox cb_ct;

	private Panel pl_ct;

	private Panel pl_ip;

	private Label lb_em_ip;

	private CustomizedTextBox tb_em_ip;

	private ErrorProvider errorProvider1;

	private ToolTip toolTip1;

	public string DefaultFile
	{
		get
		{
			return default_file;
		}
		set
		{
			default_file = value;
		}
	}

	public string TargetFile
	{
		get
		{
			return target_file;
		}
		set
		{
			target_file = value;
		}
	}

	public string NameEM
	{
		get
		{
			return name_em;
		}
		set
		{
			name_em = value;
		}
	}

	public string RemoteEM
	{
		get
		{
			return remote_em;
		}
		set
		{
			remote_em = value;
			if (remote_em == "IP")
			{
				pl_ip.Visible = true;
			}
			else
			{
				pl_ip.Visible = false;
			}
		}
	}

	public string PadEM
	{
		get
		{
			return pad_em;
		}
		set
		{
			pad_em = value;
		}
	}

	public string IpEM
	{
		get
		{
			return ip_em;
		}
		set
		{
			ip_em = value;
		}
	}

	public bool UsePS
	{
		get
		{
			return use_ps;
		}
		set
		{
			use_ps = value;
		}
	}

	public string NamePS
	{
		get
		{
			return name_ps;
		}
		set
		{
			name_ps = value;
		}
	}

	public string RemotePS
	{
		get
		{
			return remote_ps;
		}
		set
		{
			remote_ps = value;
		}
	}

	public string PadPS
	{
		get
		{
			return pad_ps;
		}
		set
		{
			pad_ps = value;
		}
	}

	public bool UseCT
	{
		get
		{
			return use_ct;
		}
		set
		{
			use_ct = value;
		}
	}

	public string NameCT
	{
		get
		{
			return name_ct;
		}
		set
		{
			name_ct = value;
		}
	}

	public string RemoteCT
	{
		get
		{
			return remote_ct;
		}
		set
		{
			remote_ct = value;
		}
	}

	public string PadCT
	{
		get
		{
			return pad_ct;
		}
		set
		{
			pad_ct = value;
		}
	}

	public event TargetFileChangedEventHandler TargetFileChanged;

	public GpsPanel(RootConfig cfg)
	{
		InitializeComponent();
		InitVar(cfg);
		InitControls();
		InitProperty();
	}

	private void InitVar(RootConfig cfg)
	{
		emlist.Clear();
		pslist.Clear();
		ctlist.Clear();
		RootConfigAllInstList[] instList = cfg.All[0].InstList;
		foreach (RootConfigAllInstList rootConfigAllInstList in instList)
		{
			switch (rootConfigAllInstList.Name)
			{
			case "Emulator":
			{
				InfoItem[] infoItem3 = rootConfigAllInstList.InfoItem;
				foreach (InfoItem infoItem4 in infoItem3)
				{
					emlist.Add(infoItem4.Name, infoItem4.Value);
				}
				break;
			}
			case "PS":
			{
				InfoItem[] infoItem5 = rootConfigAllInstList.InfoItem;
				foreach (InfoItem infoItem6 in infoItem5)
				{
					pslist.Add(infoItem6.Name, infoItem6.Value);
				}
				break;
			}
			case "UC":
			{
				InfoItem[] infoItem = rootConfigAllInstList.InfoItem;
				foreach (InfoItem infoItem2 in infoItem)
				{
					ctlist.Add(infoItem2.Name, infoItem2.Value);
				}
				break;
			}
			}
		}
		RootConfigAllPanel[] panel = cfg.All[0].Panel;
		foreach (RootConfigAllPanel rootConfigAllPanel in panel)
		{
			if (cfg.Station == rootConfigAllPanel.Name && rootConfigAllPanel.File.Length > 0)
			{
				DefaultFile = Common.GetPath(rootConfigAllPanel.File[0].Value);
			}
		}
		LoadTargetFile(DefaultFile);
	}

	private void InitControls()
	{
		List<string> list = new List<string>();
		for (int i = 0; i < 100; i++)
		{
			list.Add(i.ToString());
		}
		cb_em_pad.Items.Clear();
		cb_em_pad.Items.AddRange(list.ToArray());
		cb_ps_pad.Items.Clear();
		cb_ps_pad.Items.AddRange(list.ToArray());
		cmb_ct_pad.Items.Clear();
		cmb_ct_pad.Items.AddRange(list.ToArray());
		cb_em_remote.Items.Clear();
		cb_ps_remote.Items.Clear();
		cmb_ct_remote.Items.Clear();
		cb_em_remote.Items.AddRange(new string[2] { "GPIB", "IP" });
		cb_ps_remote.Items.AddRange(new string[1] { "GPIB" });
		cmb_ct_remote.Items.AddRange(new string[1] { "GPIB" });
		cb_em_name.Items.Clear();
		cb_em_name.Items.AddRange(emlist.Keys.ToArray());
		cb_ps_name.Items.Clear();
		cb_ps_name.Items.AddRange(pslist.Keys.ToArray());
		cmb_ct_name.Items.Clear();
		cmb_ct_name.Items.AddRange(ctlist.Keys.ToArray());
	}

	private void InitProperty()
	{
		UsePS = false;
		UseCT = false;
		if (es.Equipment.Count != 0)
		{
			foreach (InstConfig item in es.Equipment)
			{
				switch (item.Identifier)
				{
				case "Power_Supply1":
					UsePS = true;
					NamePS = item.Name;
					PadPS = item.Pad;
					RemotePS = "GPIB";
					break;
				case "GPS_Emulator1":
					NameEM = item.Name;
					PadEM = item.Pad;
					RemoteEM = "GPIB";
					break;
				case "Universal_Counter1":
					UseCT = true;
					NameCT = item.Name;
					PadCT = item.Pad;
					RemoteCT = "GPIB";
					break;
				case "Signal_Generator1":
					if (item.Name == "Qualcomm SCPI")
					{
						NameEM = item.Name;
						PadEM = item.Pad;
						IpEM = item.Ip;
					}
					break;
				}
			}
		}
		if (!string.IsNullOrEmpty(IpEM))
		{
			RemoteEM = "IP";
		}
		else
		{
			RemoteEM = "GPIB";
		}
	}

	public bool OpenFile()
	{
		bool result = false;
		try
		{
			OpenFileDialog openFileDialog = new OpenFileDialog();
			openFileDialog.Filter = "xml(*.xml)|*.xml";
			if (openFileDialog.ShowDialog() == DialogResult.OK)
			{
				TargetFile = openFileDialog.FileName;
				OnFileChange(TargetFile);
				if (LoadTargetFile(TargetFile))
				{
					InitControls();
					InitProperty();
					DataBindingToUI();
					result = true;
				}
			}
			return result;
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
			return false;
		}
	}

	private bool LoadTargetFile(string resfile)
	{
		if (File.Exists(resfile))
		{
			TargetFile = resfile;
			using FileStream fileStream = new FileStream(resfile, FileMode.Open, FileAccess.Read, FileShare.Read);
			XmlSerializer xmlSerializer = new XmlSerializer(typeof(EquipmentSet));
			es = (EquipmentSet)xmlSerializer.Deserialize(fileStream);
			fileStream.Close();
			return true;
		}
		return false;
	}

	private void SerialToFile(string fileName)
	{
		XmlSerializer xmlSerializer = new XmlSerializer(typeof(EquipmentSet));
		using StreamWriter streamWriter = new StreamWriter(fileName);
		xmlSerializer.Serialize(streamWriter, es);
		streamWriter.Close();
	}

	private void GPSPanel_Load(object sender, EventArgs e)
	{
		DataBindingToUI();
	}

	private void DataBindingToUI()
	{
		cb_em_name.DataBindings.Clear();
		cb_em_pad.DataBindings.Clear();
		cb_em_remote.DataBindings.Clear();
		tb_em_ip.DataBindings.Clear();
		cb_em_name.DataBindings.Add(new Binding("Text", this, "NameEM"));
		cb_em_pad.DataBindings.Add(new Binding("Text", this, "PadEM"));
		cb_em_remote.DataBindings.Add(new Binding("Text", this, "RemoteEM"));
		tb_em_ip.DataBindings.Add(new Binding("Text", this, "IpEM"));
		tb_em_ip.Tag = new Tip(tb_em_ip, lb_em_ip, toolTip1, Tip.TxtContent.IP_ADDRESS, "ip address", "ip address", "IP address error, Example: 192.168.0.1");
		cb_ps.DataBindings.Clear();
		cb_ps_name.DataBindings.Clear();
		cb_ps_pad.DataBindings.Clear();
		cb_ps_remote.DataBindings.Clear();
		cb_ps.DataBindings.Add(new Binding("Checked", this, "UsePS"));
		cb_ps_name.DataBindings.Add(new Binding("Text", this, "NamePS"));
		cb_ps_pad.DataBindings.Add(new Binding("Text", this, "PadPS"));
		cb_ps_remote.DataBindings.Add(new Binding("Text", this, "RemotePS"));
		cb_ct.DataBindings.Clear();
		cmb_ct_name.DataBindings.Clear();
		cmb_ct_pad.DataBindings.Clear();
		cmb_ct_remote.DataBindings.Clear();
		cb_ct.DataBindings.Add(new Binding("Checked", this, "UseCT"));
		cmb_ct_name.DataBindings.Add(new Binding("Text", this, "NameCT"));
		cmb_ct_pad.DataBindings.Add(new Binding("Text", this, "PadCT"));
		cmb_ct_remote.DataBindings.Add(new Binding("Text", this, "RemoteCT"));
	}

	public void SaveResult()
	{
		string targetFile = TargetFile;
		if (!File.Exists(targetFile))
		{
			string directoryName = Path.GetDirectoryName(targetFile);
			if (!Directory.Exists(directoryName))
			{
				Directory.CreateDirectory(directoryName);
			}
			FileStream fileStream = File.Create(targetFile);
			fileStream.Close();
		}
		if (File.GetAttributes(targetFile).ToString().IndexOf("ReadOnly") != -1)
		{
			File.SetAttributes(targetFile, FileAttributes.Normal);
		}
		try
		{
			string strcomment = LoadComment(targetFile);
			es.Equipment.Clear();
			if (UsePS)
			{
				InstConfig instConfig = new InstConfig();
				instConfig.Identifier = "Power_Supply1";
				instConfig.Name = NamePS;
				instConfig.Pad = PadPS;
				instConfig.Type = "PS";
				es.Equipment.Add(instConfig);
			}
			InstConfig instConfig2 = new InstConfig();
			instConfig2.Identifier = "GPS_Emulator1";
			instConfig2.Type = "GPS";
			if (NameEM.Contains("GSS"))
			{
				instConfig2.Name = "GSS6300";
			}
			else if (NameEM.ToUpper() == "QUALCOMM SCPI")
			{
				instConfig2.Name = NameEM;
				instConfig2.Identifier = "Signal_Generator1";
				instConfig2.Type = "DSG";
			}
			else
			{
				instConfig2.Name = NameEM;
			}
			if (RemoteEM == "IP")
			{
				instConfig2.Ip = IpEM;
			}
			else
			{
				instConfig2.Pad = PadEM;
			}
			es.Equipment.Add(instConfig2);
			if (UseCT)
			{
				InstConfig instConfig3 = new InstConfig();
				instConfig3.Identifier = "Universal_Counter1";
				instConfig3.Name = NameCT;
				instConfig3.Pad = PadCT;
				instConfig3.Type = "UC";
				es.Equipment.Add(instConfig3);
			}
			SerialToFile(targetFile);
			SaveComment(targetFile, strcomment);
		}
		catch (Exception ex)
		{
			MessageBox.Show("Save file fail due to : " + ex.Message);
		}
	}

	public void SaveResultAs()
	{
		string targetFile = TargetFile;
		try
		{
			string strcomment = LoadComment(targetFile);
			using SaveFileDialog saveFileDialog = new SaveFileDialog();
			saveFileDialog.Title = "Save file as Diag";
			saveFileDialog.InitialDirectory = Path.GetDirectoryName(targetFile);
			saveFileDialog.FileName = targetFile;
			saveFileDialog.Filter = "xmlfile|*.xml";
			if (saveFileDialog.ShowDialog() != DialogResult.OK)
			{
				return;
			}
			targetFile = saveFileDialog.FileName;
			if (!File.Exists(targetFile))
			{
				string directoryName = Path.GetDirectoryName(targetFile);
				if (!Directory.Exists(directoryName))
				{
					Directory.CreateDirectory(directoryName);
				}
				FileStream fileStream = File.Create(targetFile);
				fileStream.Close();
			}
			if (File.GetAttributes(targetFile).ToString().IndexOf("ReadOnly") != -1)
			{
				File.SetAttributes(targetFile, FileAttributes.Normal);
			}
			es.Equipment.Clear();
			if (UsePS)
			{
				InstConfig instConfig = new InstConfig();
				instConfig.Identifier = "Power_Supply1";
				instConfig.Name = NamePS;
				instConfig.Pad = PadPS;
				instConfig.Type = "PS";
				es.Equipment.Add(instConfig);
			}
			InstConfig instConfig2 = new InstConfig();
			instConfig2.Identifier = "GPS_Emulator1";
			instConfig2.Type = "GPS";
			if (NameEM.Contains("GSS"))
			{
				instConfig2.Name = "GSS6300";
			}
			else if (NameEM.ToUpper() == "QUALCOMM SCPI")
			{
				instConfig2.Name = NameEM;
				instConfig2.Identifier = "Signal_Generator1";
				instConfig2.Type = "DSG";
			}
			else
			{
				instConfig2.Name = NameEM;
			}
			if (RemoteEM == "IP")
			{
				instConfig2.Ip = IpEM;
			}
			else
			{
				instConfig2.Pad = PadEM;
			}
			es.Equipment.Add(instConfig2);
			if (UseCT)
			{
				InstConfig instConfig3 = new InstConfig();
				instConfig3.Identifier = "Universal_Counter1";
				instConfig3.Name = NameCT;
				instConfig3.Pad = PadCT;
				instConfig3.Type = "UC";
				es.Equipment.Add(instConfig3);
			}
			SerialToFile(targetFile);
			SaveComment(targetFile, strcomment);
			TargetFile = targetFile;
			OnFileChange(TargetFile);
			if (LoadTargetFile(TargetFile))
			{
				InitControls();
				InitProperty();
				DataBindingToUI();
			}
		}
		catch (Exception ex)
		{
			MessageBox.Show("Save file as fail due to : " + ex.Message);
		}
	}

	private void cb_ps_CheckedChanged(object sender, EventArgs e)
	{
		pl_ps.Enabled = (((CheckBox)sender).Checked ? true : false);
	}

	private void cb_ct_CheckedChanged(object sender, EventArgs e)
	{
		pl_ct.Enabled = (((CheckBox)sender).Checked ? true : false);
	}

	private void UpdateUI(object sender, EventArgs e)
	{
		if (cb_em_remote.Text == "IP")
		{
			pl_ip.Visible = true;
			cb_em_pad.Visible = false;
			tb_em_pad.Visible = false;
		}
		else
		{
			pl_ip.Visible = false;
			cb_em_pad.Visible = true;
			tb_em_pad.Visible = true;
		}
	}

	private string LoadComment(string tar)
	{
		string result = "";
		try
		{
			if (File.Exists(tar))
			{
				XmlDocument xmlDocument = new XmlDocument();
				xmlDocument.Load(tar);
				XmlNode documentElement = xmlDocument.DocumentElement;
				if ("EquipmentSet" == documentElement.Name)
				{
					foreach (XmlNode childNode in documentElement.ChildNodes)
					{
						if (childNode.NodeType == XmlNodeType.Comment)
						{
							result = childNode.OuterXml;
						}
					}
					documentElement.InnerXml = "";
				}
			}
			return result;
		}
		catch
		{
			return result;
		}
	}

	private void SaveComment(string tar, string strcomment)
	{
		try
		{
			XmlDocument xmlDocument = new XmlDocument();
			xmlDocument.Load(tar);
			XmlNode documentElement = xmlDocument.DocumentElement;
			if ("EquipmentSet" == documentElement.Name)
			{
				documentElement.InnerXml += strcomment;
			}
			xmlDocument.Save(tar);
		}
		catch
		{
		}
	}

	private void OnFileChange(string resfile)
	{
		if (this.TargetFileChanged != null)
		{
			this.TargetFileChanged(resfile);
		}
	}

	public void TickFileChange()
	{
		OnFileChange(TargetFile);
	}

	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.cb_em_pad = new System.Windows.Forms.ComboBox();
		this.cb_em_remote = new System.Windows.Forms.ComboBox();
		this.cb_em_name = new System.Windows.Forms.ComboBox();
		this.label9 = new System.Windows.Forms.Label();
		this.tb_em_pad = new System.Windows.Forms.Label();
		this.label7 = new System.Windows.Forms.Label();
		this.label1 = new System.Windows.Forms.Label();
		this.pl_ps = new System.Windows.Forms.Panel();
		this.label2 = new System.Windows.Forms.Label();
		this.label3 = new System.Windows.Forms.Label();
		this.label4 = new System.Windows.Forms.Label();
		this.cb_ps_pad = new System.Windows.Forms.ComboBox();
		this.cb_ps_remote = new System.Windows.Forms.ComboBox();
		this.cb_ps_name = new System.Windows.Forms.ComboBox();
		this.cb_ps = new System.Windows.Forms.CheckBox();
		this.cmb_ct_name = new System.Windows.Forms.ComboBox();
		this.cmb_ct_remote = new System.Windows.Forms.ComboBox();
		this.cmb_ct_pad = new System.Windows.Forms.ComboBox();
		this.label5 = new System.Windows.Forms.Label();
		this.label6 = new System.Windows.Forms.Label();
		this.label10 = new System.Windows.Forms.Label();
		this.cb_ct = new System.Windows.Forms.CheckBox();
		this.pl_ct = new System.Windows.Forms.Panel();
		this.pl_ip = new System.Windows.Forms.Panel();
		this.lb_em_ip = new System.Windows.Forms.Label();
		this.tb_em_ip = new System.Windows.Forms.CustomizedTextBox();
		this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components);
		this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
		this.pl_ps.SuspendLayout();
		this.pl_ct.SuspendLayout();
		this.pl_ip.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.errorProvider1).BeginInit();
		base.SuspendLayout();
		this.cb_em_pad.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.cb_em_pad.FormattingEnabled = true;
		this.cb_em_pad.Location = new System.Drawing.Point(505, 92);
		this.cb_em_pad.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.cb_em_pad.Name = "cb_em_pad";
		this.cb_em_pad.Size = new System.Drawing.Size(67, 24);
		this.cb_em_pad.TabIndex = 7;
		this.cb_em_remote.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.cb_em_remote.FormattingEnabled = true;
		this.cb_em_remote.Location = new System.Drawing.Point(395, 92);
		this.cb_em_remote.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.cb_em_remote.Name = "cb_em_remote";
		this.cb_em_remote.Size = new System.Drawing.Size(81, 24);
		this.cb_em_remote.TabIndex = 6;
		this.cb_em_remote.SelectedIndexChanged += new System.EventHandler(UpdateUI);
		this.cb_em_name.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.cb_em_name.FormattingEnabled = true;
		this.cb_em_name.Location = new System.Drawing.Point(200, 92);
		this.cb_em_name.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.cb_em_name.Name = "cb_em_name";
		this.cb_em_name.Size = new System.Drawing.Size(164, 24);
		this.cb_em_name.TabIndex = 5;
		this.label9.AutoSize = true;
		this.label9.Location = new System.Drawing.Point(388, 74);
		this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label9.Name = "label9";
		this.label9.Size = new System.Drawing.Size(52, 17);
		this.label9.TabIndex = 18;
		this.label9.Text = "remote";
		this.tb_em_pad.AutoSize = true;
		this.tb_em_pad.Location = new System.Drawing.Point(501, 73);
		this.tb_em_pad.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.tb_em_pad.Name = "tb_em_pad";
		this.tb_em_pad.Size = new System.Drawing.Size(32, 17);
		this.tb_em_pad.TabIndex = 17;
		this.tb_em_pad.Text = "pad";
		this.label7.AutoSize = true;
		this.label7.Location = new System.Drawing.Point(196, 73);
		this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label7.Name = "label7";
		this.label7.Size = new System.Drawing.Size(43, 17);
		this.label7.TabIndex = 16;
		this.label7.Text = "name";
		this.label1.AutoSize = true;
		this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.label1.Location = new System.Drawing.Point(15, 74);
		this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(159, 50);
		this.label1.TabIndex = 19;
		this.label1.Text = "GPS Emulator/\r\nSignal Generator";
		this.pl_ps.Controls.Add(this.label2);
		this.pl_ps.Controls.Add(this.label3);
		this.pl_ps.Controls.Add(this.label4);
		this.pl_ps.Controls.Add(this.cb_ps_pad);
		this.pl_ps.Controls.Add(this.cb_ps_remote);
		this.pl_ps.Controls.Add(this.cb_ps_name);
		this.pl_ps.Location = new System.Drawing.Point(197, 4);
		this.pl_ps.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.pl_ps.Name = "pl_ps";
		this.pl_ps.Size = new System.Drawing.Size(585, 60);
		this.pl_ps.TabIndex = 27;
		this.label2.AutoSize = true;
		this.label2.Location = new System.Drawing.Point(195, 10);
		this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label2.Name = "label2";
		this.label2.Size = new System.Drawing.Size(52, 17);
		this.label2.TabIndex = 15;
		this.label2.Text = "remote";
		this.label3.AutoSize = true;
		this.label3.Location = new System.Drawing.Point(308, 9);
		this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label3.Name = "label3";
		this.label3.Size = new System.Drawing.Size(32, 17);
		this.label3.TabIndex = 14;
		this.label3.Text = "pad";
		this.label4.AutoSize = true;
		this.label4.Location = new System.Drawing.Point(3, 9);
		this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label4.Name = "label4";
		this.label4.Size = new System.Drawing.Size(43, 17);
		this.label4.TabIndex = 13;
		this.label4.Text = "name";
		this.cb_ps_pad.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.cb_ps_pad.FormattingEnabled = true;
		this.cb_ps_pad.Location = new System.Drawing.Point(308, 30);
		this.cb_ps_pad.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.cb_ps_pad.Name = "cb_ps_pad";
		this.cb_ps_pad.Size = new System.Drawing.Size(67, 24);
		this.cb_ps_pad.TabIndex = 4;
		this.cb_ps_remote.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.cb_ps_remote.FormattingEnabled = true;
		this.cb_ps_remote.Location = new System.Drawing.Point(197, 30);
		this.cb_ps_remote.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.cb_ps_remote.Name = "cb_ps_remote";
		this.cb_ps_remote.Size = new System.Drawing.Size(81, 24);
		this.cb_ps_remote.TabIndex = 3;
		this.cb_ps_name.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.cb_ps_name.FormattingEnabled = true;
		this.cb_ps_name.Location = new System.Drawing.Point(3, 30);
		this.cb_ps_name.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.cb_ps_name.Name = "cb_ps_name";
		this.cb_ps_name.Size = new System.Drawing.Size(164, 24);
		this.cb_ps_name.TabIndex = 2;
		this.cb_ps.AutoSize = true;
		this.cb_ps.Checked = true;
		this.cb_ps.CheckState = System.Windows.Forms.CheckState.Checked;
		this.cb_ps.Font = new System.Drawing.Font("Microsoft Sans Serif", 12f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.cb_ps.Location = new System.Drawing.Point(4, 34);
		this.cb_ps.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.cb_ps.Name = "cb_ps";
		this.cb_ps.Size = new System.Drawing.Size(155, 29);
		this.cb_ps.TabIndex = 26;
		this.cb_ps.Text = "Power Supply";
		this.cb_ps.UseVisualStyleBackColor = true;
		this.cb_ps.CheckedChanged += new System.EventHandler(cb_ps_CheckedChanged);
		this.cmb_ct_name.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.cmb_ct_name.FormattingEnabled = true;
		this.cmb_ct_name.Location = new System.Drawing.Point(5, 23);
		this.cmb_ct_name.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.cmb_ct_name.Name = "cmb_ct_name";
		this.cmb_ct_name.Size = new System.Drawing.Size(164, 24);
		this.cmb_ct_name.TabIndex = 5;
		this.cmb_ct_remote.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.cmb_ct_remote.FormattingEnabled = true;
		this.cmb_ct_remote.Location = new System.Drawing.Point(200, 23);
		this.cmb_ct_remote.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.cmb_ct_remote.Name = "cmb_ct_remote";
		this.cmb_ct_remote.Size = new System.Drawing.Size(81, 24);
		this.cmb_ct_remote.TabIndex = 6;
		this.cmb_ct_pad.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.cmb_ct_pad.FormattingEnabled = true;
		this.cmb_ct_pad.Location = new System.Drawing.Point(311, 23);
		this.cmb_ct_pad.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.cmb_ct_pad.Name = "cmb_ct_pad";
		this.cmb_ct_pad.Size = new System.Drawing.Size(67, 24);
		this.cmb_ct_pad.TabIndex = 7;
		this.label5.AutoSize = true;
		this.label5.Location = new System.Drawing.Point(1, 4);
		this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label5.Name = "label5";
		this.label5.Size = new System.Drawing.Size(43, 17);
		this.label5.TabIndex = 16;
		this.label5.Text = "name";
		this.label6.AutoSize = true;
		this.label6.Location = new System.Drawing.Point(307, 4);
		this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label6.Name = "label6";
		this.label6.Size = new System.Drawing.Size(32, 17);
		this.label6.TabIndex = 17;
		this.label6.Text = "pad";
		this.label10.AutoSize = true;
		this.label10.Location = new System.Drawing.Point(193, 5);
		this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label10.Name = "label10";
		this.label10.Size = new System.Drawing.Size(52, 17);
		this.label10.TabIndex = 18;
		this.label10.Text = "remote";
		this.cb_ct.AutoSize = true;
		this.cb_ct.Checked = true;
		this.cb_ct.CheckState = System.Windows.Forms.CheckState.Checked;
		this.cb_ct.Font = new System.Drawing.Font("Microsoft Sans Serif", 12f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.cb_ct.Location = new System.Drawing.Point(4, 146);
		this.cb_ct.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.cb_ct.Name = "cb_ct";
		this.cb_ct.Size = new System.Drawing.Size(151, 29);
		this.cb_ct.TabIndex = 28;
		this.cb_ct.Text = "GPS Counter";
		this.cb_ct.UseVisualStyleBackColor = true;
		this.cb_ct.CheckedChanged += new System.EventHandler(cb_ct_CheckedChanged);
		this.pl_ct.Controls.Add(this.label10);
		this.pl_ct.Controls.Add(this.label6);
		this.pl_ct.Controls.Add(this.label5);
		this.pl_ct.Controls.Add(this.cmb_ct_pad);
		this.pl_ct.Controls.Add(this.cmb_ct_remote);
		this.pl_ct.Controls.Add(this.cmb_ct_name);
		this.pl_ct.Location = new System.Drawing.Point(195, 127);
		this.pl_ct.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.pl_ct.Name = "pl_ct";
		this.pl_ct.Size = new System.Drawing.Size(587, 68);
		this.pl_ct.TabIndex = 29;
		this.pl_ip.Controls.Add(this.lb_em_ip);
		this.pl_ip.Controls.Add(this.tb_em_ip);
		this.pl_ip.Location = new System.Drawing.Point(593, 73);
		this.pl_ip.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.pl_ip.Name = "pl_ip";
		this.pl_ip.Size = new System.Drawing.Size(188, 50);
		this.pl_ip.TabIndex = 30;
		this.lb_em_ip.AutoSize = true;
		this.lb_em_ip.Location = new System.Drawing.Point(7, 5);
		this.lb_em_ip.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.lb_em_ip.Name = "lb_em_ip";
		this.lb_em_ip.Size = new System.Drawing.Size(74, 17);
		this.lb_em_ip.TabIndex = 1;
		this.lb_em_ip.Text = "ip address";
		this.tb_em_ip.Location = new System.Drawing.Point(8, 23);
		this.tb_em_ip.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.tb_em_ip.Masked = System.Windows.Forms.Mask.IpAddress;
		this.tb_em_ip.Name = "tb_em_ip";
		this.tb_em_ip.Size = new System.Drawing.Size(124, 22);
		this.tb_em_ip.TabIndex = 0;
		this.errorProvider1.ContainerControl = this;
		base.AutoScaleDimensions = new System.Drawing.SizeF(8f, 16f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.Controls.Add(this.pl_ip);
		base.Controls.Add(this.pl_ct);
		base.Controls.Add(this.cb_ct);
		base.Controls.Add(this.pl_ps);
		base.Controls.Add(this.cb_ps);
		base.Controls.Add(this.label1);
		base.Controls.Add(this.label9);
		base.Controls.Add(this.tb_em_pad);
		base.Controls.Add(this.label7);
		base.Controls.Add(this.cb_em_pad);
		base.Controls.Add(this.cb_em_remote);
		base.Controls.Add(this.cb_em_name);
		base.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		base.Name = "GpsPanel";
		base.Size = new System.Drawing.Size(787, 485);
		base.Load += new System.EventHandler(GPSPanel_Load);
		this.pl_ps.ResumeLayout(false);
		this.pl_ps.PerformLayout();
		this.pl_ct.ResumeLayout(false);
		this.pl_ct.PerformLayout();
		this.pl_ip.ResumeLayout(false);
		this.pl_ip.PerformLayout();
		((System.ComponentModel.ISupportInitialize)this.errorProvider1).EndInit();
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
