Exemplo n.º 1
0
        // Token: 0x06002B78 RID: 11128 RVA: 0x000C6664 File Offset: 0x000C4864
        internal void GetPageAsync(int pageNumber, object userState)
        {
            if (pageNumber < 0)
            {
                throw new ArgumentOutOfRangeException("pageNumber", SR.Get("IDPNegativePageNumber"));
            }
            if (userState == null)
            {
                throw new ArgumentNullException("userState");
            }
            FixedDocumentSequence.GetPageAsyncRequest getPageAsyncRequest = new FixedDocumentSequence.GetPageAsyncRequest(new FixedDocumentSequence.RequestedPage(pageNumber), userState);
            this._asyncOps[userState] = getPageAsyncRequest;
            DispatcherOperationCallback method = new DispatcherOperationCallback(this._GetPageAsyncDelegate);

            base.Dispatcher.BeginInvoke(DispatcherPriority.Background, method, getPageAsyncRequest);
        }
Exemplo n.º 2
0
        // Token: 0x06002B92 RID: 11154 RVA: 0x000C6E1C File Offset: 0x000C501C
        private object _GetPageAsyncDelegate(object arg)
        {
            FixedDocumentSequence.GetPageAsyncRequest getPageAsyncRequest = (FixedDocumentSequence.GetPageAsyncRequest)arg;
            int pageNumber = getPageAsyncRequest.Page.PageNumber;

            if (getPageAsyncRequest.Cancelled || !this.TranslatePageNumber(pageNumber, out getPageAsyncRequest.Page.ChildPaginator, out getPageAsyncRequest.Page.ChildPageNumber) || getPageAsyncRequest.Cancelled)
            {
                this._NotifyGetPageAsyncCompleted(DocumentPage.Missing, pageNumber, null, true, getPageAsyncRequest.UserState);
                this._asyncOps.Remove(getPageAsyncRequest.UserState);
                return(null);
            }
            if (!this._pendingPages.Contains(getPageAsyncRequest.Page))
            {
                this._pendingPages.Add(getPageAsyncRequest.Page);
                getPageAsyncRequest.Page.ChildPaginator.GetPageCompleted += this._OnGetPageCompleted;
                getPageAsyncRequest.Page.ChildPaginator.GetPageAsync(getPageAsyncRequest.Page.ChildPageNumber, getPageAsyncRequest);
            }
            return(null);
        }
Exemplo n.º 3
0
 // Token: 0x06002B7A RID: 11130 RVA: 0x000C6748 File Offset: 0x000C4948
 internal void CancelAsync(object userState)
 {
     if (userState == null)
     {
         throw new ArgumentNullException("userState");
     }
     if (this._asyncOps.ContainsKey(userState))
     {
         FixedDocumentSequence.GetPageAsyncRequest getPageAsyncRequest = this._asyncOps[userState];
         if (getPageAsyncRequest != null)
         {
             getPageAsyncRequest.Cancelled = true;
             if (getPageAsyncRequest.Page.ChildPaginator != null)
             {
                 getPageAsyncRequest.Page.ChildPaginator.CancelAsync(getPageAsyncRequest);
             }
         }
     }
 }
Exemplo n.º 4
0
        // Token: 0x06002B93 RID: 11155 RVA: 0x000C6EF0 File Offset: 0x000C50F0
        private void _OnGetPageCompleted(object sender, GetPageCompletedEventArgs args)
        {
            FixedDocumentSequence.GetPageAsyncRequest getPageAsyncRequest = (FixedDocumentSequence.GetPageAsyncRequest)args.UserState;
            this._pendingPages.Remove(getPageAsyncRequest.Page);
            DocumentPage page       = DocumentPage.Missing;
            int          pageNumber = getPageAsyncRequest.Page.PageNumber;

            if (!args.Cancelled && args.Error == null && args.DocumentPage != DocumentPage.Missing)
            {
                page = new FixedDocumentSequenceDocumentPage(this, (DynamicDocumentPaginator)sender, args.DocumentPage);
                this._SynthesizeGlobalPageNumber((DynamicDocumentPaginator)sender, args.PageNumber, out pageNumber);
            }
            if (!args.Cancelled)
            {
                ArrayList arrayList = new ArrayList();
                IEnumerator <KeyValuePair <object, FixedDocumentSequence.GetPageAsyncRequest> > enumerator = this._asyncOps.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        KeyValuePair <object, FixedDocumentSequence.GetPageAsyncRequest> keyValuePair = enumerator.Current;
                        FixedDocumentSequence.GetPageAsyncRequest value = keyValuePair.Value;
                        if (getPageAsyncRequest.Page.Equals(value.Page))
                        {
                            ArrayList arrayList2 = arrayList;
                            keyValuePair = enumerator.Current;
                            arrayList2.Add(keyValuePair.Key);
                            this._NotifyGetPageAsyncCompleted(page, pageNumber, args.Error, value.Cancelled, value.UserState);
                        }
                    }
                }
                finally
                {
                    foreach (object key in arrayList)
                    {
                        this._asyncOps.Remove(key);
                    }
                }
            }
        }