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

namespace QC.QTMApplication;

public class TextLimitDialog : Form
{
	private const int No_Limit = -1;

	private IContainer components;

	private Button buttonCancel;

	private Button buttonOk;

	private ComboBox comboBoxTextLimit;

	private Label label1;

	public int MaxDisplayDebugCharacters
	{
		get
		{
			int result = -1;
			if (comboBoxTextLimit.SelectedItem.ToString() == "No Limit")
			{
				result = -1;
			}
			else
			{
				int.TryParse(comboBoxTextLimit.SelectedItem.ToString(), out result);
			}
			return result;
		}
		set
		{
			if (value == -1)
			{
				comboBoxTextLimit.SelectedItem = "No Limit";
			}
			else
			{
				comboBoxTextLimit.SelectedItem = value.ToString();
			}
		}
	}

	public TextLimitDialog(int noOfCharacters)
	{
		InitializeComponent();
		MaxDisplayDebugCharacters = noOfCharacters;
	}

	private void buttonOk_Click(object sender, EventArgs e)
	{
		base.DialogResult = DialogResult.OK;
		Close();
	}

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

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

	private void InitializeComponent()
	{
		this.buttonCancel = new System.Windows.Forms.Button();
		this.buttonOk = new System.Windows.Forms.Button();
		this.comboBoxTextLimit = new System.Windows.Forms.ComboBox();
		this.label1 = new System.Windows.Forms.Label();
		base.SuspendLayout();
		this.buttonCancel.Location = new System.Drawing.Point(180, 71);
		this.buttonCancel.Name = "buttonCancel";
		this.buttonCancel.Size = new System.Drawing.Size(75, 23);
		this.buttonCancel.TabIndex = 0;
		this.buttonCancel.Text = "Cancel";
		this.buttonCancel.UseVisualStyleBackColor = true;
		this.buttonCancel.Click += new System.EventHandler(buttonCancel_Click);
		this.buttonOk.Location = new System.Drawing.Point(99, 71);
		this.buttonOk.Name = "buttonOk";
		this.buttonOk.Size = new System.Drawing.Size(75, 23);
		this.buttonOk.TabIndex = 1;
		this.buttonOk.Text = "OK";
		this.buttonOk.UseVisualStyleBackColor = true;
		this.buttonOk.Click += new System.EventHandler(buttonOk_Click);
		this.comboBoxTextLimit.AllowDrop = true;
		this.comboBoxTextLimit.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.comboBoxTextLimit.FormattingEnabled = true;
		this.comboBoxTextLimit.Items.AddRange(new object[4] { "1200000", "1500000", "1800000", "No Limit" });
		this.comboBoxTextLimit.Location = new System.Drawing.Point(16, 35);
		this.comboBoxTextLimit.Name = "comboBoxTextLimit";
		this.comboBoxTextLimit.Size = new System.Drawing.Size(239, 21);
		this.comboBoxTextLimit.TabIndex = 2;
		this.label1.AutoSize = true;
		this.label1.Location = new System.Drawing.Point(13, 13);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(204, 13);
		this.label1.TabIndex = 3;
		this.label1.Text = "Maximum number of characters to display:";
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		this.AutoSize = true;
		base.ClientSize = new System.Drawing.Size(264, 105);
		base.Controls.Add(this.label1);
		base.Controls.Add(this.comboBoxTextLimit);
		base.Controls.Add(this.buttonOk);
		base.Controls.Add(this.buttonCancel);
		base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
		base.MaximizeBox = false;
		base.MinimizeBox = false;
		base.Name = "TextLimitDialog";
		base.ShowIcon = false;
		base.ShowInTaskbar = false;
		base.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
		this.Text = "Debug Text Limit";
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
