コード例 #1
0
        /// <summary>
        /// change visible/enabled group box of new account and login
        /// </summary>
        private void ChangeGB()
        {
            Gb_newAcc.Enabled = !Gb_newAcc.Enabled;
            Gb_newAcc.Visible = !Gb_newAcc.Visible;
            Gb_Login.Enabled  = !Gb_Login.Enabled;
            Gb_Login.Visible  = !Gb_Login.Visible;

            Txt_username_create.Focus();
            Txt_username.Focus();
        }
コード例 #2
0
        /// <summary>
        /// create a new account
        /// </summary>
        private void NewAccount()
        {
            var model = new NewAccount
            {
                ConcordTerms    = cb_terms.Checked,
                ConfirmPassword = Txt_ConfPassword_create.Text,
                Password        = Txt_Password_create.Text,
                PasswordHint    = Txt_PasswordHint_create.Text,
                UserName        = Txt_username_create.Text
            };

            if (ModelIsValid(model))
            {
                Properties.ActiveUser = new User
                {
                    UserName     = model.UserName,
                    Password     = model.Password,
                    PasswordHint = model.PasswordHint,
                    FileSettings = string.Empty
                };

                new FoldersBackup(new SettingsModel
                {
                    FoldersBackupModels = new List <FoldersBackupModel>()
                }).WriteSettings();

                Txt_username_create.Clear();
                Txt_Password_create.Clear();
                Txt_PasswordHint_create.Clear();
                Txt_ConfPassword_create.Clear();
                cb_terms.Checked = false;

                ChangeGB();
                Txt_username.Text = model.UserName;
                MessageBox.Show("Por favor, confirme a sua senha para continuar.", "Cadastro realizado com sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                Txt_password.Focus();

                Startup();
            }
        }