Пример #1
0
            // Token: 0x06007E36 RID: 32310 RVA: 0x00235440 File Offset: 0x00233640
            internal void Handler(object sender, RoutedEventArgs e)
            {
                TriggerActionCollection actions = this._owningTrigger.Actions;

                for (int i = 0; i < actions.Count; i++)
                {
                    actions[i].Invoke(this._owningTriggerHost);
                }
            }
Пример #2
0
            internal void Handler(object sender, RoutedEventArgs e)
            {
                // Invoke all actions of the associated EventTrigger object.
                TriggerActionCollection actions = _owningTrigger.Actions;

                for (int j = 0; j < actions.Count; j++)
                {
                    actions[j].Invoke(_owningTriggerHost);
                }
            }
Пример #3
0
    protected virtual void AddChild(object child)
    {
      if (child == null)
      {
        throw new ArgumentNullException("child");
      }

      if (child is TriggerAction == false)
      {
        throw new Exception(string.Format("Cannot convert '{0}' to type '{1}'", child.GetType(), typeof (TriggerAction)));
      }

      if (_actions == null)
      {
        _actions = new TriggerActionCollection();
      }

      _actions.Add((TriggerAction)child);
    }
Пример #4
0
        protected virtual void AddChild(object child)
        {
            if (child == null)
            {
                throw new ArgumentNullException("child");
            }

            if (child is TriggerAction == false)
            {
                throw new Exception(string.Format("Cannot convert '{0}' to type '{1}'", child.GetType(), typeof(TriggerAction)));
            }

            if (_actions == null)
            {
                _actions = new TriggerActionCollection();
            }

            _actions.Add((TriggerAction)child);
        }
Пример #5
0
 internal Trigger()
 {
     _actions = new TriggerActionCollection();
 }
Пример #6
0
        // Given a list of action collection, invoke all individual TriggerAction
        //  in that collection using the rest of the information given.
        internal static void InvokeActions( TriggerBase triggerBase,
            DependencyObject triggerContainer, TriggerActionCollection actions,
            Style style, FrameworkTemplate frameworkTemplate)
        {
            for (int i = 0; i < actions.Count; i++)
            {
                TriggerAction action = actions[i];

                Debug.Assert(!(action.ContainingTrigger is EventTrigger),
                    "This trigger actions list used by this method are expected to contain only those actions under non-event triggers.");

                action.Invoke(triggerContainer as FrameworkElement, triggerContainer as FrameworkContentElement,
                    style, frameworkTemplate, triggerBase.Layer);
            }
        }
Пример #7
0
        // In the event that we can't do an immediate invoke of the collection
        //  of actions, add this to the list of deferred actions that is stored
        //  on the template object.  Because each template can be applicable to
        //  multiple objects, the storage of deferred actions is keyed by the
        //  triggerContainer instance.
        private static void DeferActions( TriggerBase triggerBase,
            DependencyObject triggerContainer, TriggerActionCollection actions,
            Style style, FrameworkTemplate frameworkTemplate)

        {
            ConditionalWeakTable<DependencyObject, List<DeferredAction>> deferredActions;
            DeferredAction deferredAction; // struct
            deferredAction.TriggerBase = triggerBase;
            deferredAction.TriggerActionCollection = actions;

            if( frameworkTemplate != null )
            {
                deferredActions = frameworkTemplate.DeferredActions;

                if( deferredActions == null )
                {
                    deferredActions = new ConditionalWeakTable<DependencyObject, List<DeferredAction>>();
                    frameworkTemplate.DeferredActions = deferredActions;
                }
            }
            else
            {
                // Nothing - deferring actions only happen for FrameworkTemplate
                //  scenarios, so deferred actions is empty.
                deferredActions = null;
            }

            if( deferredActions != null )
            {
                List<DeferredAction> actionList;

                if( !deferredActions.TryGetValue(triggerContainer, out actionList) )
                {
                    actionList = new List<DeferredAction>();
                    deferredActions.Add(/* key */triggerContainer,/* value */actionList);
                }

                actionList.Add(deferredAction);
            }
        }
Пример #8
0
 // Called from InvokeEnterOrExitActions in response to a changed event, or
 //  from ExecuteOnApplyEnterExitActionsLoop when Style/Template is initially
 //  applied.
 // At this point we've decided that the given set of trigger action collections
 //  should be run now.  This method checks to see if that's actually possible
 //  and either invokes immediately or saves enough information to invoke later.
 private static void InvokeActions( TriggerActionCollection actions,
     TriggerBase triggerBase, DependencyObject triggerContainer,
     Style style, FrameworkTemplate frameworkTemplate )
 {
     if( actions != null )
     {
         // See CanInvokeActionsNow for all the (known) reasons why we might not be able to
         //  invoke immediately.
         if( CanInvokeActionsNow( triggerContainer, frameworkTemplate ) )
         {
             InvokeActions( triggerBase, triggerContainer, actions,
                 style, frameworkTemplate );
         }
         else
         {
             DeferActions( triggerBase, triggerContainer, actions,
                 style, frameworkTemplate );
         }
     }
 }