Ejemplo n.º 1
0
        /// <summary>
        /// Fails the Future, or throws an exception
        /// if the Future has already been set or failed.
        /// </summary>
        public void Fail(Future.FailureType inType, object inArg)
        {
            if (m_State == FutureState.Cancelled)
            {
                return;
            }

            if (m_State != FutureState.InProgress)
            {
                throw new InvalidOperationException("Cannot fail Future once Future has completed or failed!");
            }
            m_State          = FutureState.Failed;
            m_Failure.Type   = inType;
            m_Failure.Object = inArg;

            if (m_CallbackFail != null)
            {
                Async.InvokeAsync(m_CallbackFail);
                m_CallbackFail = null;
            }

            if (m_CallbackFailWithArgs != null)
            {
                Async.InvokeAsync(InvokeFailure, m_CallbackFailWithArgs);
                m_CallbackFailWithArgs = null;
            }

            m_CallbackComplete = null;
            m_CallbackProgress = null;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Fails the Future, or throws an exception
 /// if the Future has already been set or failed.
 /// </summary>
 public void Fail(Future.FailureType inType)
 {
     Fail(inType, null);
 }