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

namespace QCRPG.TSL.ZigBee;

public class ZigBeeBeaconParameters : Form
{
	private uint channelId;

	private uint panId;

	private uint superFrameOrder;

	private uint beaconOrder;

	private bool isPanCoordinator;

	private uint assignShortAddress;

	private IContainer components;

	private TextBox channelIdTextBox;

	private Label label1;

	private Label label2;

	private TextBox panIdTextBox;

	private Label label3;

	private TextBox superFrameOrderTextBox;

	private CheckBox panCoordCheckBox;

	private Button okButton;

	private Button cancelButton;

	private Label label4;

	private TextBox beaconOrderTextBox;

	private Label label5;

	private TextBox assignShortAddressTextBox;

	public uint ChannelId
	{
		get
		{
			return channelId;
		}
		set
		{
			channelId = value;
		}
	}

	public uint PanId
	{
		get
		{
			return panId;
		}
		set
		{
			panId = value;
		}
	}

	public uint SuperFrameOrder
	{
		get
		{
			return superFrameOrder;
		}
		set
		{
			superFrameOrder = value;
		}
	}

	public uint BeaconOrder
	{
		get
		{
			return beaconOrder;
		}
		set
		{
			beaconOrder = value;
		}
	}

	public bool IsPanCoordinator
	{
		get
		{
			return isPanCoordinator;
		}
		set
		{
			isPanCoordinator = value;
		}
	}

	public uint AssignShortAddress
	{
		get
		{
			return assignShortAddress;
		}
		set
		{
			assignShortAddress = value;
		}
	}

	public ZigBeeBeaconParameters()
	{
		InitializeComponent();
	}

	private void ZigBeeBeaconParameters_Load(object sender, EventArgs e)
	{
		channelIdTextBox.Text = channelId.ToString("X2");
		panIdTextBox.Text = panId.ToString("X4");
		superFrameOrderTextBox.Text = superFrameOrder.ToString("X2");
		beaconOrderTextBox.Text = beaconOrder.ToString("X2");
		panCoordCheckBox.Checked = isPanCoordinator;
		assignShortAddressTextBox.Text = assignShortAddress.ToString("X4");
	}

	private void okButton_Click(object sender, EventArgs e)
	{
		uint.TryParse(channelIdTextBox.Text, NumberStyles.HexNumber, null, out channelId);
		uint.TryParse(panIdTextBox.Text, NumberStyles.HexNumber, null, out panId);
		uint.TryParse(superFrameOrderTextBox.Text, NumberStyles.HexNumber, null, out superFrameOrder);
		uint.TryParse(beaconOrderTextBox.Text, NumberStyles.HexNumber, null, out beaconOrder);
		uint.TryParse(assignShortAddressTextBox.Text, NumberStyles.HexNumber, null, out assignShortAddress);
		isPanCoordinator = panCoordCheckBox.Checked;
	}

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

