private void init() { init2(); BtnDelete.Visibility = Visibility.Hidden; CboDriver.Items.Insert(0, "Oracle"); CboDriver.Items.Insert(1, "SQLServer"); CboDriver.SelectedIndex = -1; var sessao = AuxiliarNhibernate.AbrirSessao(); var ParametroDB = new ParametroDB_DAO(sessao); try { var process = new Processos(); var param = ParametroDB.BuscarPorID(1);//Armazenamento.GetParametrosDB(); try { if (param.Driver == "oracle") { CboDriver.SelectedIndex = 0; } else { CboDriver.SelectedIndex = 1; } TxbHost.Text = param.Host; TxbPort.Text = param.Port; TxbServiceName.Text = param.ServiceName; TxbUser.Text = param.User; StaticParametersDB.SetDriver("oracle"); StaticParametersDB.SetHost(TxbHost.Text); StaticParametersDB.SetPort(TxbPort.Text); StaticParametersDB.SetServiceName(TxbServiceName.Text); StaticParametersDB.SetUser(TxbUser.Text); PwbSenha.Password = AESThenHMAC.SimpleDecryptWithPassword(param.Password, process.GetMacAdress()); StaticParametersDB.SetPassword(PwbSenha.Password); BtnDelete.Visibility = Visibility.Visible; } catch (Exception e) { if (StaticParametersDB.GetDriver() != null) { var driver = StaticParametersDB.GetDriver(); if (driver == "oracle") { CboDriver.SelectedIndex = 0; } else { CboDriver.SelectedIndex = 1; } TxbHost.Text = StaticParametersDB.GetHost(); TxbPort.Text = StaticParametersDB.GetPort(); TxbServiceName.Text = StaticParametersDB.GetServiceName(); TxbUser.Text = StaticParametersDB.GetUser(); PwbSenha.Password = StaticParametersDB.GetPassword(); BtnDelete.Visibility = Visibility.Visible; } } }catch (Exception e) { } sessao.Close(); }