private void ExecuteBehaviourOperation(Type pageBehaviour, BehaviourActions behaviourAction, Action defaultBehaviourOperation) { if (this.overridenBehavioursActions.ContainsKey(pageBehaviour.GetType()) && this.overridenBehavioursActions[pageBehaviour.GetType()].ContainsKey(behaviourAction)) { this.overridenBehavioursActions[pageBehaviour.GetType()][behaviourAction].Invoke(); } else { defaultBehaviourOperation.Invoke(); } }
public void ConfugureCustomBehaviour <ТBehavior>(BehaviourActions behaviourAction, Action action) where ТBehavior : IBehaviour { if (!this.overridenBehavioursActions.ContainsKey(typeof(ТBehavior))) { this.overridenBehavioursActions.Add(typeof(ТBehavior), new Dictionary <BehaviourActions, Action>()); } if (!this.overridenBehavioursActions[typeof(ТBehavior)].ContainsKey(behaviourAction)) { this.overridenBehavioursActions[typeof(ТBehavior)].Add(behaviourAction, action); } else { this.overridenBehavioursActions[typeof(ТBehavior)][behaviourAction] = action; } }