static void Main() { Regedit reg = new Regedit(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); reg.add("Login", "false", "Initial"); server = reg.get("Server", "Server"); auth = reg.get("Auth", "Initial"); if (String.IsNullOrEmpty(server) || String.IsNullOrEmpty(auth)) { Application.Run(new FirstRun()); } Application.Run(new Login()); try { state = reg.get("Login", "Initial"); if (state.Equals("true")) { Application.Run(new MainPage()); } } catch (Exception) { Application.Exit(); } }
private void button1_Click(object sender, EventArgs e) { if (inputPass.Text.Length != 0 && inputUsername.Text.Length != 0 && server.Text.Length != 0 && department.Text.Length != 0) { try { if (db.conTest(server.Text.ToString())) { /* Set User Pass*/ reg.add(inputUsername.Text, encrypt.md5(inputPass.Text), "Initial"); reg.add("fee", "0", "Initial"); reg.add("Theam", "Black", "Color"); reg.add("Auth", department.Text.ToString(), "Initial"); /* Set Server*/ reg.add("savePath", pdf_save_path.Text, "Printer"); reg.add("Server", server.Text, "Server"); regValue = reg.get("Server", "Server"); MessageBox.Show("Database Path : " + regValue, "Sucess", MessageBoxButtons.OK); this.Close(); } } catch (Exception exp) { MessageBox.Show(exp.Message.ToString()); } } else { MessageBox.Show("You must fill all the field", "Failed", MessageBoxButtons.RetryCancel, MessageBoxIcon.Stop); } }
private void connectServer_Click(object sender, EventArgs e) { try { if (db0.conTest(server.Text.ToString())) { reg.add("Server", server.Text, "Server"); MessageBox.Show(reg.get("Server", "Server")); } } catch (Exception exp) { MessageBox.Show(exp.Message.ToString()); } }
private void button1_Click(object sender, EventArgs e) { if (userName.Text.Length != 0 && passWord.Text.Length != 0) { try { pass = reg.get(userName.Text.ToString(), "Initial"); if (encrypt.md5(passWord.Text).Equals(pass)) { reg.add("Login", "true", "Initial"); this.Close(); } else { MessageBox.Show("Wrong Username and Password", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Stop); } }catch (Exception) { MessageBox.Show("Wrong Username and Password", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Stop); } } }