public SearchWindow(MainForm mainForm, string infoBanner) : this() { mMainForm = mainForm; mInfoBanner.Height = Math.Max(mInfoBannerImage.Height, mInfoLabel.Font.Height) + mInfoBanner.Margin.Vertical; mInfoLabel.Padding = new Padding(0, (mInfoBanner.Height - mInfoLabel.Font.Height) / 2, 0, 0); mInfoLabel.Text = infoBanner; if (infoBanner == null) { mInfoBanner.Visible = false; mInfoBanner.Height = 0; } mSearcher = new Searcher(mMainForm.DocumentManager.GetOpenDatabases().ToArray()); Icon = mMainForm.Icon; using (var bannerIcon = new Icon(Icon, 48, 48)) { mBannerImage = bannerIcon.ToBitmap(); } UpdateBanner(); ShowThrobber = false; FontUtil.AssignDefaultItalic(mNoResultsLabel); }
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(); }
private void OnFormLoad(object sender, EventArgs e) { Debug.Assert(m_pwDatabase != null); if (m_pwDatabase == null) { throw new InvalidOperationException(); } m_bInitializing = true; GlobalWindowManager.AddWindow(this); IOConnectionInfo ioc = m_pwDatabase.IOConnectionInfo; string strDisp = ioc.GetDisplayName(); string strDesc = KPRes.DatabaseSettingsDesc; if (!string.IsNullOrEmpty(strDisp)) { strDesc = strDisp; } BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Ark, KPRes.DatabaseSettings, strDesc); this.Icon = AppIcons.Default; FontUtil.AssignDefaultItalic(m_lblHeaderCpAlgo); FontUtil.AssignDefaultItalic(m_lblHeaderCp); FontUtil.AssignDefaultItalic(m_lblHeaderPerf); FontUtil.AssignDefaultBold(m_rbNone); FontUtil.AssignDefaultBold(m_rbGZip); UIUtil.ConfigureToolTip(m_ttRect); m_ttRect.SetToolTip(m_btnKdf1Sec, KPRes.KdfParams1Sec); m_tbDbName.PromptText = KPRes.DatabaseNamePrompt; m_tbDbDesc.PromptText = KPRes.DatabaseDescPrompt; if (m_bCreatingNew) { this.Text = KPRes.ConfigureOnNewDatabase2; } else { this.Text = KPRes.DatabaseSettings; } m_tbDbName.Text = m_pwDatabase.Name; UIUtil.SetMultilineText(m_tbDbDesc, m_pwDatabase.Description); m_tbDefaultUser.Text = m_pwDatabase.DefaultUserName; m_clr = m_pwDatabase.Color; if (m_clr != Color.Empty) { m_clr = AppIcons.RoundColor(m_clr); UIUtil.OverwriteButtonImage(m_btnColor, ref m_imgColor, UIUtil.CreateColorBitmap24(m_btnColor, m_clr)); } 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); } Debug.Assert(m_cmbKdf.Items.Count == 0); foreach (KdfEngine kdf in KdfPool.Engines) { m_cmbKdf.Items.Add(kdf.Name); } m_numKdfIt.Minimum = ulong.MinValue; m_numKdfIt.Maximum = ulong.MaxValue; m_numKdfMem.Minimum = ulong.MinValue; m_numKdfMem.Maximum = ulong.MaxValue; Debug.Assert(m_cmbKdfMem.Items.Count == 0); Debug.Assert(!m_cmbKdfMem.Sorted); m_cmbKdfMem.Items.Add("B"); m_cmbKdfMem.Items.Add("KB"); m_cmbKdfMem.Items.Add("MB"); m_cmbKdfMem.Items.Add("GB"); m_numKdfPar.Minimum = uint.MinValue; m_numKdfPar.Maximum = uint.MaxValue; SetKdfParameters(m_pwDatabase.KdfParameters); // 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(); UIUtil.SetFocus(m_tbDbName, this); }