コード例 #1
0
        /// <summary>
        ///   Starts monitoring an object for its <see cref="INotifyPropertyChanged.PropertyChanged"/> events.
        /// </summary>
        /// <exception cref = "ArgumentNullException">Thrown if eventSource is Null.</exception>
        public static IEventMonitor MonitorEvents(this INotifyPropertyChanged eventSource)
        {
            if (eventSource == null)
            {
                throw new NullReferenceException("Cannot monitor the events of a <null> object.");
            }

            return(EventMonitor.Attach(eventSource, typeof(INotifyPropertyChanged)));
        }
コード例 #2
0
        /// <summary>
        ///   Starts monitoring <paramref name="eventSource"/> for events defined in the type parameter <typeparamref name="T"/>.
        /// </summary>
        /// <param name="eventSource">The object for which to monitor the events.</param>
        /// <typeparam name="T">The type defining the events it should monitor.</typeparam>
        /// <exception cref = "ArgumentNullException">Thrown if <paramref name="eventSource"/> is Null.</exception>
        public static IEventMonitor MonitorEvents <T>(this object eventSource)
        {
            if (eventSource == null)
            {
                throw new NullReferenceException("Cannot monitor the events of a <null> object.");
            }

            return(EventMonitor.Attach(eventSource, typeof(T)));
        }