using System; using System.Windows.Forms; namespace SHARP_CLAS_UI { public partial class Form_Login : Form { Form_Frame _Parent; public Form_Login(Form_Frame _Parent) { InitializeComponent(); this._Parent = _Parent; } private void btn_Login_Click(object sender, EventArgs e) { if(User_Info_Manager.Instance.Exist_User_Info(tb_ID.Text)) { User_Info info = User_Info_Manager.Instance.Get_User_Info(tb_ID.Text); if (info.Password == tb_Password.Text) { _Parent._equip.User = info; _Parent.Set_User_Level(info.Level); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("Invalid credentials."); } } else { MessageBox.Show("ID is not exist."); } } private void Form_Login_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult != DialogResult.OK) { try { Application.Exit(); } catch(Exception ) { } } else { tb_ID.Text = ""; tb_Password.Text = ""; DialogResult = DialogResult.Cancel; this.Hide(); e.Cancel = true; } } public void Set_Language() { try { lb_User_ID.Text = resLanguage.User_ID; lb_Password.Text = resLanguage.PASSWORD; } catch(Exception ex) { } } } }