private void btnOk_Click(object sender, EventArgs e)
        {
            string vStrMensagem = String.Empty;

            clsCtrSenha vObjSenha;


            try
            {
                vObjSenha = new clsCtrSenha();

                vStrMensagem = vObjSenha.atualizarSenha(this.txtSenhaAtual.Text, this.txtNovaSenha.Text, this.txtConfirmaNovaSenha.Text);

                if (vStrMensagem != String.Empty)
                {
                    MessageBox.Show(vStrMensagem, "Alteração de senha", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    MessageBox.Show("Senha alterada com sucesso!", "Alteração de senha", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        private void btnLockUnlock_Click(object sender, EventArgs e)
        {
            bool   vBooAcessoValidado = false;
            string vStrSenha          = String.Empty;

            clsCtrSenha vObjSenha;

            try
            {
                vObjSenha = new clsCtrSenha();

                if (this._Bloqueado)
                {
                    using (frmViwEntrar vObjJanelaLogar = new frmViwEntrar())
                    {
                        while (vBooAcessoValidado == false)
                        {
                            vStrSenha = vObjJanelaLogar.pegarSenha();

                            if (vStrSenha == String.Empty)
                            {
                                return;
                            }

                            vBooAcessoValidado = vObjSenha.validarSenha(vStrSenha);
                            if (vBooAcessoValidado == false)
                            {
                                MessageBox.Show("Senha incorreta!", "Monitor Bitcoin", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                        }
                    }

                    this._Bloqueado          = false;
                    this.btnLockUnlock.Image = Properties.Resources.unlock_3;
                }
                else
                {
                    if (!Program.Parametros.pPossuiSenha)
                    {
                        MessageBox.Show("Não é possível bloquear o monitor porque você ainda não definiu uma senha.\nEntre no menu Arquivo > Definir Senha e cadastre uma senha.", "Monitor Bitcoin", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    this._Bloqueado          = true;
                    this.btnLockUnlock.Image = Properties.Resources.lock_2;
                }
            }
            catch (Exception ex)
            {
                this.adicionarErroLog(ex);
            }
        }