using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace terminal
{
    public partial class MessageBoxCar : Form
    {
        int height;
        public string car_number = "";
        string[] city = new string[] { "京","沪","津","渝","黑","吉","辽","蒙","冀","新","甘",
                                    "青","陕","宁","豫","鲁","晋","皖","鄂","湘","苏","川", "贵",
                                    "黔", "滇","桂","藏","浙","赣","粤","闽","台","琼","港" };
        public MessageBoxCar(int id)
        {

            InitializeComponent();
            this.label6.Text = string.Format("厦门市政停车终端{0}号机 ", id); 

        }

        public void SetText(string text)
        {
            this.textBox1.Text = text;
        }
        private void MessageBoxEe_Load(object sender, EventArgs e)
        {
        }
        private void OKbtn_Click_1(object sender, EventArgs e)
        {
            if (this.textBox1.Text.Length == 0)
                MessageBox.Show("号牌不规则，请输入正常号牌！(首位中文，普通车7位，新能源8位)");

            else if ((int)this.textBox1.Text[0] > 127 && (this.textBox1.Text.Length == 7 || this.textBox1.Text.Length == 8))
            {
                this.car_number = this.textBox1.Text;
                this.DialogResult = DialogResult.OK;

                this.Close();
            }
            else
                MessageBox.Show("号牌不规则，请输入正常号牌！(首位中文，普通车7位，新能源8位)");

        }

        private void returnBtn_Click_1(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.No;
            this.Close();
        }

        private void modify_button_Click(object sender, EventArgs e)
        {
            this.flowLayoutPanel1.Visible = !this.flowLayoutPanel1.Visible;
            if (this.Height  == height )
                this.Height = this.Height - this.flowLayoutPanel1.Height;
            else
                this.Height = this.Height + this.flowLayoutPanel1.Height;

        }

        private void MessageBoxCar_Load(object sender, EventArgs e)
        {

            height = this.Height;
            this.Height = this.Height - this.flowLayoutPanel1.Height;
            this.flowLayoutPanel1.Visible = !this.flowLayoutPanel1.Visible;
        }

        private void button_Click(object sender, EventArgs e)
        {
            if (((Button)sender).Text == "删除")
            {
                if (this.textBox1.Text.Length > 0)
                    this.textBox1.Text = this.textBox1.Text.Substring(0, this.textBox1.Text.Length - 1);
            }
            else if (((Button)sender).Text == "清空")
            {
                this.textBox1.Text = "";
            }
            else
            {
                this.textBox1.Text= this.textBox1.Text+ ((Button)sender).Text;
            }


        }
    }
}
