private void OnLoadBackground(IDocumentContainer container, SrmDocument document) { try { // Made on a new thread. LocalizationHelper.InitThread(GetType().Name + " thread"); // Not L10N SrmDocument docCurrent = container.Document; // If the document identity has changed, or the current document is loaded, // then end the processing. if (!document.EqualsId(docCurrent) || IsLoaded(docCurrent)) { EndProcessing(document); return; } LoadBackground(container, document, docCurrent); // Force a document changed notification, since loading blocks them // from triggering new processing, but new processing may have accumulated OnDocumentChanged(container, new DocumentChangedEventArgs(docCurrent)); } catch (Exception exception) { Program.ReportException(exception); } }
private void OnLoadBackground(IDocumentContainer container, SrmDocument document) { try { // Made on a new thread. LocalizationHelper.InitThread(GetType().Name + @" thread"); Thread.CurrentThread.Priority = ThreadPriority.BelowNormal; SrmDocument docCurrent = container.Document; // If the document identity has changed, or the current document is loaded, // then end the processing. if (!document.EqualsId(docCurrent) || IsLoaded(docCurrent)) { EndProcessing(document); return; } LoadBackground(container, document, docCurrent); // Did the container change out its document while we were working? EndProcessingNotInContainer(container); if (!IsMultiThreadAware) { // Force a document changed notification, since loading blocks them // from triggering new processing, but new processing may have accumulated if (!container.IsClosing) { OnDocumentChanged(container, new DocumentChangedEventArgs(docCurrent)); } } } catch (Exception exception) { Program.ReportException(exception); } finally { Interlocked.Decrement(ref _activeThreadCount); } }
private void OnLoadBackground(IDocumentContainer container, SrmDocument document) { try { // Made on a new thread. LocalizationHelper.InitThread(GetType().Name + " thread"); // Not L10N SrmDocument docCurrent = container.Document; // If the document identity has changed, or the current document is loaded, // then end the processing. if (!document.EqualsId(docCurrent) || IsLoaded(docCurrent)) { EndProcessing(document); return; } LoadBackground(container, document, docCurrent); // Force a document changed notification, since loading blocks them // from triggering new processing, but new processing may have accumulated OnDocumentChanged(container, new DocumentChangedEventArgs(docCurrent)); } catch (Exception exception) { Program.ReportException(exception); } }