Example #1
0
        /// <summary>
        /// Writes the example text to the rich text box.
        /// </summary>
        private void writeExampleText()
        {
            int oldContext = Settings.get().ContextLineCount;

            Settings.get().ContextLineCount = 3;
            using (MemoryStream stream = new MemoryStream())
            {
                using (StreamWriter writer = new StreamWriter(stream))
                {
                    RtfUtility.WriteFileHeader(writer);
                    writer.Write(generateExampleRtf());
                    writer.Flush();
                    stream.Position = 0;
                    uRtfExample.LoadFile(stream, RichTextBoxStreamType.RichText);
                }
            }
            Settings.get().ContextLineCount = oldContext;
        }
Example #2
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();
        }