namespace ns0
{
    using ns1;
    using ns3;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    internal class frmAddItem : Form
    {
        private Button btnSearch;
        private Button button1;
        private frmMain frmMain_0;
        private GroupBox groupBox1;
        private IContainer icontainer_0 = null;
        private Label label1;
        private Label label2;
        private Label label3;
        private ListBox lstItem;
        private TextBox txtAmount;
        private TextBox txtID;
        private TextBox txtSearch;
        private TextBox txtType;

        public frmAddItem(frmMain main)
        {
            this.frmMain_0 = main;
            this.InitializeComponent();
            this.method_0("");
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            this.method_0(this.txtSearch.Text);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ushort num = 0;
            ushort num2 = 0;
            byte num3 = 0;
            try
            {
                num = Convert.ToUInt16(this.txtID.Text);
                num2 = Convert.ToUInt16(this.txtAmount.Text);
                num3 = Convert.ToByte(this.txtType.Text);
            }
            catch
            {
                MessageBox.Show("Please enter valid numbers!");
                return;
            }
            Class5 item = new Class5 {
                Amount = num2,
                ID = num,
                Type = num3
            };
            this.frmMain_0.class3_0.list_2.Add(item);
            this.frmMain_0.method_10(this.frmMain_0.class3_0);
            base.Close();
        }

        private void frmAddItem_Load(object sender, EventArgs e)
        {
        }

        private void InitializeComponent()
        {
            this.groupBox1 = new GroupBox();
            this.txtSearch = new TextBox();
            this.btnSearch = new Button();
            this.lstItem = new ListBox();
            this.label1 = new Label();
            this.label2 = new Label();
            this.label3 = new Label();
            this.txtID = new TextBox();
            this.txtAmount = new TextBox();
            this.txtType = new TextBox();
            this.button1 = new Button();
            this.groupBox1.SuspendLayout();
            base.SuspendLayout();
            this.groupBox1.Controls.Add(this.lstItem);
            this.groupBox1.Controls.Add(this.btnSearch);
            this.groupBox1.Controls.Add(this.txtSearch);
            this.groupBox1.Location = new Point(5, 7);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new Size(0xce, 0x199);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Items:";
            this.txtSearch.Location = new Point(7, 0x13);
            this.txtSearch.Name = "txtSearch";
            this.txtSearch.Size = new Size(0x6a, 20);
            this.txtSearch.TabIndex = 0;
            this.btnSearch.Location = new Point(0x77, 0x13);
            this.btnSearch.Name = "btnSearch";
            this.btnSearch.Size = new Size(0x48, 20);
            this.btnSearch.TabIndex = 1;
            this.btnSearch.Text = "Search";
            this.btnSearch.UseVisualStyleBackColor = true;
            this.btnSearch.Click += new EventHandler(this.btnSearch_Click);
            this.lstItem.FormattingEnabled = true;
            this.lstItem.Location = new Point(8, 0x2d);
            this.lstItem.Name = "lstItem";
            this.lstItem.Size = new Size(0xb6, 0x163);
            this.lstItem.TabIndex = 2;
            this.lstItem.MouseDoubleClick += new MouseEventHandler(this.lstItem_MouseDoubleClick);
            this.lstItem.SelectedIndexChanged += new EventHandler(this.lstItem_SelectedIndexChanged);
            this.label1.AutoSize = true;
            this.label1.Location = new Point(0xd9, 0x1d);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x15, 13);
            this.label1.TabIndex = 1;
            this.label1.Text = "ID:";
            this.label2.AutoSize = true;
            this.label2.Location = new Point(0xda, 0x3f);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x2e, 13);
            this.label2.TabIndex = 2;
            this.label2.Text = "Amount:";
            this.label3.AutoSize = true;
            this.label3.Location = new Point(0xda, 100);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x22, 13);
            this.label3.TabIndex = 3;
            this.label3.Text = "Type:";
            this.txtID.Location = new Point(270, 0x1a);
            this.txtID.Name = "txtID";
            this.txtID.Size = new Size(0x31, 20);
            this.txtID.TabIndex = 4;
            this.txtAmount.Location = new Point(270, 0x3b);
            this.txtAmount.Name = "txtAmount";
            this.txtAmount.Size = new Size(0x31, 20);
            this.txtAmount.TabIndex = 5;
            this.txtAmount.Text = "1";
            this.txtType.Location = new Point(270, 0x61);
            this.txtType.Name = "txtType";
            this.txtType.Size = new Size(0x31, 20);
            this.txtType.TabIndex = 6;
            this.txtType.Text = "0";
            this.button1.Location = new Point(0xe0, 0x8d);
            this.button1.Name = "button1";
            this.button1.Size = new Size(0x5e, 0x1f);
            this.button1.TabIndex = 7;
            this.button1.Text = "Add Item";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new EventHandler(this.button1_Click);
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x158, 0x1ad);
            base.Controls.Add(this.button1);
            base.Controls.Add(this.txtType);
            base.Controls.Add(this.txtAmount);
            base.Controls.Add(this.txtID);
            base.Controls.Add(this.label3);
            base.Controls.Add(this.label2);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.groupBox1);
            base.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            base.Name = "frmAddItem";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "Add Item";
            base.Load += new EventHandler(this.frmAddItem_Load);
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        private void lstItem_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            try
            {
                ushort key = Convert.ToUInt16(this.lstItem.Text.Split(new char[] { ' ' })[0]);
                if (this.frmMain_0.dictionary_2.ContainsKey(key))
                {
                    this.txtID.Text = key.ToString();
                }
            }
            catch
            {
            }
        }

        private void lstItem_SelectedIndexChanged(object sender, EventArgs e)
        {
        }

        private void method_0(string string_0)
        {
            this.lstItem.Items.Clear();
            if (string_0 == "")
            {
                foreach (KeyValuePair<ushort, string> pair in this.frmMain_0.dictionary_2)
                {
                    this.lstItem.Items.Add(pair.Key.ToString() + " - " + pair.Value);
                }
            }
            else
            {
                foreach (KeyValuePair<ushort, string> pair in this.frmMain_0.dictionary_2)
                {
                    if (pair.Value.ToLower().Contains(string_0.ToLower()))
                    {
                        this.lstItem.Items.Add(pair.Key.ToString() + " - " + pair.Value);
                    }
                }
            }
        }

        public void Dispose(bool disposing)
        {
            if (disposing && (this.icontainer_0 != null))
            {
                this.icontainer_0.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}

