コード例 #1
0
        private void HandleColorButtonClicked(object sender, EventArgs e)
        {
            if (sender == null)
            {
                Debug.Assert(false); return;
            }
            ColorMenuItem mi = (sender as ColorMenuItem);

            if (mi == null)
            {
                Debug.Assert(false); return;
            }

            m_clr = mi.Color;
            UIUtil.SetButtonImage(m_btnColor, PwEntryForm.CreateColorButtonImage(
                                      m_btnColor, m_clr), false);
        }
コード例 #2
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            Debug.Assert(m_pwDatabase != null); if (m_pwDatabase == null)
            {
                throw new InvalidOperationException();
            }

            GlobalWindowManager.AddWindow(this);

            BannerFactory.CreateBannerEx(this, m_bannerImage,
                                         Properties.Resources.B48x48_Ark, KPRes.DatabaseSettings,
                                         KPRes.DatabaseSettingsDesc);
            this.Icon = Properties.Resources.KeePass;

            m_bInitializing = true;

            FontUtil.AssignDefaultItalic(m_lblHeaderCpAlgo);
            FontUtil.AssignDefaultItalic(m_lblHeaderCp);
            FontUtil.AssignDefaultItalic(m_lblHeaderPerf);

            FontUtil.AssignDefaultBold(m_rbNone);
            FontUtil.AssignDefaultBold(m_rbGZip);

            m_ttRect.SetToolTip(m_lnkCompute1SecDelay, KPRes.TransformationRounds1SecHint);

            m_tbDbName.PromptText = KPRes.DatabaseNamePrompt;
            m_tbDbDesc.PromptText = KPRes.DatabaseDescPrompt;

            if (m_bCreatingNew)
            {
                this.Text = KPRes.ConfigureOnNewDatabase;
            }
            else
            {
                this.Text = KPRes.DatabaseSettings;
            }

            m_tbDbName.Text      = m_pwDatabase.Name;
            m_tbDbDesc.Text      = m_pwDatabase.Description;
            m_tbDefaultUser.Text = m_pwDatabase.DefaultUserName;

            m_clr = m_pwDatabase.Color;
            if (m_clr != Color.Empty)
            {
                UIUtil.SetButtonImage(m_btnColor, PwEntryForm.CreateColorButtonImage(
                                          m_btnColor, m_clr), false);
            }
            m_cbColor.Checked = (m_clr != Color.Empty);

            for (int inx = 0; inx < CipherPool.GlobalPool.EngineCount; ++inx)
            {
                m_cmbEncAlgo.Items.Add(CipherPool.GlobalPool[inx].DisplayName);
            }

            if (m_cmbEncAlgo.Items.Count > 0)
            {
                int nIndex = CipherPool.GlobalPool.GetCipherIndex(m_pwDatabase.DataCipherUuid);
                m_cmbEncAlgo.SelectedIndex = ((nIndex >= 0) ? nIndex : 0);
            }

            m_numEncRounds.Minimum = ulong.MinValue;
            m_numEncRounds.Maximum = ulong.MaxValue;
            m_numEncRounds.Value   = m_pwDatabase.KeyEncryptionRounds;

            // m_lbMemProt.Items.Add(KPRes.Title, m_pwDatabase.MemoryProtection.ProtectTitle);
            // m_lbMemProt.Items.Add(KPRes.UserName, m_pwDatabase.MemoryProtection.ProtectUserName);
            // m_lbMemProt.Items.Add(KPRes.Password, m_pwDatabase.MemoryProtection.ProtectPassword);
            // m_lbMemProt.Items.Add(KPRes.Url, m_pwDatabase.MemoryProtection.ProtectUrl);
            // m_lbMemProt.Items.Add(KPRes.Notes, m_pwDatabase.MemoryProtection.ProtectNotes);

            // m_cbAutoEnableHiding.Checked = m_pwDatabase.MemoryProtection.AutoEnableVisualHiding;
            // m_cbAutoEnableHiding.Checked = false;

            if (m_pwDatabase.Compression == PwCompressionAlgorithm.None)
            {
                m_rbNone.Checked = true;
            }
            else if (m_pwDatabase.Compression == PwCompressionAlgorithm.GZip)
            {
                m_rbGZip.Checked = true;
            }
            else
            {
                Debug.Assert(false);
            }

            InitRecycleBinTab();
            InitAdvancedTab();

            m_bInitializing = false;
            EnableControlsEx();
        }