Пример #1
0
        public void EndCancel(IAsyncResult result)
        {
            lock (_renderLock)
            {
                if (_cancelResult != null)
                {
                    if (_cancelResult != result)
                    {
                        throw new SplicerException(Resources.ErrorAsyncResultNotIssuesByThisInstance);
                    }

                    if (_cancelResult.Consumed)
                    {
                        throw new SplicerException(Resources.ErrorEndCancelAlreadyCalledForAsyncResult);
                    }

                    _cancelResult.AsyncWaitHandle.WaitOne();

                    _cancelResult.Consume();

                    if (_cancelResult.Exception != null)
                    {
                        throw new SplicerException(Resources.ErrorExceptionOccuredDuringCancelRenderRequest,
                                                   _cancelResult.Exception);
                    }

                    _cancelResult = null;
                }
                else
                {
                    throw new SplicerException(Resources.ErrorMustCallBeginCancelBeforeEndCancel);
                }
            }
        }
Пример #2
0
        public void EndCancel(IAsyncResult result)
        {
            lock (_renderLock)
            {
                if (_cancelResult != null)
                {
                    if (_cancelResult != result)
                    {
                        throw new SplicerException("The supplied async result was not issued by this instance");
                    }

                    if (_cancelResult.Consumed)
                    {
                        throw new SplicerException("EndCancel has already been called fo this async result");
                    }

                    _cancelResult.AsyncWaitHandle.WaitOne();

                    _cancelResult.Consume();

                    if (_cancelResult.Exception != null)
                    {
                        throw new SplicerException(
                                  "Exception occured while attempting to cancel render request, see inner exception for details",
                                  _cancelResult.Exception);
                    }

                    _cancelResult = null;
                }
                else
                {
                    throw new SplicerException("You must call BeginCancel before EndCancel");
                }
            }
        }
Пример #3
0
        public IAsyncResult BeginCancel(AsyncCallback callback, object state)
        {
            lock (_renderLock)
            {
                if ((_cancelResult != null) && (!_cancelResult.Consumed))
                {
                    throw new SplicerException(
                              "You can not cancel, a request to cancel has already been issued - have you remembered to call EndCancel?");
                }
                else if (_state < RendererState.GraphStarted)
                {
                    throw new SplicerException("Graph not yet started");
                }
                else if (_state >= RendererState.GraphCompleting)
                {
                    throw new SplicerException("You can not cancel this renderer, it is already completing/canceling");
                }

                ChangeState(RendererState.GraphStarted, RendererState.Cancelling);

                _cancelResult = new RendererAsyncResult(callback, state);

                return(_cancelResult);
            }
        }
Пример #4
0
        /// <summary>
        /// Begins rendering and returns immediately.
        /// </summary>
        /// <remarks>
        /// Final status is sent as a <see cref="AbstractRenderer.RenderCompleted"/> event.
        /// </remarks>
        public IAsyncResult BeginRender(AsyncCallback callback, object state)
        {
            lock (_renderLock)
            {
                if ((_renderResult != null) && (_renderResult.Consumed))
                {
                    throw new SplicerException(Resources.ErrorPreviousRenderRequestInProgress);
                }

                ChangeState(RendererState.GraphStarted);

                _renderResult = new RendererAsyncResult(callback, state);
                _cancelResult = null;

                StartRender();

                return(_renderResult);
            }
        }
Пример #5
0
        /// <summary>
        /// Begins rendering and returns immediately.
        /// </summary>
        /// <remarks>
        /// Final status is sent as a <see cref="AbstractRenderer.RenderCompleted"/> event.
        /// </remarks>
        public IAsyncResult BeginRender(AsyncCallback callback, object state)
        {
            lock (_renderLock)
            {
                if ((_renderResult != null) && (_renderResult.Consumed))
                {
                    throw new SplicerException(
                              "A previous render request has not yet been completed - have you remembered to call EndRender?");
                }

                ChangeState(RendererState.GraphStarted);

                _renderResult = new RendererAsyncResult(callback, state);
                _cancelResult = null;

                StartRender();

                return(_renderResult);
            }
        }
Пример #6
0
        public IAsyncResult BeginCancel(AsyncCallback callback, object state)
        {
            lock (_renderLock)
            {
                if ((_cancelResult != null) && (!_cancelResult.Consumed))
                {
                    throw new SplicerException(Resources.ErrorAttemptToCancelWhenCancelInProgress);
                }
                else if (_state < RendererState.GraphStarted)
                {
                    throw new SplicerException(Resources.ErrorGraphNotYetStarted);
                }
                else if (_state >= RendererState.GraphCompleting)
                {
                    throw new SplicerException(Resources.ErrorAttemptToCancelWhenCancelingOrCompleting);
                }

                ChangeState(RendererState.GraphStarted, RendererState.Cancelling);

                _cancelResult = new RendererAsyncResult(callback, state);

                return(_cancelResult);
            }
        }
Пример #7
0
        public void EndCancel(IAsyncResult result)
        {
            lock (_renderLock)
            {
                if (_cancelResult != null)
                {
                    if (_cancelResult != result)
                    {
                        throw new SplicerException(Resources.ErrorAsyncResultNotIssuesByThisInstance);
                    }

                    if (_cancelResult.Consumed)
                    {
                        throw new SplicerException(Resources.ErrorEndCancelAlreadyCalledForAsyncResult);
                    }

                    _cancelResult.AsyncWaitHandle.WaitOne();

                    _cancelResult.Consume();

                    if (_cancelResult.Exception != null)
                    {
                        throw new SplicerException(Resources.ErrorExceptionOccuredDuringCancelRenderRequest,
                                                   _cancelResult.Exception);
                    }

                    _cancelResult = null;
                }
                else
                {
                    throw new SplicerException(Resources.ErrorMustCallBeginCancelBeforeEndCancel);
                }
            }
        }
Пример #8
0
        /// <summary>
        /// Begins rendering and returns immediately.
        /// </summary>
        /// <remarks>
        /// Final status is sent as a <see cref="AbstractRenderer.RenderCompleted"/> event.
        /// </remarks>
        public IAsyncResult BeginRender(AsyncCallback callback, object state)
        {
            lock (_renderLock)
            {
                if ((_renderResult != null) && (_renderResult.Consumed))
                {
                    throw new SplicerException(Resources.ErrorPreviousRenderRequestInProgress);
                }

                ChangeState(RendererState.GraphStarted);

                _renderResult = new RendererAsyncResult(callback, state);
                _cancelResult = null;

                StartRender();

                return _renderResult;
            }
        }
Пример #9
0
        public IAsyncResult BeginCancel(AsyncCallback callback, object state)
        {
            lock (_renderLock)
            {
                if ((_cancelResult != null) && (!_cancelResult.Consumed))
                {
                    throw new SplicerException(Resources.ErrorAttemptToCancelWhenCancelInProgress);
                }
                else if (_state < RendererState.GraphStarted)
                {
                    throw new SplicerException(Resources.ErrorGraphNotYetStarted);
                }
                else if (_state >= RendererState.GraphCompleting)
                {
                    throw new SplicerException(Resources.ErrorAttemptToCancelWhenCancelingOrCompleting);
                }

                ChangeState(RendererState.GraphStarted, RendererState.Cancelling);

                _cancelResult = new RendererAsyncResult(callback, state);

                return _cancelResult;
            }
        }