Esempio n. 1
0
        // Token: 0x0600324E RID: 12878 RVA: 0x000DC808 File Offset: 0x000DAA08
        private void _RequestPageCallback(IAsyncResult ar)
        {
            PageContentAsyncResult pageContentAsyncResult = (PageContentAsyncResult)ar;

            if (pageContentAsyncResult == this._asyncOp && pageContentAsyncResult.Result != null)
            {
                LogicalTreeHelper.AddLogicalChild(this, pageContentAsyncResult.Result);
                this._pageRef = new WeakReference(pageContentAsyncResult.Result);
            }
            this._asyncOp = null;
            this._NotifyPageCompleted(pageContentAsyncResult.Result, pageContentAsyncResult.Exception, pageContentAsyncResult.IsCancelled, pageContentAsyncResult.AsyncState);
        }
        private void _RequestPageCallback(IAsyncResult ar)
        {
            PageContentAsyncResult par = (PageContentAsyncResult)ar;

            if (par == _asyncOp && par.Result != null)
            {
                //par.Result.IsTreeSeparator = true;
                LogicalTreeHelper.AddLogicalChild(this, par.Result);
                _pageRef = new WeakReference(par.Result);
            }

            // Set outstanding async op to null to allow for reentrancy during callback.
            _asyncOp = null;
            _NotifyPageCompleted(par.Result, par.Exception, par.IsCancelled, par.AsyncState);
        }
        /// <summary>
        /// Initiate an asynchoronus request to load the page tree.
        /// </summary>
        /// <param name="forceReload">Force reloading the page tree instead of using cached value</param>
        public void GetPageRootAsync(bool forceReload)
        {
#if DEBUG
            DocumentsTrace.FixedFormat.PageContent.Trace(string.Format("PageContent.GetPageRootAsync Source={0}", Source == null ? new Uri("", UriKind.RelativeOrAbsolute) : Source));
#endif

//             VerifyAccess();

            if (_asyncOp != null)
            {
                return;
            }

            FixedPage p = null;
            if (!forceReload)
            {
                p = _GetLoadedPage();
            }


            if (p != null)
            {
                _NotifyPageCompleted(p, null, false, null);
            }
            else
            {
                Dispatcher dispatcher = this.Dispatcher;
                Uri        uriToLoad  = _ResolveUri();

                if (uriToLoad != null || _child != null)
                {
                    _asyncOp = new PageContentAsyncResult(new AsyncCallback(_RequestPageCallback), null, dispatcher, uriToLoad, uriToLoad, _child);
                    _asyncOp.DispatcherOperation = dispatcher.BeginInvoke(DispatcherPriority.Normal, new DispatcherOperationCallback(_asyncOp.Dispatch), null);
                }
            }
        }
        /// <summary>
        /// Initiate an asynchoronus request to load the page tree.
        /// </summary>
        /// <param name="forceReload">Force reloading the page tree instead of using cached value</param>
        public void GetPageRootAsync(bool forceReload)
        {
#if DEBUG
            DocumentsTrace.FixedFormat.PageContent.Trace(string.Format("PageContent.GetPageRootAsync Source={0}", Source == null ? new Uri("", UriKind.RelativeOrAbsolute) : Source));
#endif

//             VerifyAccess();

            if (_asyncOp != null)
            {
                return;
            }

            FixedPage p = null;
            if (!forceReload)
            {
                p = _GetLoadedPage();
            }


            if (p != null)
            {
                _NotifyPageCompleted(p, null, false, null);
            }
            else
            {
                Dispatcher dispatcher = this.Dispatcher;
                Uri uriToLoad = _ResolveUri();

                if (uriToLoad != null || _child != null)
                {
                    _asyncOp = new PageContentAsyncResult(new AsyncCallback(_RequestPageCallback), null, dispatcher, uriToLoad, uriToLoad, _child);
                    _asyncOp.DispatcherOperation = dispatcher.BeginInvoke(DispatcherPriority.Normal, new DispatcherOperationCallback(_asyncOp.Dispatch), null);
                }
            }
        }