public void OnKeyDown(object sender, KeyDownEventArguments args)
 {
     if (Page == null)
     {
         return;
     }
     _pressedKeys[args.Key] = args;
     Page.OnKeyDown(sender, args);
 }
Ejemplo n.º 2
0
        public override void OnKeyDown(object sender, KeyDownEventArguments args)
        {
            switch (args.Key)
            {
            case Key.Esc:
                Task.Run(() => navigation.PushAsync(_menuPage));
                break;
            }

            base.OnKeyDown(sender, args);
        }
Ejemplo n.º 3
0
        public override void OnKeyDown(object sender, KeyDownEventArguments args)
        {
            switch (args.Key)
            {
            case Key.Esc:
            case Key.Backspace:
                Task.Run(() => _navigation.GoBackAsync());
                break;
            }

            base.OnKeyDown(sender, args);
        }
        public void OnKeyDown_APage_EventSentThrough()
        {
            var adapter = new KeyboardAdapter();
            var page    = Substitute.For <IScenePage>();

            adapter.AssignSubscriber(page);
            var args = new KeyDownEventArguments(Key.Up, 0, false, 0, 0);

            adapter.OnKeyDown(null, args);

            page.Received().OnKeyDown(null, args);
        }
        public void OnKeyDown_PageDeactivated_PageDoesntReceiveCall()
        {
            var adapter = new KeyboardAdapter();
            var page1   = Substitute.For <IScenePage>();

            adapter.AssignSubscriber(page1);
            adapter.ReleaseSubscriber(page1);

            var args = new KeyDownEventArguments(Key.Up, 0, false, 0, 0);

            adapter.OnKeyDown(null, args);

            page1.Received(0).OnKeyDown(null, args);
        }
        public void OnKeyDown_PageDeactivated_KeyCancelMessageReceived()
        {
            var adapter = new KeyboardAdapter();
            var page1   = Substitute.For <IScenePage>();

            adapter.AssignSubscriber(page1);
            var args = new KeyDownEventArguments(Key.Up, 0, false, 0, 0);

            adapter.OnKeyDown(null, args);

            adapter.ReleaseSubscriber(page1);

            page1.Received(1).OnKeyCancel(adapter, Arg.Any <KeyCancelEventArguments>());
        }
        public void OnKeyDown_PageChanged_CorrectPageReceivesCall()
        {
            var adapter = new KeyboardAdapter();
            var page1   = Substitute.For <IScenePage>();
            var page2   = Substitute.For <IScenePage>();

            adapter.AssignSubscriber(page1);
            adapter.ReleaseSubscriber(page1);

            adapter.AssignSubscriber(page2);
            var args = new KeyDownEventArguments(Key.Up, 0, false, 0, 0);

            adapter.OnKeyDown(null, args);

            page1.Received(0).OnKeyDown(null, args);
            page2.Received(1).OnKeyDown(null, args);
        }
 public virtual void OnKeyDown(object sender, KeyDownEventArguments args)
 {
 }
Ejemplo n.º 9
0
 private void OnKeyDown(object sender, KeyDownEventArguments args)
 {
     _subscriber.OnKeyDown(sender, args);
 }