AddEditProfile() static private method

Writes a new or modified Profile to the registry
static private AddEditProfile ( AWBProfile profile ) : void
profile AWBProfile Profile Object of User
return void
Esempio n. 1
0
        private void btnQuickLogin_Click(object sender, EventArgs e)
        {
            string user     = txtUsername.Text;
            string password = txtPassword.Text;

            if (chkSaveProfile.Checked)
            {
                if (AWBProfiles.GetProfile(txtUsername.Text) != null)
                {
                    MessageBox.Show("Username \"" + txtUsername.Text + "\" already exists.", "Username exists");
                    return;
                }

                var profile = new AWBProfile {
                    Username = user
                };
                if (chkSavePassword.Checked)
                {
                    profile.Password = password;
                }
                AWBProfiles.AddEditProfile(profile);
            }

            AWBProfiles.LastUsedAccount = user;
            PerformLogin(user, password);
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtUsername.Text))
            {
                MessageBox.Show("The Username cannot be blank");
            }
            else
            {
                AWBProfile profile = new AWBProfile {
                    Username = txtUsername.Text
                };

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

                profile.DefaultSettings = txtPath.Text;

                int idUpload = AWBProfiles.GetIDOfUploadAccount();

                if (chkUseForUpload.Checked && (idUpload != -1) && (idUpload != Editid))
                {
                    AWBProfiles.SetOtherAccountsAsNotForUpload();
                }

                profile.UseForUpload = chkUseForUpload.Checked;
                profile.Notes        = txtNotes.Text;

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

                DialogResult = DialogResult.Yes;
            }
        }
Esempio n. 3
0
        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;

                int idUpload = AWBProfiles.GetIDOfUploadAccount();

                if (chkUseForUpload.Checked && (idUpload != -1) && (idUpload != Editid))
                {
                    AWBProfiles.SetOtherAccountsAsNotForUpload();
                }

                profile.UseForUpload = chkUseForUpload.Checked;
                profile.Notes        = txtNotes.Text;

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

                DialogResult = DialogResult.Yes;
            }
        }
Esempio n. 4
0
        private void btnQuickLogin_Click(object sender, EventArgs e)
        {
            string user     = txtUsername.Text;
            string password = txtPassword.Text;

            if (chkSaveProfile.Checked)
            {
                var profile = new AWBProfile {
                    Username = user
                };
                if (chkSavePassword.Checked)
                {
                    profile.Password = password;
                }
                AWBProfiles.AddEditProfile(profile);
            }

            AWBProfiles.LastUsedAccount = user;
            PerformLogin(user, password);
        }