Example #1
0
        // Token: 0x06000053 RID: 83 RVA: 0x00002FE4 File Offset: 0x000011E4
        private static void OnSourceObjectChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            EventTriggerBase eventTriggerBase = (EventTriggerBase)obj;
            object           @object          = eventTriggerBase.SourceNameResolver.Object;

            if (args.NewValue == null)
            {
                eventTriggerBase.OnSourceChanged(args.OldValue, @object);
                return;
            }
            if (args.OldValue == null && @object != null)
            {
                eventTriggerBase.UnregisterEvent(@object, eventTriggerBase.GetEventName());
            }
            eventTriggerBase.OnSourceChanged(args.OldValue, args.NewValue);
        }
Example #2
0
        // Token: 0x0600005A RID: 90 RVA: 0x00003130 File Offset: 0x00001330
        private void RegisterEvent(object obj, string eventName)
        {
            Type      type   = obj.GetType();
            EventInfo @event = type.GetEvent(eventName);

            if (@event == null)
            {
                if (this.SourceObject != null)
                {
                    throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.EventTriggerCannotFindEventNameExceptionMessage, new object[]
                    {
                        eventName,
                        obj.GetType().Name
                    }));
                }
                return;
            }
            else
            {
                if (EventTriggerBase.IsValidEvent(@event))
                {
                    this.eventHandlerMethodInfo = typeof(EventTriggerBase).GetMethod("OnEventImpl", BindingFlags.Instance | BindingFlags.NonPublic);
                    @event.AddEventHandler(obj, Delegate.CreateDelegate(@event.EventHandlerType, this, this.eventHandlerMethodInfo));
                    return;
                }
                if (this.SourceObject != null)
                {
                    throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.EventTriggerBaseInvalidEventExceptionMessage, new object[]
                    {
                        eventName,
                        obj.GetType().Name
                    }));
                }
                return;
            }
        }
Example #3
0
        // Token: 0x06000054 RID: 84 RVA: 0x0000304C File Offset: 0x0000124C
        private static void OnSourceNameChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            EventTriggerBase eventTriggerBase = (EventTriggerBase)obj;

            eventTriggerBase.SourceNameResolver.Name = (string)args.NewValue;
        }