Example #1
0
        private void bCreateOpen_Click(object sender, EventArgs e)
        {
            cbUseDBForSeeds.Checked = true;
            PwDatabase db = m_dDB.ElementAt(lbDB.SelectedIndex).Key;

            RefreshHandler(db);
            if (!m_handler.OTPDB_Exists)
            {
                m_handler.OTPDB_Create();
                if (m_handler.OTPDB_Exists)
                {
                    bDBSettings_Click(sender, e);
                }
            }
            else if (!m_handler.OTPDB_Opened)
            {
                m_handler.SetDB(db, true);
            }
            if (m_handler.OTPDB_Opened)
            {
                cbUseDBForSeeds.Checked = true;
                Config.UseDBForOTPSeeds(db, true);
                OTPDAO.GetOTPHandler(db);
                OTPDAO.InitEntries(db);
            }
            lbDB_SelectedIndexChanged(sender, e);
        }
Example #2
0
        private void bCreateOpen_Click(object sender, EventArgs e)
        {
            cbUseDBForSeeds.Checked = true;
            PwDatabase db = m_dDB.ElementAt(lbDB.SelectedIndex).Key;

            RefreshHandler(db);
            DBAction dba = cbDBAction.SelectedItem as DBAction;

            if (dba == null)
            {
                return;
            }
            if ((dba.Action == ACTION_CREATE) || !m_handler.OTPDB_Exists)
            {
                m_handler.OTPDB_Create();
                if (m_handler.OTPDB_Exists)
                {
                    bDBSettings_Click(sender, e);
                }
            }
            else if (dba.Action == ACTION_OPEN)
            {
                m_handler.SetDB(db, true);
            }
            else if (dba.Action == ACTION_CLOSE)
            {
                m_handler.OTPDB_Close();
                OTPDAO.RemoveHandler(db.IOConnectionInfo.Path, true);
                OTPDAO.GetOTPHandler(db);
                OTPDAO.InitEntries(db);
                KeePassOTPColumnProvider.ForceUpdate = true;
            }
            else if (dba.Action == ACTION_DELETE)
            {
                m_handler.OTPDB_Remove();
                OTPDAO.RemoveHandler(db.IOConnectionInfo.Path, true);
                OTPDAO.InitEntries(db);
                KeePassOTPColumnProvider.ForceUpdate = true;
            }

            if (m_handler.OTPDB_Opened)
            {
                cbUseDBForSeeds.Checked = true;
                Config.UseDBForOTPSeeds(db, true);
                OTPDAO.GetOTPHandler(db);
                OTPDAO.InitEntries(db);
            }
            lbDB_SelectedIndexChanged(sender, e);
        }