コード例 #1
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     _stateHilite = null;             // Stop the currently-running highlighting
     if (_statuswriter != null)
     {
         _statuswriter.ClearStatus();
         _statuswriter = null;
     }
     _wordsSearchHits   = null;
     _nCurrentSearchHit = -1;
 }
コード例 #2
0
        /// <summary>
        /// Initiates the async highlighting of the search hits.
        /// </summary>
        /// <param name="words">Words to be highlighted. MUST belong to a single document section.</param>
        public void HighlightWords(WordPtr[] words)
        {
            #region Preconditions
            if (words == null)
            {
                return;
            }

            // Validness check
            WordPtr.AssertValid(words, true);
            #endregion Preconditions

            _wordsSearchHits = null;             // Here the real search hits will be stored; in case of main highlighting they correspond to the ones passed in
            _statuswriter    = Core.UIManager.GetStatusWriter(this, StatusPane.UI);
            _statuswriter.ShowStatus("Highlighting search hits in the document…");

            // Initiate the async hilite process
            _stateHilite = new AsyncHighlightState(words);
            if (StartHiliteMain(_stateHilite))
            {
                Core.UserInterfaceAP.QueueJobAt(DateTime.Now.AddMilliseconds(500), "Highlight the search hits.", new MethodInvoker(StepHilite));                       // Succeeded — queue execution
            }
            else
            {             // Failed — deinitialize
                _stateHilite = null;
                _statuswriter.ClearStatus();
                _statuswriter = null;
                Trace.WriteLine("Failed to initiate the main highlighting scheme.", "[JRTB]");
            }
        }
コード例 #3
0
        protected override void Execute()
        {
            IResource resFolder;

            if (!IsDataCorrect(out resFolder, _folder))
            {
                return;
            }

            IStatusWriter statusWriter = Core.UIManager.GetStatusWriter(this, StatusPane.Network);

            statusWriter.ShowStatus("Synchronizing folder " + _folder.Name + "...");

            OutlookSession.ProcessJobs();
            try
            {
                MailSync mailSync = new MailSync(false, _dateRestriction);
                mailSync.AddMailResources(Folder.GetMessageList(resFolder));
                mailSync.EnumerateMessageItems(_folder);
                mailSync.RemoveDeletedMailsFromIndex();
            }
            finally
            {
                statusWriter.ClearStatus();
            }
        }
コード例 #4
0
ファイル: TextIndexManager.cs プロジェクト: mo5h/omeo
        internal void EndBatchUpdate()
        {
            _documentsIndexed = 0;

            try
            {
                _textIndexer.EndBatchUpdate();
            }
            catch (FormatException ex)
            {
                Core.ReportException(ex, ExceptionReportFlags.AttachLog);
                RebuildIndex();
                return;
            }
            catch (System.IO.IOException)
            {
                Core.UIManager.ShowSimpleMessageBox("Text Index Operation Failed",
                                                    "System encountered a serious I/O error while constructing text index." +
                                                    " Indexing operation will be suspended until next start of the Omea.");
                SuspendIndexingByError();
                return;
            }

            if (_statusWriter != null)
            {
                _statusWriter.ClearStatus();
            }
            if (IndexLoaded != null)
            {
                IndexLoaded(this, EventArgs.Empty);
            }

            AnalyzeFreeSpace();
        }
コード例 #5
0
ファイル: SccPlugin.cs プロジェクト: mo5h/omeo
        internal static void SynchronizeRepositories()
        {
            foreach (IResource res in Core.ResourceStore.GetAllResources(Props.RepositoryResource))
            {
                _statusWriter.ShowStatus("Updating repository " + res.DisplayName + "...");
                if (Core.ProgressWindow != null)
                {
                    Core.ProgressWindow.UpdateProgress(0, "Updating repository " + res.DisplayName + "...", null);
                }

                RepositoryType repType = GetRepositoryType(res);
                if (repType != null)
                {
                    repType.UpdateRepository(res);
                }
            }

            _statusWriter.ClearStatus();
        }
コード例 #6
0
        protected override void Execute()
        {
            if (OutlookSession.OutlookProcessor.ShuttingDown)
            {
                return;
            }

            _statusWriter.ShowStatus("Delivering mail...");
            try
            {
                OutlookMailDeliver.DeliverNow();
            }
            catch (Exception exception)
            {
                Tracer._TraceException(exception);
            }
            finally
            {
                _statusWriter.ClearStatus();
            }
        }
