Exemplo n.º 1
0
        // Token: 0x06007028 RID: 28712 RVA: 0x002037E8 File Offset: 0x002019E8
        private object OnBackgroundPagination(object arg)
        {
            DateTime now = DateTime.Now;

            this._backgroundPaginationOperation = null;
            this._dispatcherObject.VerifyAccess();
            if (this._document.StructuralCache.IsFormattingInProgress)
            {
                throw new InvalidOperationException(SR.Get("FlowDocumentFormattingReentrancy"));
            }
            if (this._document.StructuralCache.PtsContext.Disposed)
            {
                return(null);
            }
            using (this._document.Dispatcher.DisableProcessing())
            {
                this._document.StructuralCache.IsFormattingInProgress = true;
                try
                {
                    for (int i = 0; i < this._asyncRequests.Count; i++)
                    {
                        FlowDocumentPaginator.AsyncRequest asyncRequest = this._asyncRequests[i];
                        if (asyncRequest.Process())
                        {
                            this._asyncRequests.RemoveAt(i);
                            i--;
                        }
                    }
                    DateTime now2 = DateTime.Now;
                    if (this._backgroundPagination && !this._brt.IsClean)
                    {
                        while (!this._brt.IsClean)
                        {
                            this.FormatPage(this._brt.Count);
                            long num = (DateTime.Now.Ticks - now.Ticks) / 10000L;
                            if (num > 30L)
                            {
                                break;
                            }
                        }
                        this.InitiateNextAsyncOperation();
                    }
                }
                finally
                {
                    this._document.StructuralCache.IsFormattingInProgress = false;
                }
            }
            return(null);
        }
Exemplo n.º 2
0
 // Token: 0x06007015 RID: 28693 RVA: 0x00203420 File Offset: 0x00201620
 public override void CancelAsync(object userState)
 {
     if (userState == null)
     {
         this.CancelAllAsyncOperations();
         return;
     }
     for (int i = 0; i < this._asyncRequests.Count; i++)
     {
         FlowDocumentPaginator.AsyncRequest asyncRequest = this._asyncRequests[i];
         if (asyncRequest.UserState == userState)
         {
             asyncRequest.Cancel();
             this._asyncRequests.RemoveAt(i);
             i--;
         }
     }
 }