Exemplo n.º 1
0
        /// <summary>
        /// Creates a new tab and sets up a results control on it.
        /// </summary>
        public void AddTab()
        {
            mTabControl.TabPages.Insert(mTabControl.TabPages.Count - 1, new TabPage("Results"));
            mTabControl.SelectedTab = mTabControl.TabPages[mTabControl.TabPages.Count - 2];
            GrepResults results = new GrepResults();

            results.ResultEvents += new GrepResults.ResultsEventSignal(aResultsControl_ResultEvents);
            results.Dock          = DockStyle.Fill;
            mTabControl.SelectedTab.Controls.Add(results);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new tab if the setting is desired and returns a grep results control.
        /// </summary>
        /// <returns>Grep Results control that can be used for displaying results.</returns>
        public GrepResults getControlForNewResults()
        {
            if (Settings.get().OpenNewTab&& ((GrepResults)mTabControl.SelectedTab.Controls[0]).TextBox.Text != String.Empty)
            {
                AddTab();
            }
            GrepResults results = (GrepResults)mTabControl.SelectedTab.Controls[0];

            results.TextBox.Text         = "";
            results.SearchedDirectory    = Settings.get().SearchParams.SearchDirectory;
            mTabControl.SelectedTab.Text = Settings.get().SearchParams.Pattern;
            return(results);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Starts a search.  Gets the search parameters and creates a new file searcher.  Connects
        /// up with the results control.
        /// </summary>
        public void startSearch()
        {
            searchInit();
            mUiUpdateThrottle.Enabled = true;
            RtfUtility.WriteFileHeader(mStreamWriter);
            mStreamWriter.Flush();
            mInitialStreamLength = mMemoryStream.Position;

            if (Logger.get().LoggingEnabled)
            {
                Logger.get().AddData(new SearchParameters(Settings.get().SearchParams), "SearchParameters", "Search Parameters");
            }
            Settings.get().SearchParams.SearchInProgress = true;
            mResults = TabManager.get().getControlForNewResults();
            if (mFileSearcher != null)
            {
                mFileSearcher.HandleResults -= fileSearcher_HandleResults;
                mFileSearcher = null;
            }
            mFileSearcher = new Grep.FileSearcher(Settings.get().SearchParams);
            mFileSearcher.HandleResults += new Grep.FileSearcher.SearchResults(fileSearcher_HandleResults);
            mFileSearcher.search();
        }