protected async override Task Run()
        {
            if (_sub == null && !SubRoutineComposite.GetSubRoutineMyName(SubRoutineName, out _sub))
            {
                PBLog.Warn("{0}: {1}.", ProfessionbuddyBot.Instance.Strings["Error_SubroutineNotFound"], SubRoutineName);
                IsDone = true;
                return;
            }

            using (SubRoutineComposite.Activate(_sub))
            {
                try
                {
                    if (_sub.IsDone)
                    {
                        _sub.Reset();
                    }
                    await _sub;
                }
                finally
                {
                    IsDone = _sub.IsDone;
                }
            }
        }
Example #2
0
 private async Task <bool> SubRoutineExecutor()
 {
     using (SubRoutineComposite.Activate(_sub))
     {
         if (_sub.IsDone)
         {
             _sub.Reset();
         }
         return(await _sub);
     }
 }