using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using QC.QTMInterface;

namespace QC.QTMApplication;

public class GoNoGoResults : Form
{
	private Button btnOk;

	private TableLayoutPanel tableLayoutPanel1;

	private Panel panel1;

	private Label lblResult;

	private RichTextBox txtFail;

	private Container components;

	private TestResult result = TestResult.Passed;

	private string failedTests = "";

	private bool showFailedTests;

	public TestResult Result
	{
		set
		{
			result = value;
		}
	}

	public string FailedTests
	{
		get
		{
			return failedTests;
		}
		set
		{
			failedTests = value;
		}
	}

	public bool ShowFailedTests
	{
		get
		{
			return showFailedTests;
		}
		set
		{
			showFailedTests = value;
		}
	}

	public GoNoGoResults()
	{
		InitializeComponent();
	}

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

	private void InitializeComponent()
	{
		System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(QC.QTMApplication.GoNoGoResults));
		this.btnOk = new System.Windows.Forms.Button();
		this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
		this.lblResult = new System.Windows.Forms.Label();
		this.panel1 = new System.Windows.Forms.Panel();
		this.tableLayoutPanel1.SuspendLayout();
		this.panel1.SuspendLayout();
		base.SuspendLayout();
		this.btnOk.BackColor = System.Drawing.SystemColors.Control;
		this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
		this.btnOk.Location = new System.Drawing.Point(162, 15);
		this.btnOk.Name = "btnOk";
		this.btnOk.Size = new System.Drawing.Size(75, 23);
		this.btnOk.TabIndex = 1;
		this.btnOk.Text = "OK";
		this.btnOk.UseVisualStyleBackColor = true;
		this.btnOk.Click += new System.EventHandler(btnOk_Click);
		this.tableLayoutPanel1.AutoSize = true;
		this.tableLayoutPanel1.BackColor = System.Drawing.SystemColors.Control;
		this.tableLayoutPanel1.ColumnCount = 1;
		this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50f));
		this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50f));
		this.tableLayoutPanel1.Controls.Add(this.lblResult, 0, 0);
		this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
		this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
		this.tableLayoutPanel1.Name = "tableLayoutPanel1";
		this.tableLayoutPanel1.RowCount = 1;
		this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50f));
		this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 125f));
		this.tableLayoutPanel1.Size = new System.Drawing.Size(372, 125);
		this.tableLayoutPanel1.TabIndex = 1;
		this.lblResult.AutoSize = true;
		this.lblResult.BackColor = System.Drawing.SystemColors.Control;
		this.lblResult.Dock = System.Windows.Forms.DockStyle.Fill;
		this.lblResult.Font = new System.Drawing.Font("Microsoft Sans Serif", 40f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.lblResult.Location = new System.Drawing.Point(3, 0);
		this.lblResult.Name = "lblResult";
		this.lblResult.Size = new System.Drawing.Size(366, 125);
		this.lblResult.TabIndex = 0;
		this.lblResult.Text = "PASSED";
		this.lblResult.TextAlign = System.Drawing.ContentAlignment.TopCenter;
		this.lblResult.UseCompatibleTextRendering = true;
		this.panel1.BackColor = System.Drawing.SystemColors.Control;
		this.panel1.Controls.Add(this.btnOk);
		this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
		this.panel1.Location = new System.Drawing.Point(0, 76);
		this.panel1.Name = "panel1";
		this.panel1.Size = new System.Drawing.Size(372, 49);
		this.panel1.TabIndex = 3;
		this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
		this.AutoSize = true;
		this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
		base.ClientSize = new System.Drawing.Size(372, 125);
		base.Controls.Add(this.panel1);
		base.Controls.Add(this.tableLayoutPanel1);
		this.ForeColor = System.Drawing.Color.ForestGreen;
		base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
		base.Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
		base.MaximizeBox = false;
		base.Name = "GoNoGoResults";
		base.ShowIcon = false;
		base.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
		this.Text = "QSPR - GoNoGo";
		base.TopMost = true;
		base.Load += new System.EventHandler(GoNoGoResults_Load);
		this.tableLayoutPanel1.ResumeLayout(false);
		this.tableLayoutPanel1.PerformLayout();
		this.panel1.ResumeLayout(false);
		base.ResumeLayout(false);
		base.PerformLayout();
	}

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

	private void GoNoGoResults_Load(object sender, EventArgs e)
	{
		if (result == TestResult.Passed)
		{
			lblResult.Text = "   PASSED";
			lblResult.ForeColor = Color.SeaGreen;
			return;
		}
		if (showFailedTests)
		{
			txtFail = new RichTextBox();
			txtFail.Location = new Point(3, 65);
			txtFail.ReadOnly = true;
			txtFail.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
			txtFail.Size = new Size(420, 75);
			txtFail.TabIndex = 1;
			txtFail.Text = FailedTests;
			tableLayoutPanel1.Controls.Add(txtFail, 0, 1);
			tableLayoutPanel1.RowCount = 2;
			tableLayoutPanel1.Controls.Add(txtFail);
		}
		switch (result)
		{
		case TestResult.Failed:
		case TestResult.Exception:
			lblResult.Text = "Failed";
			break;
		case TestResult.IgnoreSession:
			lblResult.Text = "Session Ignored";
			break;
		default:
			lblResult.Text = result.ToString();
			break;
		}
		lblResult.ForeColor = Color.Crimson;
	}
}
