예제 #1
0
 /// <summary>
 /// Just update the commands and don't send them out
 /// </summary>
 public void UpdateCommands()
 {
     _outputMediator.LockOutputs();
     try
     {
         if (OutputCount > 15000)
         {
             Parallel.For(0, OutputCount, _parallelOptions, () => ControllerModule.DataPolicyFactory.CreateDataPolicy(), (x, loopState, dataPolicy) =>
             {
                 var o = Outputs[x].State;
                 Outputs[x].Command = o?.Value != null ? dataPolicy.GenerateCommand(o) : null;
                 return(dataPolicy);
             }, (x) => { });                     //nothing to do but let the datapolicy expire
         }
         else
         {
             for (int x = 0; x < OutputCount; x++)
             {
                 var o = Outputs[x].State;
                 Outputs[x].Command = o?.Value != null?_dataPolicy.GenerateCommand(o) : null;
             }
         }
     }
     finally
     {
         _outputMediator.UnlockOutputs();
     }
 }
예제 #2
0
 private ICommand GenerateOutputCommand(CommandOutput output)
 {
     if (output.State != null)
     {
         return(_dataPolicy.GenerateCommand(output.State));
     }
     return(null);
 }
예제 #3
0
 private ICommand _GenerateOutputCommand(CommandOutput output)
 {
     if (output.State != null)
     {
         IDataPolicy effectiveDataPolicy = _dataPolicyProvider.GetDataPolicyForOutput(output);
         ICommand    command             = effectiveDataPolicy.GenerateCommand(output.State);
         if (command != null)
         {
             List <ICommand> commands = new List <ICommand>();
             commands.Add(command);
             CommandsDataFlowData data = new CommandsDataFlowData(commands);
             command = effectiveDataPolicy.GenerateCommand(data);
         }
         return(command);
     }
     return(null);
 }
예제 #4
0
 private ICommand _GenerateOutputCommand(CommandOutput output)
 {
     if (output.State != null)
     {
         IDataPolicy effectiveDataPolicy = _dataPolicyProvider.GetDataPolicyForOutput(output);
         return(effectiveDataPolicy.GenerateCommand(output.State));
     }
     return(null);
 }
예제 #5
0
        private ICommand _GenerateOutputCommand(CommandOutput output)
        {
            if (output.State != null)
            {
                var lst = output.State.Value as List <IIntentState>;

                IDataPolicy effectiveDataPolicy = _dataPolicyProvider.GetDataPolicyForOutput(output);
                return(effectiveDataPolicy.GenerateCommand(output.State));
            }
            return(null);
        }