コード例 #1
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();

                profile.Username        = txtUsername.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;

                if (editid == -1)
                {
                    AWBProfiles.AddProfile(profile);
                }
                else
                {
                    profile.id = editid;
                    AWBProfiles.EditProfile(profile);
                }

                this.DialogResult = DialogResult.Yes;
            }
        }