示例#1
0
文件: Debug.cs 项目: zihotki/Excess
        public void request(Chameneo creature, Action <object> success = null, Action <Exception> failure = null)
        {
            var __success = success;
            var __failure = failure;

            __enter(() => __advance(__concurrentrequest(creature, __success, __failure).GetEnumerator()), failure);
        }
示例#2
0
文件: Debug.cs 项目: zihotki/Excess
        public void meet(Chameneo other, Color color, Action <object> success = null, Action <Exception> failure = null)
        {
            var __success = success;
            var __failure = failure;

            __enter(() => __advance(__concurrentmeet(other, color, __success, __failure).GetEnumerator()), failure);
        }
示例#3
0
文件: Debug.cs 项目: zihotki/Excess
 private IEnumerable <Expression> __concurrentrequest(Chameneo creature, Action <object> __success, Action <Exception> __failure)
 {
     if (_first != null)
     {
         //meet, exchange colors, etc
         var firstColor = _first.Colour;
         _first.meet(creature, creature.Colour);
         creature.meet(_first, firstColor);
         //reset for new pair
         _first = null;
         _meetings--;
         //exit
         if (_meetings == 0)
         {
             Node.Stop();
         }
     }
     else
     {
         _first = creature;
     }
     {
         __dispatch("request");
         if (__success != null)
         {
             __success(null);
         }
         yield break;
     }
 }
示例#4
0
文件: Debug.cs 项目: zihotki/Excess
        public Task <object> request(Chameneo creature, bool async)
        {
            if (!async)
            {
                throw new InvalidOperationException("use async: true");
            }
            var                completion = new TaskCompletionSource <object>();
            Action <object>    __success  = (__res) => completion.SetResult((object)__res);
            Action <Exception> __failure  = (__ex) => completion.SetException(__ex);

            __enter(() => __advance(__concurrentrequest(creature, __success, __failure).GetEnumerator()), __failure);
            return(completion.Task);
        }
示例#5
0
文件: Debug.cs 项目: zihotki/Excess
 private IEnumerable <Expression> __concurrentmeet(Chameneo other, Color color, Action <object> __success, Action <Exception> __failure)
 {
     Colour = compliment(Colour, color);
     Meetings++;
     if (other == this)
     {
         MeetingsWithSelf++;
     }
     {
         __dispatch("meet");
         if (__success != null)
         {
             __success(null);
         }
         yield break;
     }
 }