/// <summary>
 /// Reset the list of matching items.
 /// </summary>
 /// <param name="searchKey"></param>
 protected void ResetMatches(string searchKey)
 {
     try
     {
         Cursor = Cursors.WaitCursor;
         if (m_oldSearchKey == searchKey)
         {
             Cursor = Cursors.Default;
             return;                     // Nothing new to do, so skip it.
         }
         else
         {
             // disable Go button until we rebuild our match list.
             btnOK.Enabled = false;
         }
         m_oldSearchKey = searchKey;
         List <ExtantReversalIndexEntryInfo> matches =
             ExtantReversalIndexEntryInfo.ExtantEntries(m_cache, searchKey, m_ws);
         (matchingEntries as MatchingReversalEntriesBrowser).ResetContents(m_cache,
                                                                           matches, m_filteredEntries);
     }
     finally
     {
         Cursor = Cursors.Default;
     }
 }
        public void SetDlgInfo(Mediator mediator, WindowParams wp, List <IReversalIndexEntry> filteredEntries)
        {
            CheckDisposed();

            Debug.Assert(filteredEntries != null && filteredEntries.Count > 0);

            m_mediator    = mediator;
            m_cache       = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
            m_ws          = (filteredEntries[0] as ReversalIndexEntry).ReversalIndex.WritingSystemRAHvo;
            m_owningIndex = (filteredEntries[0] as ReversalIndexEntry).Owner;
            // Don't bother filtering out the current entry -- we don't do it for lex entries, why
            // do it here? (SFM 4/23/2009 Why? because it causes a crash, so uncommented)
            foreach (IReversalIndexEntry rie in filteredEntries)
            {
                ExtantReversalIndexEntryInfo eriei = new ExtantReversalIndexEntryInfo();
                eriei.ID = rie.Hvo;
                m_filteredEntries.Add(eriei);
            }
            // End SFM edit

            btnOK.Text  = wp.m_btnText;
            Text        = wp.m_title;
            label1.Text = wp.m_label;

            m_tbForm.Font = new Font(
                m_cache.LanguageWritingSystemFactoryAccessor.get_EngineOrNull(m_ws).DefaultSerif,
                10);
            m_tbForm.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
            m_tbForm.StyleSheet           = FontHeightAdjuster.StyleSheetFromMediator(mediator);
            m_tbForm.WritingSystemCode    = m_ws;
            m_tbForm.AdjustStringHeight   = false;
            m_tsf                 = TsStrFactoryClass.Create();
            m_tbForm.Tss          = m_tsf.MakeString("", m_ws);
            m_tbForm.TextChanged += new EventHandler(m_tbForm_TextChanged);

            btnInsert.Visible = false;
            btnHelp.Visible   = true;

            switch (Text)
            {
            case "Find Reversal Entry":
                m_helpTopic = "khtpFindReversalEntry";
                break;

            case "Move Reversal Entry":
                m_helpTopic = "khtpMoveReversalEntry";
                break;
            }
            if (m_helpTopic != null && FwApp.App != null)            // FwApp.App could be null during tests
            {
                this.helpProvider = new System.Windows.Forms.HelpProvider();
                this.helpProvider.HelpNamespace = FwApp.App.HelpFile;
                this.helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(m_helpTopic, 0));
                this.helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic);
            }
            Debug.Assert(m_mediator != null);
            ReplaceMatchingItemsControl();

            // Adjust things if the form box needs to grow to accommodate its style.
            int oldHeight = m_tbForm.Height;
            int newHeight = Math.Max(oldHeight, m_tbForm.PreferredHeight);
            int delta     = newHeight - oldHeight;

            if (delta != 0)
            {
                m_tbForm.Height = newHeight;
                FontHeightAdjuster.GrowDialogAndAdjustControls(this, delta, m_tbForm);
            }
        }