public void BackShow(object sender, EventArgs e) { mainPanelGlobal.Controls.Clear(); MaintaneceMenu frm = new MaintaneceMenu(mainFormGlobal, mainPanelGlobal); frm.TopLevel = false; mainPanelGlobal.Controls.Add(frm); frm.FormBorderStyle = FormBorderStyle.None; frm.Dock = DockStyle.Fill; Thread.Sleep(200); frm.Show(); }
public void getPassword(string objectName, string passwords) { RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\WinRegistry"); string pwd = ""; if (key != null && key.GetValue("POSPassword") != null) { pwd = key.GetValue("POSPassword").ToString(); } else if (key == null) { pwd = ""; } if (pwd == passwords) { switch (objectName) { case "maintenance": FormPanel.Controls.Clear(); MaintaneceMenu maintaneceMenu = new MaintaneceMenu(mainFomeGlobal, FormPanel); maintaneceMenu.TopLevel = false; FormPanel.Controls.Add(maintaneceMenu); maintaneceMenu.FormBorderStyle = FormBorderStyle.None; maintaneceMenu.Dock = DockStyle.Fill; Thread.Sleep(200); maintaneceMenu.Show(); break; case "readingmenu": FormPanel.Controls.Clear(); MenuReading menuReading = new MenuReading(mainFomeGlobal, FormPanel); menuReading.TopLevel = false; FormPanel.Controls.Add(menuReading); menuReading.FormBorderStyle = FormBorderStyle.None; menuReading.Dock = DockStyle.Fill; Thread.Sleep(200); menuReading.Show(); break; } } }
public void SetBackShow(object sender, EventArgs e) { RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\WinRegistry"); if (key != null) { if (key.GetValue("POSPassword") == null) { key.SetValue("POSPassword", ""); } string pwd = key.GetValue("POSPassword").ToString(); if (pwd != null && pwd != "") { if (tbBoxGlobal[0].Text == "") { MessageBox.Show("Please enter current password."); } else if (tbBoxGlobal[0].Text != pwd) { MessageBox.Show("Please enter valid current password."); } else if (tbBoxGlobal[1].Text != tbBoxGlobal[2].Text) { MessageBox.Show("Please check your new password"); } else { key.SetValue("POSPassword", tbBoxGlobal[1].Text); MessageBox.Show("Password setting successfully."); mainPanelGlobal.Controls.Clear(); MaintaneceMenu frm = new MaintaneceMenu(mainFormGlobal, mainPanelGlobal); frm.TopLevel = false; mainPanelGlobal.Controls.Add(frm); frm.FormBorderStyle = FormBorderStyle.None; frm.Dock = DockStyle.Fill; Thread.Sleep(200); frm.Show(); } } else { if (tbBoxGlobal[1].Text != tbBoxGlobal[2].Text) { MessageBox.Show("Please check your new password"); } else { key.SetValue("POSPassword", tbBoxGlobal[1].Text); MessageBox.Show("Password setting successfully."); mainPanelGlobal.Controls.Clear(); MaintaneceMenu frm = new MaintaneceMenu(mainFormGlobal, mainPanelGlobal); frm.TopLevel = false; mainPanelGlobal.Controls.Add(frm); frm.FormBorderStyle = FormBorderStyle.None; frm.Dock = DockStyle.Fill; Thread.Sleep(200); } } } else { MessageBox.Show("Registry Error."); } }