private void btnSubmit_Click(object sender, EventArgs e) { txtUsername.Focus(); txtFullName.Focus(); txtPassword.Focus(); txtEmail.Focus(); mcDateBirth.Focus(); txtAboutMe.Focus(); if (txtUsername.Text.Trim().Length > 0 && !users.ContainsKey(txtUsername.Text) && txtFullName.Text.Trim().Length > 0 && txtFullName.Text.Split(' ').Length > 1 && txtPassword.Text.Trim().Length > 0 && txtEmail.Text.Trim().Length > 0 && txtDateBirth.Text.Trim().Length > 0 && txtAboutMe.Text.Trim().Length > 0) { string g; if (rbMale.Checked) { g = gender.male.ToString(); } else { g = gender.female.ToString(); } user = new User(txtUsername.Text, txtFullName.Text, txtPassword.Text, txtEmail.Text, g, txtDateBirth.Text, txtAboutMe.Text); users.Add(txtUsername.Text, user); this.DialogResult = DialogResult.OK; user.ChangeAvatar(avatar); // Profile form = new Profile(user, users, true); Profile form = new Profile(user, users); this.Hide(); form.Show(); Close(); } }
private void btnCamera_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() != DialogResult.Cancel) { active.ChangeAvatar(openFileDialog1.FileName); } imgAvatar.Image = null; imgAvatar.ImageLocation = active.avatar; }