Exemplo n.º 1
0
 public static async Task <TResult> HandleEntryPhase <TResult>(
     PhaseMethod <TResult> logic)
     where TResult : notnull
 {
     while (true)
     {
         if (await logic.Invoke() is Finished <TResult> finished)
         {
             return(finished.Value);
         }
     }
 }
Exemplo n.º 2
0
        public static async Task <IPhaseResult <TResult> > HandlePhase <TResult>(
            PhaseMethod <TResult> logic)
        {
            while (true)
            {
                switch (await logic.Invoke())
                {
                case Finished <TResult> finished: return(finished);

                case Cancelled <TResult> : return(PhaseResult.NeedsRetry <TResult>());
                }
            }
        }