	private void InitializeComponent()
	{
		this.channelIdTextBox = new System.Windows.Forms.TextBox();
		this.label1 = new System.Windows.Forms.Label();
		this.label2 = new System.Windows.Forms.Label();
		this.panIdTextBox = new System.Windows.Forms.TextBox();
		this.label3 = new System.Windows.Forms.Label();
		this.superFrameOrderTextBox = new System.Windows.Forms.TextBox();
		this.panCoordCheckBox = new System.Windows.Forms.CheckBox();
		this.okButton = new System.Windows.Forms.Button();
		this.cancelButton = new System.Windows.Forms.Button();
		this.label4 = new System.Windows.Forms.Label();
		this.beaconOrderTextBox = new System.Windows.Forms.TextBox();
		this.label5 = new System.Windows.Forms.Label();
		this.assignShortAddressTextBox = new System.Windows.Forms.TextBox();
		base.SuspendLayout();
		this.channelIdTextBox.Location = new System.Drawing.Point(146, 17);
		this.channelIdTextBox.Name = "channelIdTextBox";
		this.channelIdTextBox.Size = new System.Drawing.Size(100, 20);
		this.channelIdTextBox.TabIndex = 0;
		this.label1.AutoSize = true;
		this.label1.Location = new System.Drawing.Point(12, 20);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(89, 13);
		this.label1.TabIndex = 1;
		this.label1.Text = "Channel ID (hex):";
		this.label2.AutoSize = true;
		this.label2.Location = new System.Drawing.Point(12, 48);
		this.label2.Name = "label2";
		this.label2.Size = new System.Drawing.Size(72, 13);
		this.label2.TabIndex = 2;
		this.label2.Text = "PAN ID (hex):";
		this.panIdTextBox.Location = new System.Drawing.Point(146, 45);
		this.panIdTextBox.Name = "panIdTextBox";
		this.panIdTextBox.Size = new System.Drawing.Size(100, 20);
		this.panIdTextBox.TabIndex = 3;
		this.label3.AutoSize = true;
		this.label3.Location = new System.Drawing.Point(12, 117);
		this.label3.Name = "label3";
		this.label3.Size = new System.Drawing.Size(91, 13);
		this.label3.TabIndex = 4;
		this.label3.Text = "Superframe order:";
		this.superFrameOrderTextBox.Location = new System.Drawing.Point(146, 114);
		this.superFrameOrderTextBox.Name = "superFrameOrderTextBox";
		this.superFrameOrderTextBox.Size = new System.Drawing.Size(100, 20);
		this.superFrameOrderTextBox.TabIndex = 5;
		this.panCoordCheckBox.AutoSize = true;
		this.panCoordCheckBox.Location = new System.Drawing.Point(107, 154);
		this.panCoordCheckBox.Name = "panCoordCheckBox";
		this.panCoordCheckBox.Size = new System.Drawing.Size(102, 17);
		this.panCoordCheckBox.TabIndex = 6;
		this.panCoordCheckBox.Text = "Pan Coordinator";
		this.panCoordCheckBox.UseVisualStyleBackColor = true;
		this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
		this.okButton.Location = new System.Drawing.Point(67, 306);
		this.okButton.Name = "okButton";
		this.okButton.Size = new System.Drawing.Size(75, 23);
		this.okButton.TabIndex = 7;
		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(171, 306);
		this.cancelButton.Name = "cancelButton";
		this.cancelButton.Size = new System.Drawing.Size(75, 23);
		this.cancelButton.TabIndex = 8;
		this.cancelButton.Text = "Cancel";
		this.cancelButton.UseVisualStyleBackColor = true;
		this.label4.AutoSize = true;
		this.label4.Location = new System.Drawing.Point(12, 81);
		this.label4.Name = "label4";
		this.label4.Size = new System.Drawing.Size(77, 13);
		this.label4.TabIndex = 9;
		this.label4.Text = "Beacon order: ";
		this.beaconOrderTextBox.Location = new System.Drawing.Point(146, 78);
		this.beaconOrderTextBox.Name = "beaconOrderTextBox";
		this.beaconOrderTextBox.Size = new System.Drawing.Size(100, 20);
		this.beaconOrderTextBox.TabIndex = 10;
		this.label5.AutoSize = true;
		this.label5.Location = new System.Drawing.Point(12, 203);
		this.label5.Name = "label5";
		this.label5.Size = new System.Drawing.Size(107, 13);
		this.label5.TabIndex = 11;
		this.label5.Text = "Assign short address:";
		this.assignShortAddressTextBox.Location = new System.Drawing.Point(146, 200);
		this.assignShortAddressTextBox.Name = "assignShortAddressTextBox";
		this.assignShortAddressTextBox.Size = new System.Drawing.Size(100, 20);
		this.assignShortAddressTextBox.TabIndex = 12;
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(312, 341);
		base.Controls.Add(this.assignShortAddressTextBox);
		base.Controls.Add(this.label5);
		base.Controls.Add(this.beaconOrderTextBox);
		base.Controls.Add(this.label4);
		base.Controls.Add(this.cancelButton);
		base.Controls.Add(this.okButton);
		base.Controls.Add(this.panCoordCheckBox);
		base.Controls.Add(this.superFrameOrderTextBox);
		base.Controls.Add(this.label3);
		base.Controls.Add(this.panIdTextBox);
		base.Controls.Add(this.label2);
		base.Controls.Add(this.label1);
		base.Controls.Add(this.channelIdTextBox);
		base.Name = "ZigBeeBeaconParameters";
		this.Text = "15.4 Beacon Parameters";
		base.Load += new System.EventHandler(ZigBeeBeaconParameters_Load);
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
