using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using MultiLanguageManger;
using ProductConfigurationController;
using QC.QMSCT.Language;
using QC.QTMSecurity;

namespace QC.QMSCT;

public class QMSCTMainForm : Form
{
	private const string PANEL = "PANEL";

	private const string DUT_INDEX = "DUT_INDEX";

	private const int number_global_variables = 1;

	private int selectedPanel = -1;

	private QMSCTUserMode qmsctMode;

	private IUnitDetector unitDetector;

	private AppConfiguration appConfiguration;

	private Scheduler roundRobinScheduler = new Scheduler();

	private QMSCTMultiLanguageManger language = new QMSCTMultiLanguageManger();

	private IContainer components;

	private MainMenu mainMenu1;

	private MenuItem menuFile;

	private MenuItem menuFileExit;

	private Panel panelTop;

	private Label lblInstructions;

	private Label lblVersion;

	private MenuItem menuOptions;

	private MenuItem menuOptionsShowAllQspr;

	private MenuItem menuOptionsHideAllQspr;

	private MenuItem menuSetup;

	private MenuItem menuSetupConfiguration;

	private MenuItem menuHelp;

	private MenuItem menuHelpAboutQMSCT;

	private MenuItem menuHelpQMSCTHelp;

	private MenuItem menuFileLogin;

	private MenuItem menuFileSecurityConfiguration;

	private Label lblProductConfiguration;

	private ConfigPanelCollection configPanelCollection;

	private Panel panelTestPanel;

	private Label lblXTTPath;

	private Label lblImagePath;

	private ProductConfigManager productConfigManager => appConfiguration.QmsctProductSetup;

	private StationConfiguration stationConfiguration => appConfiguration.QmsctStationSetup;

	private UnitProgrammerGenericSetup unitProgrammerGenericSetup => appConfiguration.QmsctUnitProgrammerGenericSetup;

	private string ConfigRootFolder => appConfiguration.ConfigRootFolder;

	private string Product
	{
		get
		{
			return appConfiguration.Product;
		}
		set
		{
			appConfiguration.Product = value;
		}
	}

	private string Configuration
	{
		get
		{
			return appConfiguration.Configuration;
		}
		set
		{
			appConfiguration.Configuration = value;
		}
	}

	private QMSCTMultiLanguageManger.Language CurrentLanguage
	{
		set
		{
			language.CurrentLanguage = value;
			UpdateGlobalLanguage(value);
		}
	}

	private event EventHandler OnExecutionAllComplete;

	private UnitProgrammerTechnicalSetup GetUnitProgrammerTechnicalSetup(int PanelIndex)
	{
		return appConfiguration.GetGetQmsctUnitProgrammerTechnicalSetup(PanelIndex);
	}

