Exemple #1
0
        public static WidgetEventArgs ButtonUp(MenuInputButton button)
        {
            var result = new WidgetEventArgs();

            result.InitializeButtonUp(button);
            return(result);
        }
 public void WhenIPressAButton(MenuInputButton input, int times)
 {
     for (int i = 0; i < times; i++)
     {
         WhenIPressAButton(input);
     }
 }
Exemple #3
0
        public void SendButtonPress(MenuInputButton btn)
        {
            context.Desktop.ButtonDown(btn);
            context.Desktop.ButtonUp(btn);

            context.WaitForAnimations();
        }
Exemple #4
0
        private void NavigateListLayout(string menuItem, MenuInputButton nextButton, MenuInputButton prevButton)
        {
            var        menu   = context.Desktop.ActiveWorkspace.ActiveWindow as Menu;
            ListLayout layout = menu.Layout as ListLayout;

            var target = layout.Items.SingleOrDefault(w => w.Name.Equals(menuItem, StringComparison.OrdinalIgnoreCase));

            if (target == null)
            {
                throw new InvalidOperationException($"Could not find {menuItem} in {menu.Name}. Active workspace: {context.Desktop.ActiveWorkspace}");
            }

            var targetIndex = layout.IndexOf(target);

            while (targetIndex > layout.FocusIndex)
            {
                Desktop.ClearAnimations();

                instructor.SendButtonPress(nextButton);
            }
            while (targetIndex < layout.FocusIndex)
            {
                instructor.SendButtonPress(prevButton);
            }
        }
Exemple #5
0
        protected override void OnButtonDown(MenuInputButton button)
        {
            switch (button)
            {
            case MenuInputButton.Cancel:
                cancelButton = true;
                break;
            }

            base.OnButtonDown(button);
        }
Exemple #6
0
        protected override void OnButtonUp(MenuInputButton button)
        {
            switch (button)
            {
            case MenuInputButton.Cancel:
                if (cancelButton)
                {
                    cancelEventArgs.Cancel = false;
                    OnCancel(cancelEventArgs);

                    if (!cancelEventArgs.Cancel)
                    {
                        OnExit();
                    }

                    cancelButton = false;
                }

                break;
            }
        }
 public void WhenIPressAButton(MenuInputButton input)
 {
     instructor.SendButtonPress(input);
 }
Exemple #8
0
 void IWidgetEventArgsInitialize.InitializeButtonUp(MenuInputButton button)
 {
     InitializeButtonUp(button);
 }
Exemple #9
0
 private void InitializeButtonUp(MenuInputButton button)
 {
     EventType = WidgetEventType.ButtonUp;
     Button    = button;
     Handled   = false;
 }
 public bool this[MenuInputButton button]
 {
     get => pressedInputButtons.Contains(button);
 protected void Send(MenuInputButton button)
 {
     ListLayout.InputEvent(WidgetEventArgs.ButtonDown(button));
     ListLayout.InputEvent(WidgetEventArgs.ButtonUp(button));
 }