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

namespace WindowsFormsApplication8
{
    public partial class frmPassword : Form
    {
        public frmPassword()
        {
            InitializeComponent();
        }

        private void frmPasswordCheck_Load(object sender, EventArgs e)
        {
            MaximizeBox = false;
            MinimizeBox = false;

            InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(new CultureInfo("en-US"));

            //frmSetting f = new frmSetting();
            //Hide();
            //f.ShowDialog();
            //Close();
        }

        private void txtPassword_TextChanged(object sender, EventArgs e)
        {
            if (Security.MD5(txtPassword.Text) == Security.PasswordProgram_)
            {
                frmSetting f = new frmSetting();
                Hide();
                f.ShowDialog();
                Close();
            }
            else
            {
                errorProvider.SetError(txtPassword, ".رمز عبور اشتباه است");
            }
        }

        private void frmPasswordCheck_FormClosed(object sender, FormClosedEventArgs e)
        {
            InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(new CultureInfo("fa-IR"));
        }

        private void button1_Click(object sender, EventArgs e)
        {
            foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses())
            {
                if (p.ProcessName == "Contact")
                {
                    p.Kill();
                }
            }
            Application.Exit();
            
        }
    }
}
