private void UpdateUI() { if ((m_uBlockUIUpdate > 0) || m_bInitializing) { return; } ++m_uBlockUIUpdate; ulong uFlags = 0; if (m_fParent is KeyCreationForm) { uFlags = Program.Config.UI.KeyCreationFlags; } byte[] pbUtf8 = m_secPassword.ToUtf8(); string str = StrUtil.Utf8.GetString(pbUtf8); #if DEBUG byte[] pbTest = StrUtil.Utf8.GetBytes(str); Debug.Assert(MemUtil.ArraysEqual(pbUtf8, pbTest)); #endif m_tbPassword.Enabled = m_bEnabled; m_cbHide.Enabled = (m_bEnabled && ((uFlags & (ulong)AceKeyUIFlags.DisableHidePassword) == 0)); if ((uFlags & (ulong)AceKeyUIFlags.CheckHidePassword) != 0) { ++m_uPrgmCheck; m_cbHide.Checked = true; --m_uPrgmCheck; } if ((uFlags & (ulong)AceKeyUIFlags.UncheckHidePassword) != 0) { ++m_uPrgmCheck; m_cbHide.Checked = false; --m_uPrgmCheck; } bool bAutoRepeat = this.AutoRepeat; if (bAutoRepeat && (m_secRepeat.TextLength > 0)) { m_secRepeat.SetPassword(MemUtil.EmptyByteArray); } byte[] pbRepeat = m_secRepeat.ToUtf8(); if (!MemUtil.ArraysEqual(pbUtf8, pbRepeat) && !bAutoRepeat) { m_tbRepeat.BackColor = AppDefs.ColorEditError; } else { m_tbRepeat.ResetBackColor(); } bool bRepeatEnable = (m_bEnabled && !bAutoRepeat); m_lblRepeat.Enabled = bRepeatEnable; m_tbRepeat.Enabled = bRepeatEnable; bool bQuality = m_bEnabled; if (m_bSprVar && bQuality) { if (SprEngine.MightChange(str)) // Perf. opt. { // {S:...} and {REF:...} may reference the entry that // is currently being edited and SprEngine will not see // the current data entered in the dialog; thus we // disable quality estimation for all strings containing // one of these placeholders if ((str.IndexOf(@"{S:", StrUtil.CaseIgnoreCmp) >= 0) || (str.IndexOf(@"{REF:", StrUtil.CaseIgnoreCmp) >= 0)) { bQuality = false; } else { SprContext ctx = new SprContext(m_ctxEntry, m_ctxDatabase, SprCompileFlags.NonActive, false, false); string strCmp = SprEngine.Compile(str, ctx); if (strCmp != str) { bQuality = false; } } } #if DEBUG else { SprContext ctx = new SprContext(m_ctxEntry, m_ctxDatabase, SprCompileFlags.NonActive, false, false); string strCmp = SprEngine.Compile(str, ctx); Debug.Assert(strCmp == str); } #endif } m_lblQualityPrompt.Enabled = bQuality; m_pbQuality.Enabled = bQuality; m_lblQualityInfo.Enabled = bQuality; if ((Program.Config.UI.UIFlags & (ulong)AceUIFlags.HidePwQuality) != 0) { m_lblQualityPrompt.Visible = false; m_pbQuality.Visible = false; m_lblQualityInfo.Visible = false; } else if (bQuality || !m_bSprVar) { UpdateQualityInfo(str); } else { UqiShowQuality(0, 0); } // MemUtil.ZeroByteArray(pbUtf8); // MemUtil.ZeroByteArray(pbRepeat); --m_uBlockUIUpdate; }