Catel.MVVM.CommandManager.SubscribeToKeyboardEvents C# (CSharp) Метод

SubscribeToKeyboardEvents() публичный Метод

Subscribes to keyboard events.
public SubscribeToKeyboardEvents ( ) : void
Результат void
        public void SubscribeToKeyboardEvents()
        {
#if NET || SILVERLIGHT
            var application = Application.Current;
            if (application == null)
            {
                Log.Warning("Application.Current is null, cannot subscribe to keyboard events");
                return;
            }
#endif

#if NET
            FrameworkElement mainView = application.MainWindow;
            if (mainView == null)
            {
                if (!_subscribedToApplicationActivedEvent)
                {
                    application.Activated += (sender, e) => SubscribeToKeyboardEvents();
                    _subscribedToApplicationActivedEvent = true;
                    Log.Info("Application.MainWindow is null, cannot subscribe to keyboard events, subscribed to Application.Activated event");
                }

                return;
            }
#elif SILVERLIGHT
            var mainView = application.RootVisual as FrameworkElement;
            if (mainView == null)
            {
                Log.Warning("Application.RootVisual is null, cannot subscribe to keyboard events");
                return;
            }
#elif NETFX_CORE
            // TODO: Grab events
#endif

#if NET || SL5
            SubscribeToKeyboardEvents(mainView);
#endif
        }
#endif

Same methods

CommandManager::SubscribeToKeyboardEvents ( FrameworkElement view ) : void