public void OnEventDispatch(Event @event)
        {
            // Only support events dispatched from the dispatcher thread.
            if (!DispatcherHelpers.IsOnDispatcher())
            {
                return;
            }

            if (_eventDrivers.Count > 0)
            {
                var eventName       = @event.EventName;
                var customEventName = default(string);
                if (TryGetRegistrationName(eventName, out customEventName))
                {
                    eventName = customEventName;
                }

                var driversForKey = default(IList <EventAnimationDriver>);
                if (_eventDrivers.TryGetValue(Tuple.Create(@event.ViewTag, eventName), out driversForKey))
                {
                    foreach (var driver in driversForKey)
                    {
                        @event.Dispatch(driver);
                        _runUpdateNodeList.Add(driver.ValueNode);
                    }

                    UpdateNodes(_runUpdateNodeList);
                    _runUpdateNodeList.Clear();
                }
            }
        }
예제 #2
0
        public bool OnEventDispatch(Event @event)
        {
            // Only support events dispatched from the dispatcher thread.
            if (!DispatcherHelpers.IsOnDispatcher())
            {
                return(false);
            }

            if (_eventDrivers.Count > 0)
            {
                var eventName       = @event.EventName;
                var customEventName = default(string);
                if (TryGetRegistrationName(eventName, out customEventName))
                {
                    eventName = customEventName;
                }

                var eventDriver = default(EventAnimationDriver);
                if (_eventDrivers.TryGetValue(Tuple.Create(@event.ViewTag, eventName), out eventDriver))
                {
                    @event.Dispatch(eventDriver);
                    _updatedNodes.Add(eventDriver.ValueNode);
                    return(true);
                }
            }

            return(false);
        }
 public static void OnCreate(this ReactRootView rootView, ReactNativeHost host)
 {
     rootView.Background = (Brush)Application.Current.Resources["ApplicationPageBackgroundThemeBrush"];
     if (DispatcherHelpers.IsOnDispatcher())
     {
         SystemNavigationManager.GetForCurrentView().BackRequested += (sender, e) => OnBackRequested(host, sender, e);
         Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated += (sender, e) => OnAcceleratorKeyActivated(host, sender, e);
     }
 }
예제 #4
0
 public void OnEventDispatch(Event @event)
 {
     if (DispatcherHelpers.IsOnDispatcher())
     {
         HandleEvent(@event);
     }
     else
     {
         DispatcherHelpers.RunOnDispatcher(() =>
         {
             HandleEvent(@event);
         });
     }
 }
예제 #5
0
        private void AssertOnCorrectDispatcher()
        {
#if WINDOWS_UWP
#if DEBUG
            if (!DispatcherHelpers.IsOnDispatcher(Dispatcher))
            {
                // Each NativeViewHierarxhyManager object has a dedicated Dispatcher thread affinity.
                // Accessing from a wrong thread is fatal.
                throw new InvalidOperationException("Thread does not have correct dispatcher access.");
            }
#endif
#else
            DispatcherHelpers.AssertOnDispatcher();
#endif
        }