/// <summary> /// Adds a routed event handler for the given /// RoutedEvent to the store /// </summary> public void AddRoutedEventHandler( RoutedEvent routedEvent, Delegate handler, bool handledEventsToo) { if (routedEvent == null) { throw new ArgumentNullException("routedEvent"); } if (handler == null) { throw new ArgumentNullException("handler"); } // Create a new RoutedEventHandler RoutedEventHandlerInfo routedEventHandlerInfo = new RoutedEventHandlerInfo(handler, handledEventsToo); // Get the entry corresponding to the given RoutedEvent ArrayList handlers = this[routedEvent]; if (handlers == null) { _keys.Add(routedEvent); _values.Add(handlers = new ArrayList()); } // Add the RoutedEventHandlerInfo to the list handlers.Add(routedEventHandlerInfo); }
/// <summary> /// Constructor for <see cref="EventRoute"/> given /// the associated <see cref="RoutedEvent"/> /// </summary> /// <param name="routedEvent"> /// Non-null <see cref="RoutedEvent"/> to be associated with /// this <see cref="EventRoute"/> /// </param> public EventRoute(RoutedEvent routedEvent) { if (routedEvent == null) { throw new ArgumentNullException("routedEvent"); } RoutedEvent = routedEvent; _routeItemList = new ArrayList(); }
// Returns Handlers for the given key internal ArrayList this[RoutedEvent key] { get { //Replace with HashTable int index = _keys.IndexOf(key); if (index >= 0) { return ((ArrayList)_values[index]); } return null; } }
private RawButtonInputReport ExtractRawButtonInputReport(NotifyInputEventArgs e, RoutedEvent Event) { RawButtonInputReport buttonInput = null; InputReportEventArgs input = e.StagingItem.Input as InputReportEventArgs; if (input != null) { if (input.Report is RawButtonInputReport && input.RoutedEvent == Event) { buttonInput = (RawButtonInputReport)input.Report; } } return buttonInput; }
/// <summary> /// Adds a routed event handler for the particular /// <see cref="RoutedEvent"/> /// </summary> /// <remarks> /// The handler added thus is also known as /// an instance handler <para/> /// <para/> /// /// NOTE: It is not an error to add a handler twice /// (handler will simply be called twice) <para/> /// <para/> /// /// Input parameters <see cref="RoutedEvent"/> /// and handler cannot be null <para/> /// handledEventsToo input parameter when false means /// that listener does not care about already handled events. /// Hence the handler will not be invoked on the target if /// the RoutedEvent has already been /// <see cref="RoutedEventArgs.Handled"/> <para/> /// handledEventsToo input parameter when true means /// that the listener wants to hear about all events even if /// they have already been handled. Hence the handler will /// be invoked irrespective of the event being /// <see cref="RoutedEventArgs.Handled"/> /// </remarks> /// <param name="routedEvent"> /// <see cref="RoutedEvent"/> for which the handler /// is attached /// </param> /// <param name="handler"> /// The handler that will be invoked on this object /// when the RoutedEvent is raised /// </param> /// <param name="handledEventsToo"> /// Flag indicating whether or not the listener wants to /// hear about events that have already been handled /// </param> public void AddHandler( RoutedEvent routedEvent, RoutedEventHandler handler, bool handledEventsToo) { if (routedEvent == null || handler == null) throw new ArgumentNullException(); AddRoutedEventHandler(InstanceEventHandlersStore, routedEvent, handler, handledEventsToo); }
private static void AddRoutedEventHandler( Hashtable table, RoutedEvent routedEvent, RoutedEventHandler handler, bool handledEventsToo) { if (routedEvent == null || handler == null) { throw new ArgumentNullException(); } // Create a new RoutedEventHandler RoutedEventHandlerInfo routedEventHandlerInfo = new RoutedEventHandlerInfo(handler, handledEventsToo); // Get the entry corresponding to the given RoutedEvent ArrayList handlers = (ArrayList)table[routedEvent]; if (handlers == null) { table[routedEvent] = (handlers = new ArrayList()); } // Add the RoutedEventHandlerInfo to the list handlers.Add(routedEventHandlerInfo); }
/// <summary> /// Constructor for <see cref="RoutedEventArgs"/> /// </summary> /// <param name="source">The new value that the SourceProperty is being set to </param> /// <param name="routedEvent">The new value that the RoutedEvent Property is being set to </param> public RoutedEventArgs(RoutedEvent routedEvent, object source) { _routedEvent = routedEvent; _source = _originalSource = source; }
/// <summary> /// Constructor for <see cref="RoutedEventArgs"/> /// </summary> /// <param name="routedEvent">The new value that the RoutedEvent Property is being set to </param> public RoutedEventArgs(RoutedEvent routedEvent) : this(routedEvent, null) { }