コード例 #7
0
ファイル: FolderEnumerator.cs プロジェクト: mo5h/omeo
        protected override void Execute()
        {
            if (OutlookSession.OutlookProcessor.ShuttingDown)
            {
                return;
            }

            IStatusWriter statusWriter = Core.UIManager.GetStatusWriter(this, StatusPane.Network);

            statusWriter.ShowStatus("Performing background mail synchronization...");
            Tracer._Trace("MailSyncBackground is executed");
            foreach (IEMsgStore msgStore in OutlookSession.GetMsgStores())
            {
                if (OutlookSession.OutlookProcessor.ShuttingDown)
                {
                    break;
                }

                OutlookSession.ProcessJobs();

                if (msgStore == null)
                {
                    continue;
                }
                if (OutlookProcessor.IsIgnoredInfoStore(msgStore))
                {
                    continue;
                }

                string storeID = msgStore.GetBinProp(MAPIConst.PR_STORE_ENTRYID);
                string name    = msgStore.GetStringProp(MAPIConst.PR_DISPLAY_NAME);
                FolderDescriptorEnumerator.Do(msgStore, storeID, name, this);
            }
            statusWriter.ClearStatus();
            ProcessedFolders.DecRef();
        }
コード例 #8
0
ファイル: DebugActions.cs プロジェクト: mo5h/omeo
        public override void Execute(IActionContext context)
        {
            IResourceStore store    = Core.ResourceStore;
            IResourceList  articles = store.GetAllResources("Article").Minus(
                store.FindResourcesWithProp(null, Core.Props.IsDeleted));
            IResourceList resources = context.SelectedResources;

            if (!resources.AllResourcesOfType("NewsGroup"))
            {
                resources = null;
            }
            IStatusWriter writer = Core.UIManager.GetStatusWriter(this, StatusPane.UI);

            try
            {
                HashMap readers = new HashMap();
                int     i       = 0;
                int     percent = -1;
                foreach (IResource article in articles)
                {
                    int p = (i++ *100) / articles.Count;
                    if (p > percent)
                    {
                        percent = p;
                        writer.ShowStatus("Looking through news articles: " + percent.ToString() + "%");
                        Application.DoEvents();
                    }
                    if (resources != null &&
                        article.GetLinksOfType("NewsGroup", "Newsgroups").Intersect(resources).Count == 0)
                    {
                        continue;
                    }
                    string[] headers = article.GetPropText("MessageHeaders").Split('\n');
                    string   reader  = null;
                    foreach (string headerLine in headers)
                    {
                        if (headerLine.StartsWith("X-Newsreader: "))
                        {
                            reader = headerLine.Substring("X-Newsreader: ".Length).TrimEnd('\r', '\n');
                        }
                        else if (headerLine.StartsWith("User-Agent: "))
                        {
                            reader = headerLine.Substring("User-Agent: ".Length).TrimEnd('\r', '\n');
                        }
                        if (reader != null)
                        {
                            for (int j = 1; j < reader.Length; ++j)
                            {
                                if (Char.IsDigit(reader[j]))
                                {
                                    reader = reader.Substring(0, j - 1);
                                    break;
                                }
                            }
                            reader = reader.Trim();
                            if (reader.Length == 0)
                            {
                                break;
                            }
                            HashMap.Entry entry = readers.GetEntry(reader);
                            if (entry == null)
                            {
                                readers[reader] = 1;
                            }
                            else
                            {
                                entry.Value = ((int)entry.Value) + 1;
                            }
                            break;
                        }
                    }
                }
                PriorityQueue queue = new PriorityQueue();
                foreach (HashMap.Entry e in readers)
                {
                    queue.Push((int)e.Value, e.Key);
                }
                StringBuilder readersStat = new StringBuilder();
                foreach (PriorityQueue.QueueEntry e in queue)
                {
                    readersStat.Append("\r\n");
                    readersStat.Append(e.Value);
                    readersStat.Append(": ");
                    readersStat.Append(e.Key);
                }
                MessageBox.Show(readersStat.ToString(), "News Readers Statistics", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                writer.ClearStatus();
            }
        }