	public QMSCTMainForm(string[] args)
	{
		string text = "";
		string text2 = "";
		string text3 = "";
		foreach (string text4 in args)
		{
			if (text4.Equals("-e"))
			{
				qmsctMode = QMSCTUserMode.Engineering;
			}
			else if (text4.ToLower().StartsWith("pcfg:"))
			{
				if (!text4.Contains(","))
				{
					MessageBox.Show("Invalid parameter format, use pcfg:[product],[config]");
					continue;
				}
				text = text4.Substring(5, text4.IndexOf(',') - 5);
				text2 = text4.Substring(text4.IndexOf(',') + 1);
			}
			else if (text4.ToLower().StartsWith("copy:"))
			{
				text3 = text4.Substring(5);
			}
		}
		InitializeComponent();
		try
		{
			if (text3 != "")
			{
				if (File.Exists(text3))
				{
					string text5 = Path.Combine(ConfigRootFolder, text3);
					if (!File.Exists(text5) || MessageBox.Show(string.Format(CommonResource.BoxMsgProductConfigExist, text5), CommonResource.BoxTitleWarning, MessageBoxButtons.YesNo) != DialogResult.No)
					{
						File.Copy(text3, text5);
					}
				}
				else
				{
					MessageBox.Show(string.Format(CommonResource.BoxMsgFailToFindPCFGArg, text3));
				}
			}
		}
		catch
		{
		}
		try
		{
			appConfiguration = new AppConfiguration(text, text2);
			KillRougeProcesses();
			appConfiguration.QMSCTMode = qmsctMode;
			if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2))
			{
				appConfiguration.Product = text;
				appConfiguration.Configuration = text2;
				appConfiguration.SelectProductConfiguration(text, text2);
			}
			appConfiguration.OnAppConfigLanguageChanged += appConfiguration_OnAppConfigLanguageChanged;
			appConfiguration.OnAppConfigResetStationYield += appConfiguration_OnAppConfigResetStationYield;
			appConfiguration.OnAppConfigClosed += appConfiguration_OnAppConfigClosed;
			QSecurity.UserAccessLevelChanged += QMSCT_UserAccessLevelChanged;
			UpdateUIbyAccessLevel(QSecurity.UserAccessLevel);
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
			Environment.Exit(-1);
		}
	}

	private void SetGlobalLanguage(string Language)
	{
		if (Language == null)
		{
			Language = "";
		}
		if (Language.ToUpper().Equals("CHINESE"))
		{
			CurrentLanguage = QMSCTMultiLanguageManger.Language.CHINESE;
		}
		else
		{
			CurrentLanguage = QMSCTMultiLanguageManger.Language.ENGLISH;
		}
	}

	private void UpdateGlobalLanguage(QMSCTMultiLanguageManger.Language Language)
	{
		UpdateLanguage();
		appConfiguration.UpdateLanguage();
		configPanelCollection.UpdateLanguage(Language);
	}

	public void UpdateLanguage()
	{
		menuFile.Text = CommonResource.MenuFile;
		menuFileExit.Text = CommonResource.MenuFileExit;
		menuFileLogin.Text = CommonResource.MenuFileLogin;
		menuFileSecurityConfiguration.Text = CommonResource.MenuFileSecurityConfiguration;
		menuOptions.Text = CommonResource.MenuOptions;
		menuOptionsShowAllQspr.Text = CommonResource.MenuOptionsShowAllQspr;
		menuOptionsHideAllQspr.Text = CommonResource.MenuOptionsHideAllQspr;
		menuSetup.Text = CommonResource.MenuSetup;
		menuSetupConfiguration.Text = CommonResource.MenuSetupConfiguration;
		menuHelp.Text = CommonResource.MenuHelp;
		menuHelpAboutQMSCT.Text = CommonResource.MenuHelpAboutQMSCT;
		menuHelpQMSCTHelp.Text = CommonResource.MenuHelpQMSCTHelp;
		lblInstructions.Text = CommonResource.lblInstructions;
		lblVersion.Text = CommonResource.lblVersion + ": " + Application.ProductVersion;
		lblXTTPath.Text = CommonResource.lblTestPlanPath + " " + productConfigManager.TestPlanFilePath;
		if (productConfigManager.TechnologySpecificGV.ContainsKey(MULTIDUT_SWDL_UPDATER.BINARY_IMAGE_FOLDER_PATH))
		{
			lblImagePath.Text = CommonResource.GroupBox_ImageLocation + ": " + productConfigManager.TechnologySpecificGV[MULTIDUT_SWDL_UPDATER.BINARY_IMAGE_FOLDER_PATH];
		}
		else
		{
			lblImagePath.Text = "";
		}
		lblProductConfiguration.Text = productConfigManager.SelectedProduct + " - " + productConfigManager.SelectedConfiguration;
	}

	private void KillRougeProcesses()
	{
		try
		{
			bool flag = false;
			DialogResult dialogResult = DialogResult.OK;
			Process[] processesByName = Process.GetProcessesByName("qmsct");
			if (processesByName.Length > 1)
			{
				if (!flag)
				{
					string text = "It has been detected that other QMSCT instances and other rough process instances are running. Press OK to end those processes.";
					dialogResult = MessageBox.Show(text, CommonResource.BoxTitleRogueProcesses, MessageBoxButtons.OKCancel);
				}
				if (dialogResult == DialogResult.OK)
				{
					Process[] array = processesByName;
					foreach (Process process in array)
					{
						if (process.Id != Process.GetCurrentProcess().Id)
						{
							process.Kill();
						}
					}
				}
				else
				{
					Environment.Exit(0);
				}
			}
			if (appConfiguration.RougeProcess == null)
			{
				return;
			}
			string[] rougeProcess = appConfiguration.RougeProcess;
			foreach (string text2 in rougeProcess)
			{
				if (text2.ToLower() == "qmsct")
				{
					continue;
				}
				Process[] processesByName2 = Process.GetProcessesByName(text2);
				if (processesByName2.Length <= 0)
				{
					continue;
				}
				if (!flag)
				{
					string text3 = "It has been detected that other QMSCT instances and other rough process instances are running. Press OK to end those processes.";
					dialogResult = MessageBox.Show(text3, CommonResource.BoxTitleRogueProcesses, MessageBoxButtons.OKCancel);
				}
				if (dialogResult == DialogResult.OK)
				{
					Process[] array2 = processesByName2;
					foreach (Process process2 in array2)
					{
						process2.Kill();
					}
				}
				else
				{
					Environment.Exit(0);
				}
			}
		}
		catch (Exception ex)
		{
			MessageBox.Show(CommonResource.BoxMsgKillProcessFailed + " " + ex.Data);
		}
	}

	[STAThread]
	private static void Main(string[] args)
	{
		Form mainForm;
		try
		{
			SplashScreen_External splashScreen_External = new SplashScreen_External();
			splashScreen_External.ShowSplash();
			if (args.Length > 0)
			{
				bool flag = false;
				foreach (string text in args)
				{
					if (!text.Equals("-e") && !text.ToLower().EndsWith(".xml") && !text.ToLower().StartsWith("pcfg:") && !text.ToLower().StartsWith("copy:"))
					{
						flag = true;
					}
				}
				if (flag)
				{
					StringBuilder stringBuilder = new StringBuilder();
					stringBuilder.AppendLine();
					stringBuilder.AppendLine("QMSCT.exe <FILENAME1> [-e]");
					stringBuilder.AppendLine();
					stringBuilder.AppendLine(CommonResource.BoxMsgEngModeUsage);
					stringBuilder.AppendLine();
					stringBuilder.AppendLine(CommonResource.BoxMsgFileNameUsage);
					stringBuilder.AppendLine();
					stringBuilder.AppendLine(CommonResource.BoxMsgUseDefultConfig);
					stringBuilder.AppendLine();
					MessageBox.Show(stringBuilder.ToString(), CommonResource.BoxTitleQmsctUsage);
					return;
				}
			}
			mainForm = new QMSCTMainForm(args);
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message, "QMSCT");
			return;
		}
		Application.Run(mainForm);
	}

	private void Form_Load(object sender, EventArgs e)
	{
		try
		{
			lblInstructions.Text = CommonResource.lblInstructions;
			lblVersion.Text = CommonResource.lblVersion + " " + Application.ProductVersion;
			QSecurity.SetAccessLevel();
			this.OnExecutionAllComplete = AllTestIsDone;
			LoadFormDetails();
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
		}
	}

	private void LoadFormDetails()
	{
		Thread thread = new Thread(LoadFormDetailsThread);
		thread.Start();
	}

	private void LoadFormDetailsThread()
	{
		try
		{
			UIHelper.InvokeOnUIifRequired(this, delegate
			{
				menuSetup.Enabled = false;
				lblInstructions.Visible = true;
				lblXTTPath.Visible = false;
				lblProductConfiguration.Visible = false;
				configPanelCollection.NumPanels = stationConfiguration.NumberOfPanels;
				configPanelCollection.NumColumns = stationConfiguration.NumberOfColumns;
			});
			foreach (ConfigPanel item in configPanelCollection)
			{
				if (item != null)
				{
					if (!item.CreateUnitProgrammer(unitProgrammerGenericSetup, GetUnitProgrammerTechnicalSetup(item.PanelNumber)))
					{
						return;
					}
					item.ClearEvent();
					if (stationConfiguration.RunRoundRobinScheduling)
					{
						roundRobinScheduler.AssociatePanel(item);
					}
					item.OnModifyTestTimeout += configPanel_OnModifyTestTimeout;
					item.OnExecutionCompleted += configPanel_OnExecuteComplete;
					item.OnZoomSelect += configPanel_OnZoomSelect;
				}
			}
			configPanelCollection.ShowSameColor = stationConfiguration.ShowSameColor;
			if (stationConfiguration.GetSNFromEngine)
			{
				foreach (ConfigPanel configPanel in configPanelCollection)
				{
					if (configPanel != null)
					{
						UIHelper.InvokeOnUIifRequired(this, delegate
						{
							configPanel.SetSerialNumber_ReadOnly();
						});
					}
				}
			}
			UIHelper.InvokeOnUIifRequired(this, delegate
			{
				lblInstructions.Visible = false;
				menuSetup.Enabled = true;
				lblXTTPath.Visible = true;
				lblProductConfiguration.Visible = true;
				SetGlobalLanguage(stationConfiguration.AppLanguage);
				InitializeUnitDetector();
				ConfigUnitDetector();
				StartUnitDetector();
			});
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
		}
	}

	private void InitializeUnitDetector()
	{
		if (qmsctMode == QMSCTUserMode.Engineering && stationConfiguration.UseUSBSimulator)
		{
			if (unitDetector == null)
			{
				unitDetector = new DebugUnitDetector();
				unitDetector.SetEventMode = DetectionEventMode.DETECT_MODE_TIMER;
				unitDetector.OnChange += configPanel_SendActivePositionChangeEvent;
			}
			return;
		}
		if (unitDetector == null)
		{
			if (stationConfiguration.DetectionInstanceValue == DetectionInstance.DETECT_INST_NET_MODE)
			{
				unitDetector = new NetworkUnitDetector();
				unitDetector.OnChangeGV += configPanel_SendActivePositionChangeEvent_GV;
			}
			else
			{
				unitDetector = new UsbToSerialPortDetector();
				unitDetector.OnChange += configPanel_SendActivePositionChangeEvent;
			}
			unitDetector.SetEventMode = DetectionEventMode.DETECT_MODE_TIMER;
		}
		unitDetector.PortKeyWord.Clear();
	}

	private void ConfigUnitDetector()
	{
		unitDetector.SetDetectionInstance = stationConfiguration.DetectionInstanceValue;
		List<int> list = null;
		unitDetector.ExpectedListOfPhysicalAddress.Clear();
		unitDetector.ExpectedListOfPorts.Clear();
		foreach (ConfigPanel item in configPanelCollection)
		{
			if (stationConfiguration.PortMapping.Length >= item.PanelNumber)
			{
				int num = item.PanelNumber - 1;
				if (stationConfiguration.PortMapping[num].PanelNumber == item.PanelNumber)
				{
					if (stationConfiguration.DetectionInstanceValue == DetectionInstance.DETECT_INST_PHY_ADDR || stationConfiguration.DetectionInstanceValue == DetectionInstance.DETECT_INST_NET_MODE)
					{
						item.DetectionInstanceValue = ConfigPanel.DetectionInstance.DETECT_INST_PHY_ADDR;
					}
					else
					{
						item.DetectionInstanceValue = ConfigPanel.DetectionInstance.DETECT_INST_PORT_NO;
					}
					if (stationConfiguration.DetectionInstanceValue == DetectionInstance.DETECT_INST_NET_MODE)
					{
						string uSBPhysicalAddress = stationConfiguration.PortMapping[num].PortData.USBPhysicalAddress;
						item.Title = "NET " + uSBPhysicalAddress;
						item.ExpectedPhysicalAddress = uSBPhysicalAddress;
						unitDetector.ExpectedListOfPhysicalAddress.Add(num, uSBPhysicalAddress);
						continue;
					}
					if (stationConfiguration.DetectionInstanceValue == DetectionInstance.DETECT_INST_PHY_ADDR)
					{
						string uSBPhysicalAddress2 = stationConfiguration.PortMapping[num].PortData.USBPhysicalAddress;
						item.Title = "USB " + uSBPhysicalAddress2;
						item.ExpectedPhysicalAddress = uSBPhysicalAddress2;
						unitDetector.ExpectedListOfPhysicalAddress.Add(num, uSBPhysicalAddress2);
						continue;
					}
					int cOMPortAtStart = stationConfiguration.PortMapping[num].PortData.COMPortAtStart;
					int cOMPortAfterPowerCycle = stationConfiguration.PortMapping[num].PortData.COMPortAfterPowerCycle;
					item.ExpectedCOMPortAtStart = cOMPortAtStart;
					item.ExpectedCOMPortAfterPowerCycle = cOMPortAfterPowerCycle;
					item.Title = "COM PORT " + cOMPortAtStart;
					list = new List<int>();
					list.Add(cOMPortAtStart);
					list.Add(cOMPortAfterPowerCycle);
					unitDetector.ExpectedListOfPorts.Add(num, list.ToArray());
					continue;
				}
				throw new Exception("Panel number " + item.PanelNumber + "  from ConfigPanelCollection is not matching with PortManager");
			}
			throw new Exception("Physical port is not available for Panel Number : " + item.PanelNumber);
		}
	}

	private void StartUnitDetector()
	{
		unitDetector.Start();
	}

	private void StopUnitDetector()
	{
		unitDetector.Stop();
	}

	private void configPanel_SendActivePositionChangeEvent(int panel, bool connected, int portno)
	{
		configPanelCollection[panel].unitDetectorOnChanged(connected, portno);
	}

	private void configPanel_SendActivePositionChangeEvent_GV(int panel, bool connected, int portno, string GV)
	{
		configPanelCollection[panel].unitProgrammer.PanelSpecificGV = GV;
		configPanelCollection[panel].unitDetectorOnChanged(connected, portno);
	}

	private void configPanel_OnExecuteComplete(object obj)
	{
		try
		{
			foreach (ConfigPanel item in configPanelCollection)
			{
				if (item.TestRunning)
				{
					return;
				}
			}
			if (this.OnExecutionAllComplete != null)
			{
				this.OnExecutionAllComplete(this, null);
			}
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
		}
	}

	private void AllTestIsDone(object obj, EventArgs e)
	{
		if (appConfiguration.EnableAllDoneProcess)
		{
			string text = "CONTROLLER_NAME";
			string text2 = "";
			try
			{
				text2 = GetUnitProgrammerTechnicalSetup(0).TechnologySpecificGV[text];
			}
			catch (KeyNotFoundException ex)
			{
				MessageBox.Show("QMSCT GV " + text + " not found. Please review configuration and close QMSCT:" + ex.Message);
				return;
			}
			try
			{
				File.Move("C:\\TEMP\\qmsct_automation\\automationSynch.txt", text2);
			}
			catch (Exception ex2)
			{
				throw ex2;
			}
		}
	}

	private void configPanel_OnZoomSelect(bool isSelected, int panelNumber)
	{
		if (isSelected)
		{
			selectedPanel = panelNumber;
		}
		else if (selectedPanel == panelNumber)
		{
			selectedPanel = -1;
		}
	}

	private void menuFileExit_Click(object sender, EventArgs e)
	{
		Close();
	}

	private void Form_Closing(object sender, FormClosingEventArgs e)
	{
		DialogResult dialogResult = DialogResult.No;
		e.Cancel = false;
		foreach (ConfigPanel item in configPanelCollection)
		{
			if (item.TestRunning)
			{
				dialogResult = MessageBox.Show(CommonResource.BoxMsgConfirmClose, CommonResource.BoxTitleWarning, MessageBoxButtons.YesNo);
				if (dialogResult == DialogResult.No)
				{
					e.Cancel = true;
				}
				break;
			}
		}
	}

	private void menuItemShowAllQspr_Click(object sender, EventArgs e)
	{
		foreach (ConfigPanel item in configPanelCollection)
		{
			item.ShowQspr();
		}
	}

	private void menuItemHideAllQspr_Click(object sender, EventArgs e)
	{
		foreach (ConfigPanel item in configPanelCollection)
		{
			item.HideQspr();
		}
	}

	private void menuFileLogin_Click(object sender, EventArgs e)
	{
		try
		{
			DialogResult dialogResult;
			if (menuFileLogin.Text == CommonResource.MenuFileLogin)
			{
				if (!QSecurity.IsPasswordMode)
				{
					LoginScreen loginScreen = new LoginScreen();
					dialogResult = loginScreen.ShowDialog();
				}
				else
				{
					PasswordLoginScreen passwordLoginScreen = new PasswordLoginScreen(changingPassword: false);
					dialogResult = passwordLoginScreen.ShowDialog();
				}
				return;
			}
			dialogResult = MessageBox.Show(CommonResource.LogoutMsg, CommonResource.LogoutTitle, MessageBoxButtons.YesNo);
			if (dialogResult == DialogResult.Yes)
			{
				if (!QSecurity.IsPasswordMode)
				{
					QSecurity.Logout();
				}
				else
				{
					QSecurity.PasswordLogout();
				}
			}
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
		}
	}

	private void menuFileSecurityConfiguration_Click(object sender, EventArgs e)
	{
		ModifySettingsDialog modifySettingsDialog = new ModifySettingsDialog();
		modifySettingsDialog.ShowDialog();
		UpdateUIbyAccessLevel(QSecurity.UserAccessLevel);
	}

	private void UpdateUIbyAccessLevel(AccessLevel userAccessLevel)
	{
		switch (userAccessLevel)
		{
		case AccessLevel.Engineer:
			menuSetup.Visible = true;
			appConfiguration.ShowAllOption = true;
			menuFileSecurityConfiguration.Visible = true;
			Security_EnableAllContenxtMenu(enable: true);
			break;
		case AccessLevel.Technician:
			menuSetup.Visible = true;
			appConfiguration.ShowAllOption = false;
			menuFileSecurityConfiguration.Visible = false;
			Security_EnableAllContenxtMenu(enable: true);
			break;
		default:
			menuSetup.Visible = false;
			appConfiguration.ShowAllOption = false;
			menuFileSecurityConfiguration.Visible = false;
			Security_EnableAllContenxtMenu(enable: false);
			break;
		}
		if (QSecurity.IsPasswordMode)
		{
			if (userAccessLevel != 0)
			{
				menuFileLogin.Text = CommonResource.MenuFileLogout;
			}
			else
			{
				menuFileLogin.Text = CommonResource.MenuFileLogin;
			}
		}
		else
		{
			menuFileLogin.Text = CommonResource.MenuFileLogin;
		}
		if (QSecurity.IsSecurityDisabled)
		{
			menuFileLogin.Enabled = false;
		}
		else
		{
			menuFileLogin.Enabled = true;
		}
	}

	private void QMSCT_UserAccessLevelChanged(object sender, UserAccessLevelChangedEventArgs e)
	{
		UpdateUIbyAccessLevel(e.UserAccessLevel);
	}

	private void Security_EnableAllContenxtMenu(bool enable)
	{
		foreach (ConfigPanel item in configPanelCollection)
		{
			item.Security_EnableContextMenu(enable);
		}
	}

	private void configPanel_OnModifyTestTimeout(string timeout)
	{
		productConfigManager.TestTimeoutSeconds = int.Parse(timeout);
		productConfigManager.Save();
	}

	private void menuItem_Configuration_Click(object sender, EventArgs e)
	{
		try
		{
			foreach (ConfigPanel item in configPanelCollection)
			{
				if (item.TestRunning)
				{
					MessageBox.Show(CommonResource.BoxMsgTestIsRunning, CommonResource.BoxTitleTestIsRunning);
					return;
				}
			}
			StopUnitDetector();
			appConfiguration.ShowDialog();
			LoadFormDetails();
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
		}
	}

	private void appConfiguration_OnAppConfigLanguageChanged(string Language)
	{
		SetGlobalLanguage(Language);
	}

	private void appConfiguration_OnAppConfigResetStationYield()
	{
		if (MessageBox.Show(CommonResource.BoxMsgResetStationYield, CommonResource.BoxTitleWarning, MessageBoxButtons.YesNo) != DialogResult.Yes)
		{
			return;
		}
		foreach (ConfigPanel item in configPanelCollection)
		{
			item.ResetStationYield();
		}
	}

	private void appConfiguration_OnAppConfigClosed()
	{
		foreach (ConfigPanel item in configPanelCollection)
		{
			item.ResetLastCompletionTime();
		}
	}

	private void menuItem_AboutQMSCT_Click(object sender, EventArgs e)
	{
		try
		{
			AboutForm aboutForm = new AboutForm();
			aboutForm.ShowDialog();
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
		}
	}

	private void menuItem_QMSCTHelp_Click(object sender, EventArgs e)
	{
		try
		{
			string text = "https://createpoint.qti.qualcomm.com/search/#search/80-VL903-1";
			if (MessageBox.Show(CommonResource.BoxMsgManualUrl + "\r\n\r\n" + text, "", MessageBoxButtons.YesNo) == DialogResult.Yes)
			{
				Process.Start(text);
			}
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
		}
	}

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

	private void InitializeComponent()
	{
		this.components = new System.ComponentModel.Container();
		System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(QC.QMSCT.QMSCTMainForm));
		this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
		this.menuFile = new System.Windows.Forms.MenuItem();
		this.menuFileExit = new System.Windows.Forms.MenuItem();
		this.menuFileLogin = new System.Windows.Forms.MenuItem();
		this.menuFileSecurityConfiguration = new System.Windows.Forms.MenuItem();
		this.menuOptions = new System.Windows.Forms.MenuItem();
		this.menuOptionsShowAllQspr = new System.Windows.Forms.MenuItem();
		this.menuOptionsHideAllQspr = new System.Windows.Forms.MenuItem();
		this.menuSetup = new System.Windows.Forms.MenuItem();
		this.menuSetupConfiguration = new System.Windows.Forms.MenuItem();
		this.menuHelp = new System.Windows.Forms.MenuItem();
		this.menuHelpAboutQMSCT = new System.Windows.Forms.MenuItem();
		this.menuHelpQMSCTHelp = new System.Windows.Forms.MenuItem();
		this.panelTop = new System.Windows.Forms.Panel();
		this.lblImagePath = new System.Windows.Forms.Label();
		this.lblXTTPath = new System.Windows.Forms.Label();
		this.lblProductConfiguration = new System.Windows.Forms.Label();
		this.lblVersion = new System.Windows.Forms.Label();
		this.lblInstructions = new System.Windows.Forms.Label();
		this.panelTestPanel = new System.Windows.Forms.Panel();
		this.configPanelCollection = new QC.QMSCT.ConfigPanelCollection();
		this.panelTop.SuspendLayout();
		this.panelTestPanel.SuspendLayout();
		base.SuspendLayout();
		this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[4] { this.menuFile, this.menuOptions, this.menuSetup, this.menuHelp });
		this.menuFile.Index = 0;
		this.menuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[3] { this.menuFileExit, this.menuFileLogin, this.menuFileSecurityConfiguration });
		this.menuFile.Text = "&File";
		this.menuFileExit.Index = 0;
		this.menuFileExit.Text = "E&xit";
		this.menuFileExit.Click += new System.EventHandler(menuFileExit_Click);
		this.menuFileLogin.Index = 1;
		this.menuFileLogin.Text = "Login";
		this.menuFileLogin.Click += new System.EventHandler(menuFileLogin_Click);
		this.menuFileSecurityConfiguration.Index = 2;
		this.menuFileSecurityConfiguration.Text = "Security Configuration";
		this.menuFileSecurityConfiguration.Click += new System.EventHandler(menuFileSecurityConfiguration_Click);
		this.menuOptions.Index = 1;
		this.menuOptions.MenuItems.AddRange(new System.Windows.Forms.MenuItem[2] { this.menuOptionsShowAllQspr, this.menuOptionsHideAllQspr });
		this.menuOptions.Text = "Options";
		this.menuOptions.Visible = false;
		this.menuOptionsShowAllQspr.Index = 0;
		this.menuOptionsShowAllQspr.Text = "ShowAllQspr";
		this.menuOptionsShowAllQspr.Click += new System.EventHandler(menuItemShowAllQspr_Click);
		this.menuOptionsHideAllQspr.Index = 1;
		this.menuOptionsHideAllQspr.Text = "HideAllQspr";
		this.menuOptionsHideAllQspr.Click += new System.EventHandler(menuItemHideAllQspr_Click);
		this.menuSetup.Index = 2;
		this.menuSetup.MenuItems.AddRange(new System.Windows.Forms.MenuItem[1] { this.menuSetupConfiguration });
		this.menuSetup.Text = "Setup";
		this.menuSetupConfiguration.Index = 0;
		this.menuSetupConfiguration.Text = "Configuration";
		this.menuSetupConfiguration.Click += new System.EventHandler(menuItem_Configuration_Click);
		this.menuHelp.Index = 3;
		this.menuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[2] { this.menuHelpAboutQMSCT, this.menuHelpQMSCTHelp });
		this.menuHelp.Text = "Help";
		this.menuHelpAboutQMSCT.Index = 0;
		this.menuHelpAboutQMSCT.Text = "About QMSCT";
		this.menuHelpAboutQMSCT.Click += new System.EventHandler(menuItem_AboutQMSCT_Click);
		this.menuHelpQMSCTHelp.Index = 1;
		this.menuHelpQMSCTHelp.Text = "QMSCT Help";
		this.menuHelpQMSCTHelp.Click += new System.EventHandler(menuItem_QMSCTHelp_Click);
		this.panelTop.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
		this.panelTop.Controls.Add(this.lblImagePath);
		this.panelTop.Controls.Add(this.lblXTTPath);
		this.panelTop.Controls.Add(this.lblProductConfiguration);
		this.panelTop.Controls.Add(this.lblVersion);
		this.panelTop.Controls.Add(this.lblInstructions);
		this.panelTop.Dock = System.Windows.Forms.DockStyle.Top;
		this.panelTop.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.panelTop.Location = new System.Drawing.Point(0, 0);
		this.panelTop.Name = "panelTop";
		this.panelTop.Size = new System.Drawing.Size(1218, 64);
		this.panelTop.TabIndex = 2;
		this.lblImagePath.AutoSize = true;
		this.lblImagePath.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
		this.lblImagePath.Location = new System.Drawing.Point(3, 44);
		this.lblImagePath.Name = "lblImagePath";
		this.lblImagePath.Size = new System.Drawing.Size(67, 13);
		this.lblImagePath.TabIndex = 7;
		this.lblImagePath.Text = "ImagePath";
		this.lblXTTPath.AutoSize = true;
		this.lblXTTPath.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
		this.lblXTTPath.Location = new System.Drawing.Point(3, 27);
		this.lblXTTPath.Name = "lblXTTPath";
		this.lblXTTPath.Size = new System.Drawing.Size(57, 13);
		this.lblXTTPath.TabIndex = 6;
		this.lblXTTPath.Text = "XTTPath";
		this.lblProductConfiguration.AutoSize = true;
		this.lblProductConfiguration.ForeColor = System.Drawing.SystemColors.Highlight;
		this.lblProductConfiguration.Location = new System.Drawing.Point(3, 9);
		this.lblProductConfiguration.Name = "lblProductConfiguration";
		this.lblProductConfiguration.Size = new System.Drawing.Size(52, 13);
		this.lblProductConfiguration.TabIndex = 5;
		this.lblProductConfiguration.Text = "PrdoCfg";
		this.lblVersion.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
		this.lblVersion.AutoSize = true;
		this.lblVersion.Location = new System.Drawing.Point(963, 9);
		this.lblVersion.Name = "lblVersion";
		this.lblVersion.Size = new System.Drawing.Size(49, 13);
		this.lblVersion.TabIndex = 2;
		this.lblVersion.Text = "Version";
		this.lblInstructions.Anchor = System.Windows.Forms.AnchorStyles.Top;
		this.lblInstructions.AutoSize = true;
		this.lblInstructions.ForeColor = System.Drawing.Color.Red;
		this.lblInstructions.Location = new System.Drawing.Point(538, 9);
		this.lblInstructions.Name = "lblInstructions";
		this.lblInstructions.Size = new System.Drawing.Size(135, 13);
		this.lblInstructions.TabIndex = 0;
		this.lblInstructions.Text = "Initializing Application ";
		this.panelTestPanel.AutoSize = true;
		this.panelTestPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
		this.panelTestPanel.Controls.Add(this.configPanelCollection);
		this.panelTestPanel.Dock = System.Windows.Forms.DockStyle.Fill;
		this.panelTestPanel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.panelTestPanel.Location = new System.Drawing.Point(0, 64);
		this.panelTestPanel.Name = "panelTestPanel";
		this.panelTestPanel.Size = new System.Drawing.Size(1218, 499);
		this.panelTestPanel.TabIndex = 5;
		this.configPanelCollection.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
		this.configPanelCollection.Dock = System.Windows.Forms.DockStyle.Fill;
		this.configPanelCollection.Location = new System.Drawing.Point(0, 0);
		this.configPanelCollection.Name = "configPanelCollection";
		this.configPanelCollection.NumColumns = 4;
		this.configPanelCollection.NumPanels = 4;
		this.configPanelCollection.ShowSameColor = false;
		this.configPanelCollection.ShowVerticalBars = false;
		this.configPanelCollection.Size = new System.Drawing.Size(1218, 499);
		this.configPanelCollection.TabIndex = 0;
		this.configPanelCollection.Title = "Program";
		this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
		base.ClientSize = new System.Drawing.Size(1218, 563);
		base.Controls.Add(this.panelTestPanel);
		base.Controls.Add(this.panelTop);
		base.Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
		base.Menu = this.mainMenu1;
		base.Name = "QMSCTMainForm";
		this.Text = "QMSCT";
		base.WindowState = System.Windows.Forms.FormWindowState.Maximized;
		base.FormClosing += new System.Windows.Forms.FormClosingEventHandler(Form_Closing);
		base.Load += new System.EventHandler(Form_Load);
		this.panelTop.ResumeLayout(false);
		this.panelTop.PerformLayout();
		this.panelTestPanel.ResumeLayout(false);
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
