public CheckUser() { XmlBLL xmlBLL = new XmlBLL(); User user = null; try { user = xmlBLL.CheckRemember(); } catch { }; if (user != null) { DataInfoUser.usernamelogin = user.UserName1; DataInfoUser.Lever = user.Lever1; DataInfoUser.imguser = Image.FromFile(user.FileImage1); DataInfoUser.date = (DateTime)user.DateSignUp1; DataInfoUser.Point = user.Point1; DataInfoUser.Email = user.Email1; DataInfoUser.Admin = user.Admin1; DataInfoUser.Remember = true; } else { Login login = new Login(); login.ShowDialog(); if (String.IsNullOrEmpty(DataInfoUser.usernamelogin)) { } } }
private void Main_Load(object sender, EventArgs e) { XmlBLL xmlBLL = new XmlBLL(); xmlBLL.GetSysteminfo(); if (Systeminfo.Status == true) { Mp3Player.open(Systeminfo.FileNameSound); Mp3Player.Volume(100); Mp3Player.play(); } // Subscribe Event //Event registration choose.Load_test += Load_test; btnLogout.Click += btnhomen_Click; ResultTest.Instance.close_test += close_UcQuestion; ResultTest.Instance.new_test += new_test; try { if (!String.IsNullOrEmpty(DataInfoUser.usernamelogin)) { txtUsername.Text = DataInfoUser.usernamelogin; pBUser.Image = DataInfoUser.imguser; } else { txtUsername.Text = "NoUser"; btnLogout.Visible = false; btnLogin.Visible = true; } } catch (Exception) { } if (DataInfoUser.Admin == true) { btnAdmin.Visible = true; txtUsername.ForeColor = Color.Red; } else { txtUsername.ForeColor = Color.DarkBlue; } checkuser(); this.TopMost = false; this.Enabled = true; }
private void btnLogout_Click(object sender, EventArgs e) { btnLogout.Visible = false; btnLogin.Visible = true; btnAdmin.Visible = false; XmlBLL xmlBLL = new XmlBLL(); User user = new User(); user.UserName1 = DataInfoUser.usernamelogin; xmlBLL.ForgetUser(user); DataInfoUser.usernamelogin = null; DataInfoUser.Lever = null; DataInfoUser.imguser = null; DataInfoUser.date = new DateTime(); checkuser(); DataInfoUser.Email = null; DataInfoUser.Remember = false; this.txtUsername.Text = "No UserName"; pBUser.Image = Image.FromFile("Data/Users/NoUser.png"); }
private void customImageButton2_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(fileName)) { XmlBLL xmlBLL = new XmlBLL(); xmlBLL.SetSysteminfo(fileName, Status); if (Status == true) { Systeminfo.Status = true; } else { Systeminfo.Status = false; } this.Close(); } else { MessageBox.Show("Bạn chưa chọn bài hát", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }