WikiFunctions.Profiles.AWBProfileAdd.btnSave_Click C# (CSharp) 메소드

btnSave_Click() 개인적인 메소드

private btnSave_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
리턴 void
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtUsername.Text))
                MessageBox.Show("The Username cannot be blank");
            else
            {
                // warn user if profile for entered user ID already exists
                if (Editid == -1 && AWBProfiles.GetProfile(txtUsername.Text) != null)
                {
                    if (MessageBox.Show("Username \"" +txtUsername.Text + "\" is already used in another profile. Are you sure you want to use this username again?",
                                        "Username already used in another profile", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    return;
                }

                AWBProfile profile = new AWBProfile {Username = txtUsername.Text};

                if (chkSavePassword.Checked && !string.IsNullOrEmpty(txtPassword.Text))
                    profile.Password = txtPassword.Text;
                else
                     profile.Password ="";

                profile.DefaultSettings = txtPath.Text;
                profile.Notes = txtNotes.Text;

                profile.ID = Editid;
                AWBProfiles.AddEditProfile(profile);

                DialogResult = DialogResult.Yes;
            }
        }