コード例 #1
0
        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
 private IEnumerable <Expression> __concurrentrequest(Chameneo creature, Action <object> __success, Action <Exception> __failure)
 {
     if (_first != null)
     {
         //perform meeting
         var firstColor = _first.Colour;
         _first.meet(creature, creature.Colour);
         creature.meet(_first, firstColor);
         //prepare for next
         _first = null;
         _meetings--;
         if (_meetings == 0)
         {
             Node.Stop();
         }
     }
     else
     {
         _first = creature;
     }
     {
         __dispatch("request");
         if (__success != null)
         {
             __success(null);
         }
         yield break;
     }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: ChameneoRedux.xs.cs プロジェクト: tylike/Excess
        public void request(Chameneo creature, CancellationToken cancellation, Action <object> success, Action <Exception> failure)
        {
            var __success      = success;
            var __failure      = failure;
            var __cancellation = cancellation;

            __enter(() => __advance(__concurrentrequest(creature, __cancellation, __success, __failure).GetEnumerator()), failure);
        }
コード例 #5
0
ファイル: ChameneoRedux.xs.cs プロジェクト: tylike/Excess
        public Task <object> request(Chameneo creature, CancellationToken cancellation)
        {
            var                completion     = new TaskCompletionSource <object>();
            Action <object>    __success      = (__res) => completion.SetResult((object)__res);
            Action <Exception> __failure      = (__ex) => completion.SetException(__ex);
            var                __cancellation = cancellation;

            __enter(() => __advance(__concurrentrequest(creature, __cancellation, __success, __failure).GetEnumerator()), __failure);
            return(completion.Task);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
ファイル: ChameneoRedux.xs.cs プロジェクト: tylike/Excess
 private IEnumerable <Expression> __concurrentmeet(Chameneo other, Color color, CancellationToken __cancellation, Action <object> __success, Action <Exception> __failure)
 {
     Colour = ColorUtils.Compliment(Colour, color);
     Meetings++;
     if (other == this)
     {
         MeetingsWithSelf++;
     }
     {
         __dispatch("meet");
         if (__success != null)
         {
             __success(null);
         }
         yield break;
     }
 }
コード例 #8
0
ファイル: ChameneoRedux.xs.cs プロジェクト: tylike/Excess
 public void meet(Chameneo other, Color color)
 {
     meet(other, color, default(CancellationToken), null, null);
 }
コード例 #9
0
ファイル: ChameneoRedux.xs.cs プロジェクト: tylike/Excess
 public void request(Chameneo creature)
 {
     request(creature, default(CancellationToken), null, null);
 }