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

namespace PMSUI
{
    public partial class PromptForm : Form
    {
        private const string PASSWORD = "casun36689";
        /// <summary>
        ///开设置窗口事件
        /// </summary>
        public static System.Action<int> OpenAction { get; set; }

        public PromptForm()
        {
            InitializeComponent();
        }

        private void btConfirm_Click(object sender, EventArgs e)
        {
            if (txtPassword.Text == PASSWORD)
            {
                this.Close();
                if (OpenAction != null)
                {
                    OpenAction(1);
                }
            }
            else
            {
                MessageBox.Show("密码错误！");
            }
        }

        private void txtPassword_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                this.btConfirm_Click(sender, e);
            }
        }
    }
}
