Ejemplo n.º 1
0
        static void KeyHandler(RemoteControlKeyEventArgs args)
        {
            if (args.Handled)
            {
                return;
            }

            BindableProperty property = null;

            if (args.KeyName == RemoteControlKeyNames.Up)
            {
                property = UpProperty;
            }
            else if (args.KeyName == RemoteControlKeyNames.Down)
            {
                property = DownProperty;
            }
            else if (args.KeyName == RemoteControlKeyNames.Left)
            {
                property = LeftProperty;
            }
            else if (args.KeyName == RemoteControlKeyNames.Right)
            {
                property = RightProperty;
            }

            if (property != null)
            {
                var next = (args.Sender.GetValue(property) as VisualElement);
                if (next != null && next.Focus())
                {
                    args.Handled = true;
                }
            }
        }
Ejemplo n.º 2
0
 public void SendKeyEvent(RemoteControlKeyEventArgs args)
 {
     if (_acceptedKeyType.HasFlag(args.KeyType))
     {
         ICommand cmd = Command;
         if (cmd != null && cmd.CanExecute(args))
         {
             cmd.Execute(args);
         }
         if (args.KeyType == RemoteControlKeyTypes.KeyDown)
         {
             KeyDown?.Invoke(this, args);
         }
         else
         {
             KeyUp?.Invoke(this, args);
         }
     }
 }
Ejemplo n.º 3
0
        void OnVideoOutputKeyEvent(RemoteControlKeyEventArgs args)
        {
            if (!UsesEmbeddingControls)
            {
                return;
            }

            if (!_controls.Value.IsVisible)
            {
                ShowController();
                return;
            }

            if (args.KeyName == RemoteControlKeyNames.Left)
            {
                if (RewindCommand.CanExecute(null))
                {
                    args.Handled = true;
                    RewindCommand.Execute(null);
                }
            }
            else if (args.KeyName == RemoteControlKeyNames.Right)
            {
                if (FastForwardCommand.CanExecute(null))
                {
                    args.Handled = true;
                    FastForwardCommand.Execute(null);
                }
            }
            else if (args.KeyName == RemoteControlKeyNames.Return)
            {
                if (StartCommand.CanExecute(null))
                {
                    args.Handled = true;
                    StartCommand.Execute(null);
                }
            }
        }