천호석
2022-06-17 4de9ea98e13449174aa2cd09c8351fc0e978f44a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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)
            {
 
            }
        }
    }
}