public bool OnActionPerformed <T>(IActionPerformer <T> sender, ActionPerformedEventArgs <T> args) where T : IViewModel, new() { if (this.Behaviors.ContainsKey(args.BehaviorName) == false) { return(false); } var behavior = this.Behaviors[args.BehaviorName] as IBehavior <T>; if (behavior == null) { return(false); } behavior.Execute(args); var viewName = this.Mapping[args.BehaviorName]; var nextView = this.GetNextView(viewName); this.OnBeforeViewSwitch(nextView, behavior); this.SwitchView(sender as ApplicationViewBase, viewName, args); return(true); }
/** * Perform multiple actions when binding to an ActionAcceptor */ public void Bind(IBinder binder) { IActionPerformer performer = binder as IActionPerformer; PerformableActions performable = performer.PerformableActions; AcceptableActions acceptable = binder.BoundAcceptor.AcceptableActions; performable.RefreshEnabledActions(); acceptable.Bind(performer); acceptable.RefreshEnabledActions(); PerformerAction matching = null; foreach (var action in performable.EnabledActions) { AcceptorAction acceptorAction; if (acceptable.EnabledActions.TryGetValue(action.Key, out acceptorAction)) { PerformerAction performerAction = action.Value; performerAction.Bind(acceptorAction.AcceptCondition); matching = performerAction; break; } } StartCoroutine(PerformActions(binder, matching)); }
public void Bind(IActionPerformer boundPerformer) { IInventoryHolder holder = boundPerformer as IInventoryHolder; Inventory boundInventory = holder.Inventory; foreach (var action in Actions) { AcceptorAction acceptorAction = action.Value as AcceptorAction; acceptorAction.Bind(boundInventory); } }
IEnumerator PerformActions(IBinder binder, PerformerAction action) { if (action != null) { yield return(StartCoroutine(Perform(action))); Bind(binder); } else { IActionPerformer performer = binder as IActionPerformer; performer.PerformableActions.RefreshEnabledActions(); binder.OnEndActions(); } }
public PerformableActions(IActionPerformer performer) { this.performer = performer; }
public override void PerformAction(IActionPerformer actionPerformer) => actionPerformer.ActivateImage(this);
public ActionScheduler(IActionPerformer actionPerformer, TActionGenerator actionGenerator, TSchedulerConfiguration settings, IContainer container) : base(actionPerformer, actionGenerator, settings, container) { }
public override void PerformAction(IActionPerformer actionPerformer) => actionPerformer.ActivateHyperlink(this);