using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using QCRPG.TSL.BT.Packets;

namespace QCRPG.TSL.BT;

public class ScanMode : Form
{
	private bool InterlacedPageScan;

	private bool InterlacedInquiryScan;

	private WriteScanEnable.UserFieldsWrapper.ScanEnableEnum ScanEnable = WriteScanEnable.UserFieldsWrapper.ScanEnableEnum.BOTH_SCANS_ENABLED;

	private IContainer components;

	private Button oKButton;

	private Button cancelButton;

	private ComboBox scanModeComboBox;

	private Label label1;

	private CheckBox interlacedInquiryScanCheckBox;

	private CheckBox interlacedPageScanCheckBox;

	public bool interlacedPageScan
	{
		get
		{
			return InterlacedPageScan;
		}
		set
		{
			InterlacedPageScan = value;
		}
	}

	public bool interlacedInquiryScan
	{
		get
		{
			return InterlacedInquiryScan;
		}
		set
		{
			InterlacedInquiryScan = value;
		}
	}

	public WriteScanEnable.UserFieldsWrapper.ScanEnableEnum scanEnable
	{
		get
		{
			return ScanEnable;
		}
		set
		{
			ScanEnable = value;
		}
	}

	public ScanMode()
	{
		InitializeComponent();
	}

	private void ScanMode_Load(object sender, EventArgs e)
	{
		scanModeComboBox.DataSource = Enum.GetValues(typeof(WriteScanEnable.UserFieldsWrapper.ScanEnableEnum));
		scanModeComboBox.SelectedIndex = (int)ScanEnable;
	}

	private void oKButton_Click(object sender, EventArgs e)
	{
		ScanEnable = (WriteScanEnable.UserFieldsWrapper.ScanEnableEnum)scanModeComboBox.SelectedIndex;
	}

	private void cancelButton_Click(object sender, EventArgs e)
	{
		Hide();
	}

	private void scanModeComboBox_SelectedIndexChanged(object sender, EventArgs e)
	{
		switch (scanModeComboBox.SelectedItem.ToString())
		{
		case "RESERVED":
		case "InvalidScanEnableValue":
			scanModeComboBox.SelectedIndex = 3;
			break;
		}
	}

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

	private void InitializeComponent()
	{
		this.oKButton = new System.Windows.Forms.Button();
		this.cancelButton = new System.Windows.Forms.Button();
		this.scanModeComboBox = new System.Windows.Forms.ComboBox();
		this.label1 = new System.Windows.Forms.Label();
		this.interlacedInquiryScanCheckBox = new System.Windows.Forms.CheckBox();
		this.interlacedPageScanCheckBox = new System.Windows.Forms.CheckBox();
		base.SuspendLayout();
		this.oKButton.DialogResult = System.Windows.Forms.DialogResult.OK;
		this.oKButton.Location = new System.Drawing.Point(54, 192);
		this.oKButton.Name = "oKButton";
		this.oKButton.Size = new System.Drawing.Size(75, 23);
		this.oKButton.TabIndex = 0;
		this.oKButton.Text = "OK";
		this.oKButton.UseVisualStyleBackColor = true;
		this.oKButton.Click += new System.EventHandler(oKButton_Click);
		this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
		this.cancelButton.Location = new System.Drawing.Point(200, 192);
		this.cancelButton.Name = "cancelButton";
		this.cancelButton.Size = new System.Drawing.Size(75, 23);
		this.cancelButton.TabIndex = 1;
		this.cancelButton.Text = "Cancel";
		this.cancelButton.UseVisualStyleBackColor = true;
		this.cancelButton.Click += new System.EventHandler(cancelButton_Click);
		this.scanModeComboBox.FormattingEnabled = true;
		this.scanModeComboBox.Location = new System.Drawing.Point(112, 37);
		this.scanModeComboBox.Name = "scanModeComboBox";
		this.scanModeComboBox.Size = new System.Drawing.Size(163, 21);
		this.scanModeComboBox.TabIndex = 2;
		this.scanModeComboBox.SelectedIndexChanged += new System.EventHandler(scanModeComboBox_SelectedIndexChanged);
		this.label1.AutoSize = true;
		this.label1.Location = new System.Drawing.Point(38, 40);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(68, 13);
		this.label1.TabIndex = 3;
		this.label1.Text = "Enable Scan";
		this.interlacedInquiryScanCheckBox.AutoSize = true;
		this.interlacedInquiryScanCheckBox.Location = new System.Drawing.Point(54, 78);
		this.interlacedInquiryScanCheckBox.Name = "interlacedInquiryScanCheckBox";
		this.interlacedInquiryScanCheckBox.Size = new System.Drawing.Size(135, 17);
		this.interlacedInquiryScanCheckBox.TabIndex = 4;
		this.interlacedInquiryScanCheckBox.Text = "Interlaced Inquiry Scan";
		this.interlacedInquiryScanCheckBox.UseVisualStyleBackColor = true;
		this.interlacedPageScanCheckBox.AutoSize = true;
		this.interlacedPageScanCheckBox.Location = new System.Drawing.Point(54, 125);
		this.interlacedPageScanCheckBox.Name = "interlacedPageScanCheckBox";
		this.interlacedPageScanCheckBox.Size = new System.Drawing.Size(129, 17);
		this.interlacedPageScanCheckBox.TabIndex = 5;
		this.interlacedPageScanCheckBox.Text = "Interlaced Page Scan";
		this.interlacedPageScanCheckBox.UseVisualStyleBackColor = true;
		base.AcceptButton = this.oKButton;
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.CancelButton = this.cancelButton;
		base.ClientSize = new System.Drawing.Size(323, 249);
		base.Controls.Add(this.interlacedPageScanCheckBox);
		base.Controls.Add(this.interlacedInquiryScanCheckBox);
		base.Controls.Add(this.label1);
		base.Controls.Add(this.scanModeComboBox);
		base.Controls.Add(this.cancelButton);
		base.Controls.Add(this.oKButton);
		base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
		base.MaximizeBox = false;
		base.MinimizeBox = false;
		base.Name = "ScanMode";
		base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
		this.Text = "Scan Mode";
		base.Load += new System.EventHandler(ScanMode_Load);
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
