namespace SHNDecrypt
{
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class columnDeletion : Form
    {
        private Button button1;
        private ComboBox comboBox1;
        private IContainer components;
        private Label label1;
        private frmMain mainfrm;
        private TextBox txtList;

        public columnDeletion(frmMain main)
        {
            this.mainfrm = main;
            this.InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("Are you sure you want to delete this column? It can't be undone!", "SHN", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                {
                    this.mainfrm.file.DeleteColumn(this.comboBox1.SelectedItem.ToString());
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }

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

        public void init()
        {
            if (this.mainfrm.file.table != null)
            {
                this.comboBox1.Items.Clear();
                for (int i = 0; i < this.mainfrm.file.table.Columns.Count; i++)
                {
                    this.comboBox1.Items.Add(this.mainfrm.file.table.Columns[i].ColumnName);
                    this.txtList.Text = this.txtList.Text + this.mainfrm.file.table.Columns[i].ColumnName + "\r\n";
                }
                this.comboBox1.SelectedIndex = 0;
            }
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(columnDeletion));
            this.comboBox1 = new ComboBox();
            this.button1 = new Button();
            this.txtList = new TextBox();
            this.label1 = new Label();
            base.SuspendLayout();
            this.comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
            this.comboBox1.FormattingEnabled = true;
            this.comboBox1.Location = new Point(0x42, 12);
            this.comboBox1.Name = "comboBox1";
            this.comboBox1.Size = new Size(0xf9, 0x15);
            this.comboBox1.TabIndex = 0;
            this.button1.Location = new Point(0x42, 0x27);
            this.button1.Name = "button1";
            this.button1.Size = new Size(0xf9, 30);
            this.button1.TabIndex = 1;
            this.button1.Text = "Delete";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new EventHandler(this.button1_Click);
            this.txtList.Location = new Point(12, 0x2d);
            this.txtList.Multiline = true;
            this.txtList.Name = "txtList";
            this.txtList.ScrollBars = ScrollBars.Vertical;
            this.txtList.Size = new Size(0x2d, 0x18);
            this.txtList.TabIndex = 3;
            this.txtList.Visible = false;
            this.label1.AutoSize = true;
            this.label1.Location = new Point(15, 15);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x2d, 13);
            this.label1.TabIndex = 9;
            this.label1.Text = "Column:";
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x145, 0x4e);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.txtList);
            base.Controls.Add(this.button1);
            base.Controls.Add(this.comboBox1);
            base.FormBorderStyle = FormBorderStyle.FixedSingle;
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "columnDeletion";
            base.StartPosition = FormStartPosition.CenterParent;
            this.Text = "Column Deletion";
            base.ResumeLayout(false);
            base.PerformLayout();
        }
    }
}

