Пример #1
0
 private void HandleTransformations(object result)
 {
     if (result is Frame)
     {
         var input = (Frame)result;
         Interlocked.Add(ref interlock, (int)input.Count);
         foreach (var name in input.GetAttributeNames())
         {
             input.GetOrSubscribe(name, HandleTransformation);
         }
         if (Interlocked.Decrement(ref interlock) == 0)
         {
             master.Slot(this);
         }
     }
     else
     {
         master.ReportOtherError(source_ref, String.Format("Expected “transformations” to be a frame. Got {0} instead.", Stringish.HideImplementation(result.GetType())));
     }
 }
Пример #2
0
 private void HandleArgs(object result)
 {
     if (result is Frame)
     {
         var input = (Frame)result;
         Interlocked.Add(ref interlock, (int)input.Count);
         this.input = new string[input.Count];
         var index = 0;
         foreach (var name in input.GetAttributeNames())
         {
             var target_index = index++;
             input.GetOrSubscribe(name, arg => {
                 if (arg is Stringish)
                 {
                     this.input[target_index] = arg.ToString();
                     if (Interlocked.Decrement(ref interlock) == 0)
                     {
                         master.Slot(this);
                     }
                 }
                 else
                 {
                     master.ReportOtherError(source_ref, String.Format("Expected “args” to contain strings. Got {0} instead.", arg.GetType()));
                 }
             });
         }
         if (Interlocked.Decrement(ref interlock) == 0)
         {
             master.Slot(this);
         }
     }
     else
     {
         master.ReportOtherError(source_ref, String.Format("Expected “args” to be a frame. Got {0} instead.", Stringish.HideImplementation(result.GetType())));
     }
 }