public WinFormsPresenter(IModel model, IView<Keys> view, IActionRunner actionRunner) { this.model = model; this.view = view; this.view.OnPressArrow += ViewOnPressArrow; this.actionRunner = actionRunner; }
public DynamicStateMachineRunner(DynamicStateMachineConfiguration configuration, IActionRunner actionRunner, ILogger logger) { stateMachine = new DynamicFiniteStateMachine(configuration); states = configuration.States; events = configuration.Events; actions = configuration.Actions; this.actionRunner = actionRunner; this.logger = logger; }
public Model(int minX, int maxX, int minY, int maxY, IActionRunner actionRunner) { this.minX = minX; this.maxX = maxX; this.minY = minY; this.maxY = maxY; this.actionRunner = actionRunner; observers = new List<IObserver>(); }
public SubscriptionActor( BuildAssetRegistryContext context, ILogger <SubscriptionActor> logger, IActionRunner actionRunner, IActorProxyFactory <IPullRequestActor> pullRequestActorFactory) { Context = context; Logger = logger; ActionRunner = actionRunner; PullRequestActorFactory = pullRequestActorFactory; }
public ITransducer CreateRunner(string path, IActionRunner actionRunner = null, ILogger logger = null) { if (string.IsNullOrEmpty(path)) { return(null); } var configuration = GetConfiguration(path); return(configuration != null ? new DynamicStateMachineRunner(GetConfiguration(path), actionRunner, logger) : null); }
public ProcDataflowBlock( IActionRunner actionRunner, int maximumNumberOfActionsInQueue, int?maximumDegreeOfParallelism) { this.actionRunner = actionRunner; this.maximumDegreeOfParallelism = maximumDegreeOfParallelism; collection = new AsyncCollection <Func <Task> >(new ConcurrentQueue <Func <Task> >(), maximumNumberOfActionsInQueue); collectionForReentrantItems = new AsyncCollection <Func <Task> >(new ConcurrentQueue <Func <Task> >()); nodeId = Guid.NewGuid(); }
public SubscriptionActor( IActorStateManager stateManager, ActorId id, BuildAssetRegistryContext context, ILogger <SubscriptionActor> logger, IActionRunner actionRunner, Func <ActorId, IPullRequestActor> pullRequestActorFactory) { StateManager = stateManager; Id = id; Context = context; Logger = logger; ActionRunner = actionRunner; PullRequestActorFactory = pullRequestActorFactory; }
/// <summary> /// Helper function used in CompositeActionHandler::RunAsync to /// add a child node, aka a step, to the current job to the Root.JobSteps based on the location. /// </summary> public IStep RegisterNestedStep( IActionRunner step, DictionaryContextData inputsData, int location, Dictionary <string, string> envData, bool cleanUp = false) { // If the context name is empty and the scope name is empty, we would generate a unique scope name for this child in the following format: // "__<GUID>" var safeContextName = !string.IsNullOrEmpty(ContextName) ? ContextName : $"__{Guid.NewGuid()}"; // Set Scope Name. Note, for our design, we consider each step in a composite action to have the same scope // This makes it much simpler to handle their outputs at the end of the Composite Action var childScopeName = !string.IsNullOrEmpty(ScopeName) ? $"{ScopeName}.{safeContextName}" : safeContextName; var childContextName = !string.IsNullOrEmpty(step.Action.ContextName) ? step.Action.ContextName : $"__{Guid.NewGuid()}"; step.ExecutionContext = Root.CreateChild(_record.Id, step.DisplayName, _record.Id.ToString("N"), childScopeName, childContextName, logger: _logger); step.ExecutionContext.ExpressionValues["inputs"] = inputsData; // Set Parent Attribute for Clean Up Step if (cleanUp) { step.ExecutionContext.FinalizeContext = this; } // Add the composite action environment variables to each step. #if OS_WINDOWS var envContext = new DictionaryContextData(); #else var envContext = new CaseSensitiveDictionaryContextData(); #endif foreach (var pair in envData) { envContext[pair.Key] = new StringContextData(pair.Value ?? string.Empty); } step.ExecutionContext.ExpressionValues["env"] = envContext; Root.JobSteps.Insert(location, step); return(step); }
protected PullRequestActorImplementation( ActorId id, IReminderManager reminders, IActorStateManager stateManager, IMergePolicyEvaluator mergePolicyEvaluator, BuildAssetRegistryContext context, IDarcRemoteFactory darcFactory, ILoggerFactory loggerFactory, IActionRunner actionRunner, Func <ActorId, ISubscriptionActor> subscriptionActorFactory) { Id = id; Reminders = reminders; StateManager = stateManager; MergePolicyEvaluator = mergePolicyEvaluator; Context = context; DarcFactory = darcFactory; ActionRunner = actionRunner; SubscriptionActorFactory = subscriptionActorFactory; Logger = loggerFactory.CreateLogger(TypeNameHelper.GetTypeDisplayName(GetType())); }
/// <summary> /// Helper function used in CompositeActionHandler::RunAsync to /// add a child node, aka a step, to the current job to the Root.JobSteps based on the location. /// </summary> public IStep CreateCompositeStep( string scopeName, IActionRunner step, DictionaryContextData inputsData, Dictionary <string, string> envData) { step.ExecutionContext = Root.CreateChild(_record.Id, _record.Name, _record.Id.ToString("N"), scopeName, step.Action.ContextName, logger: _logger, insideComposite: true, cancellationTokenSource: CancellationTokenSource.CreateLinkedTokenSource(_cancellationTokenSource.Token)); step.ExecutionContext.ExpressionValues["inputs"] = inputsData; step.ExecutionContext.ExpressionValues["steps"] = Global.StepsContext.GetScope(step.ExecutionContext.GetFullyQualifiedContextName()); // Add the composite action environment variables to each step. #if OS_WINDOWS var envContext = new DictionaryContextData(); #else var envContext = new CaseSensitiveDictionaryContextData(); #endif foreach (var pair in envData) { envContext[pair.Key] = new StringContextData(pair.Value ?? string.Empty); } step.ExecutionContext.ExpressionValues["env"] = envContext; return(step); }
public StateMachineRunner(IFiniteStateMachine <TState, TInput, TOutput> stateMachine, IActionRunner <TOutput> actions, ILogger logger) { this.stateMachine = stateMachine; this.actions = actions; this.logger = logger; }
public StateMachineRunner(IFiniteStateMachine <TState, TInput, TOutput> stateMachine, IActionRunner <TOutput> actions) { this.stateMachine = stateMachine; this.actions = actions; }
public WeakSubscription(IActionRunner actionRunner, Action <TMessage> listener, string tag) : base(actionRunner, tag) { _weakReference = new WeakReference(listener); }
private void ExecuteActionWithFilter(string controllerName, string actionName, Dictionary<string, object> parameters, ControllerBase controller, IActionRunner actionRunner) { _pipelineFilter.BeforeAction(controller, controllerName, actionName, parameters); try { actionRunner.Run(controller, parameters); } catch (Exception ex) { _pipelineFilter.ActionError(controller, controllerName, actionName, parameters, ex); throw; } _pipelineFilter.AfterAction(controller, controllerName, actionName, parameters); }
private MessengerSubscriptionToken SubscribeInternal <TMessage>(Action <TMessage> deliveryAction, IActionRunner actionRunner, MessengerReference reference, string tag) where TMessage : MessengerMessage { if (deliveryAction == null) { throw new ArgumentNullException(nameof(deliveryAction)); } BaseSubscription subscription; switch (reference) { case MessengerReference.Strong: subscription = new StrongSubscription <TMessage>(actionRunner, deliveryAction, tag); break; case MessengerReference.Weak: subscription = new WeakSubscription <TMessage>(actionRunner, deliveryAction, tag); break; default: throw new ArgumentOutOfRangeException(nameof(reference), "reference type unexpected " + reference); } lock (this) { Dictionary <Guid, BaseSubscription> messageSubscriptions; if (!_subscriptions.TryGetValue(typeof(TMessage), out messageSubscriptions)) { messageSubscriptions = new Dictionary <Guid, BaseSubscription>(); _subscriptions[typeof(TMessage)] = messageSubscriptions; } //Console.WriteLine("Adding subscription {0} for {1}", subscription.Id, typeof(TMessage).Name); messageSubscriptions[subscription.Id] = subscription; PublishSubscriberChangeMessage <TMessage>(messageSubscriptions); } return(new MessengerSubscriptionToken( subscription.Id, () => InternalUnsubscribe <TMessage>(subscription.Id), deliveryAction)); }
protected BaseSubscription(IActionRunner actionRunner, string tag) { _actionRunner = actionRunner; Id = Guid.NewGuid(); Tag = tag; }
private void ExecuteActionWithFilter(string controllerName, string actionName, Dictionary <string, object> parameters, ControllerBase controller, IActionRunner actionRunner) { _pipelineFilter.BeforeAction(controller, controllerName, actionName, parameters); try { actionRunner.Run(controller, parameters); } catch (Exception ex) { _pipelineFilter.ActionError(controller, controllerName, actionName, parameters, ex); throw; } _pipelineFilter.AfterAction(controller, controllerName, actionName, parameters); }
public StrongSubscription(IActionRunner actionRunner, Action <TMessage> action, string tag) : base(actionRunner, tag) { _action = action; }
protected TypedSubscription(IActionRunner actionRunner, string tag) : base(actionRunner, tag) { }
public ConsolPresenter(IModel model, IView<ConsoleKey> view, IActionRunner actionRunner) { this.model = model; view.OnPressArrow += ViewOnPressArrow; this.actionRunner = actionRunner; }