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

namespace QC.TestResultsLite;

public class ExcelGroupName : Form
{
	private ErrorProvider errorProvider1;

	private Button ultraButtonOK;

	private TextBox txtGroupName;

	private Label label1;

	private IContainer components;

	public string GroupName
	{
		get
		{
			return txtGroupName.Text.Trim();
		}
		set
		{
			txtGroupName.Text = value;
		}
	}

	public ExcelGroupName()
	{
		InitializeComponent();
	}

	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.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components);
		this.ultraButtonOK = new System.Windows.Forms.Button();
		this.txtGroupName = new System.Windows.Forms.TextBox();
		this.label1 = new System.Windows.Forms.Label();
		((System.ComponentModel.ISupportInitialize)this.errorProvider1).BeginInit();
		base.SuspendLayout();
		this.errorProvider1.ContainerControl = this;
		this.ultraButtonOK.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
		this.ultraButtonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
		this.ultraButtonOK.Location = new System.Drawing.Point(108, 58);
		this.ultraButtonOK.Name = "ultraButtonOK";
		this.ultraButtonOK.Size = new System.Drawing.Size(75, 23);
		this.ultraButtonOK.TabIndex = 1;
		this.ultraButtonOK.Text = "Ok";
		this.ultraButtonOK.Click += new System.EventHandler(ultraButtonOK_Click);
		this.txtGroupName.Location = new System.Drawing.Point(53, 32);
		this.txtGroupName.Name = "txtGroupName";
		this.txtGroupName.Size = new System.Drawing.Size(184, 20);
		this.txtGroupName.TabIndex = 6;
		this.label1.ForeColor = System.Drawing.Color.Red;
		this.label1.Location = new System.Drawing.Point(7, 8);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(276, 21);
		this.label1.TabIndex = 7;
		this.label1.Text = "Excel data differs. Please choose new sheet name.";
		this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
		base.AcceptButton = this.ultraButtonOK;
		this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
		this.BackColor = System.Drawing.Color.White;
		base.ClientSize = new System.Drawing.Size(290, 88);
		base.ControlBox = false;
		base.Controls.Add(this.label1);
		base.Controls.Add(this.txtGroupName);
		base.Controls.Add(this.ultraButtonOK);
		base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
		base.Name = "ExcelGroupName";
		base.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
		this.Text = "Excel Sheet Name";
		base.TopMost = true;
		base.Closing += new System.ComponentModel.CancelEventHandler(ExcelGroupName_Closing);
		((System.ComponentModel.ISupportInitialize)this.errorProvider1).EndInit();
		base.ResumeLayout(false);
		base.PerformLayout();
	}

	private void ultraButtonOK_Click(object sender, EventArgs e)
	{
		if (txtGroupName.Text.Trim().Length != 0)
		{
			Close();
		}
	}

	private void txtGroupName_TextChanged(object sender, EventArgs e)
	{
		if (txtGroupName.Text.Trim().Length != 0)
		{
			errorProvider1.SetError(txtGroupName, "");
		}
	}

	private void ExcelGroupName_Closing(object sender, CancelEventArgs e)
	{
		if (base.DialogResult == DialogResult.OK && !SerialConfig.ValidateGroupName(txtGroupName.Text))
		{
			e.Cancel = true;
		}
	}
}
