public int RegisterElement(EventActionGroup eag) { Console.WriteLine("Registering: " + eag.ID); this.RegisteredElements.Add(eag.ID, eag); this.event_handler.RegisterEvent(eag); return(1); }
public void RegisterEvent(EventActionGroup eag) { var hold = eag.Events.Keys.ToArray(); foreach (string event_name in hold) { eag.Events[event_name] = (event_args) => { if (this.PipelineEvents.TryGetValue(event_name, out var run_event)) { if (event_args.GetType().IsSubclassOf(typeof(EventData))) { run_event(null, event_args, PROPAGATING); } else { run_event(eag.ID, event_args, STARTING); //start of bubble } } var source_args = this.GetEventMoreID(eag.ID, event_args); eag.FiredEvents[event_name]( source_args ); if (eag.Parent != null) { eag.Parent.Events[event_name](source_args); } else { //end of the bubble. if (run_event != null) { run_event(eag.ID, event_args, BUBBLE_ENDING); } } }; } }
public void UnregisterElement(EventActionGroup eag) { Console.WriteLine("Unregistering: " + eag.ID); this.RegisteredElements.Remove(eag.ID); }