using System; using System.Windows.Forms; namespace UAS_XmlAnalysor { public partial class Login : Form { public Login() { StartPosition = FormStartPosition.CenterScreen; InitializeComponent(); } private void CheckLogin_Click(object sender, EventArgs e) { string ErrMessage = ""; if (LogicHandler.CheckUserLogin(UserName.Text, PassWord.Text, out ErrMessage)) { if (LogicHandler.CheckUserAndResourcePassed(UserName.Text, Source.Text, out ErrMessage)) { BaseUtil.SetCacheData("UserName", UserName.Text); BaseUtil.SetCacheData("Source", Source.Text); if (onlinebutton.Checked) { BaseUtil.SetCacheData("Status", "online"); } else BaseUtil.SetCacheData("Status", "offline"); BaseUtil.SetCacheData("Mode", Equipment.Text); Form1 xml = new Form1(UserName.Text, Source.Text); Hide(); xml.ShowDialog(); Close(); } else MessageBox.Show(ErrMessage); } else MessageBox.Show(ErrMessage); } private void Login_Load(object sender, EventArgs e) { UserName.Text = BaseUtil.GetCacheData("UserName").ToString(); Source.Text = BaseUtil.GetCacheData("Source").ToString(); Equipment.Text = BaseUtil.GetCacheData("Mode").ToString(); if (BaseUtil.GetCacheData("Status").ToString() == "offline") { onlinebutton.Checked = false; } if (UserName.Text != "") { PassWord.Focus(); } } } }