//--------------------------------------------------------------------
        //
        // Internal Methods
        //
        //---------------------------------------------------------------------

        #region DispatcherOperationCallback

        //---------------------------------------------------------------------
        internal object Dispatch(object arg)
        {
            if (this._exception != null)
            {
                // force finish if there was any exception
                this._getpageStatus = GetPageStatus.Finished;
            }
            switch (this._getpageStatus)
            {
            case GetPageStatus.Loading:
                try
                {
                    if (this._child != null)
                    {
                        this._completedSynchronously = true;
                        this._result   = this._child;
                        _getpageStatus = GetPageStatus.Finished;
                        goto case GetPageStatus.Finished;
                    }

                    //
                    // Note if _source == null, exception will
                    // be thrown.
                    //
                    Stream responseStream;
                    PageContent._LoadPageImpl(this._baseUri, this._source, out _result, out responseStream);

                    if (_result == null || _result.IsInitialized)
                    {
                        responseStream.Close();
                    }
                    else
                    {
                        _pendingStream       = responseStream;
                        _result.Initialized += new EventHandler(_OnPaserFinished);
                    }
                    _getpageStatus = GetPageStatus.Finished;
                }

                catch (ApplicationException e)
                {
                    this._exception = e;
                }
                goto case GetPageStatus.Finished;

            case GetPageStatus.Cancelled:
                // do nothing
                goto case GetPageStatus.Finished;

            case GetPageStatus.Finished:
                _isCompleted = true;
                if (_callback != null)
                {
                    _callback(this);
                }
                break;
            }
            return(null);
        }
        // Token: 0x0600325F RID: 12895 RVA: 0x000DCB18 File Offset: 0x000DAD18
        internal object Dispatch(object arg)
        {
            if (this._exception != null)
            {
                this._getpageStatus = PageContentAsyncResult.GetPageStatus.Finished;
            }
            switch (this._getpageStatus)
            {
            case PageContentAsyncResult.GetPageStatus.Loading:
                try
                {
                    if (this._child != null)
                    {
                        this._completedSynchronously = true;
                        this._result        = this._child;
                        this._getpageStatus = PageContentAsyncResult.GetPageStatus.Finished;
                    }
                    else
                    {
                        Stream stream;
                        PageContent._LoadPageImpl(this._baseUri, this._source, out this._result, out stream);
                        if (this._result == null || this._result.IsInitialized)
                        {
                            stream.Close();
                        }
                        else
                        {
                            this._pendingStream       = stream;
                            this._result.Initialized += this._OnPaserFinished;
                        }
                        this._getpageStatus = PageContentAsyncResult.GetPageStatus.Finished;
                    }
                }
                catch (ApplicationException exception)
                {
                    this._exception = exception;
                }
                break;

            case PageContentAsyncResult.GetPageStatus.Cancelled:
            case PageContentAsyncResult.GetPageStatus.Finished:
                break;

            default:
                goto IL_D4;
            }
            this._isCompleted = true;
            if (this._callback != null)
            {
                this._callback(this);
            }
IL_D4:
            return(null);
        }
Exemple #3
0
        // Token: 0x0600324F RID: 12879 RVA: 0x000DC870 File Offset: 0x000DAA70
        private FixedPage _LoadPage()
        {
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordXPS, EventTrace.Event.WClientDRXGetPageBegin);
            FixedPage fixedPage = null;

            try
            {
                if (this._child != null)
                {
                    fixedPage = this._child;
                }
                else
                {
                    Uri uri = this._ResolveUri();
                    if (uri != null)
                    {
                        Stream stream;
                        PageContent._LoadPageImpl(((IUriContext)this).BaseUri, uri, out fixedPage, out stream);
                        if (fixedPage == null || fixedPage.IsInitialized)
                        {
                            stream.Close();
                        }
                        else
                        {
                            this._pendingStreams.Add(fixedPage, stream);
                            fixedPage.Initialized += this._OnPaserFinished;
                        }
                    }
                }
                if (fixedPage != null)
                {
                    LogicalTreeHelper.AddLogicalChild(this, fixedPage);
                    this._pageRef = new WeakReference(fixedPage);
                }
                else
                {
                    this._pageRef = null;
                }
            }
            finally
            {
                EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordXPS, EventTrace.Event.WClientDRXGetPageEnd);
            }
            return(fixedPage);
        }