public void AddDetails() { Console.WriteLine("enter event name"); EventName.Add(Console.ReadLine()); Console.WriteLine("enter event type"); EventType.Add(Console.ReadLine()); }
//Creates an EventHandler on runtime and registers that handler to the Event specified public void BindEvent(DependencyObject owner, string eventName) { EventName.Add(eventName); Owner = owner; Event.Add(Owner.GetType().GetEvent(eventName, BindingFlags.Public | BindingFlags.Instance)); if (Event == null) { return; } EventHandler.Add(EventHandlerGenerator.CreateDelegate( Event[Event.Count - 1].EventHandlerType, typeof(CommandBehaviorBinding).GetMethod("Execute", BindingFlags.Public | BindingFlags.Instance), this, eventName)); Event[Event.Count - 1].AddEventHandler(Owner, EventHandler[EventHandler.Count - 1]); }