private void btnAdd_Click(object sender, EventArgs e) { try { if (txtName.Text == string.Empty) { MessageBox.Show("Pleas enter a name!"); } else if (int.Parse(txtSpeed.Text) > 10) { MessageBox.Show("Speed can only go up to 10"); } else { handler.insert(txtName.Text, int.Parse(txtHealth2.Text), int.Parse(txtSpeed.Text), int.Parse(txtWeight.Text), int.Parse(txtDamage.Text), int.Parse(txtInventory.Text), int.Parse(txtFuel.Text)); PlaneSelect planeSelect = new PlaneSelect(); planeSelect.Show(); this.Hide(); } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void btnBack_Click(object sender, EventArgs e) { PlaneSelect planeSelect = new PlaneSelect(); planeSelect.Show(); this.Hide(); }
private void linkRegister_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { string username = Interaction.InputBox("Choose an username", " ").ToString(); string password = Interaction.InputBox("Choose a password", " ").ToString(); LoginHandler handler = new LoginHandler(); LoginFileHandler loginFile = new LoginFileHandler(); if (handler.checkNull(username, password) == true) { if (handler.registervalidation(username) == true) { MessageBox.Show("User exist, try an other name"); } else { handler.sendEvent += loginFile.register; handler.loginEvent(username, password); MessageBox.Show("User have been added"); PlaneSelect planeSelect = new PlaneSelect(); planeSelect.Show(); this.Hide(); } } }
private void btnLogin_Click(object sender, EventArgs e) { string username = txtUserName.Text; string password = txtPassword.Text; if (loginCount == 0) { login[0, 0] = username; login[0, 1] = password; } else { login[1, 0] = username; login[1, 1] = password; } LoginHandler loginHandler = new LoginHandler(); if (loginHandler.Validate(username, password) == true) { if ((login[0, 0] == login[1, 0]) && (login[0, 1] == login[1, 1])) { MessageBox.Show("User Exists"); } else { MessageBox.Show("Logged in successfully!", "Loged in", MessageBoxButtons.OK); txtUserName.Text = "Username"; txtPassword.Text = "Password"; PlaneSelect planeSelect = new PlaneSelect(); planeSelect.Show(); this.Hide(); } } }
private void button1_Click(object sender, EventArgs e) { MessageBox.Show("No plane removed, going back to plane select", "Good news", MessageBoxButtons.OK, MessageBoxIcon.Information); PlaneSelect plane = new PlaneSelect(); plane.Show(); this.Hide(); }
private void brnRemove_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("Are you sure", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { handler.delete(CBoxName.Text); PlaneSelect planeSelect = new PlaneSelect(); planeSelect.Show(); this.Hide(); } }