Пример #1
0
        IInteractionNode FindOrAddNode(DependencyObject uiElement)
        {
            var node = uiElement.GetValue(NodeProperty) as IInteractionNode;

            if (node == null)
            {
                node = new InteractionNode(uiElement, this);
                uiElement.SetValue(NodeProperty, node);
                Log.Info("New interaction node added to hierarchy at {0}.", uiElement);
            }

            return(node);
        }
        private IInteractionNode FindOrAddNode(DependencyObject uiElement)
        {
            var node = uiElement.GetValue(NodeProperty) as IInteractionNode;

            if(node == null)
            {
                node = new InteractionNode(uiElement, this);
                uiElement.SetValue(NodeProperty, node);
                Log.Info("New interaction node added to hierarchy at {0}.", uiElement);
            }

            return node;
        }
Пример #3
0
 /// <summary>
 /// Attaches the trigger and prepares it to send actions.
 /// </summary>
 /// <param name="uiElement">The UI element.</param>
 /// <param name="trigger">The trigger.</param>
 public void AttachTrigger(DependencyObject uiElement, IMessageTrigger trigger)
 {
     if (trigger.Message is IRoutedMessageHandler)
     {
         var node = new InteractionNode(uiElement, this);
         node.RegisterHandler(trigger.Message as IRoutedMessageHandler);
         node.AddTrigger(trigger);
     }
     else
     {
         var node = FindOrAddNode(uiElement);
         node.AddTrigger(trigger);
     }
 }
 /// <summary>
 /// Attaches the trigger and prepares it to send actions.
 /// </summary>
 /// <param name="uiElement">The UI element.</param>
 /// <param name="trigger">The trigger.</param>
 public void AttachTrigger(DependencyObject uiElement, IMessageTrigger trigger)
 {
     if(trigger.Message is IRoutedMessageHandler)
     {
         var node = new InteractionNode(uiElement, this);
         node.RegisterHandler(trigger.Message as IRoutedMessageHandler);
         node.AddTrigger(trigger);
     }
     else
     {
         var node = FindOrAddNode(uiElement);
         node.AddTrigger(trigger);
     }
 }