示例#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);
     }
 }
示例#3
0
        public void SendButtonPress(MenuInputButton btn)
        {
            context.Desktop.ButtonDown(btn);
            context.Desktop.ButtonUp(btn);

            context.WaitForAnimations();
        }
示例#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);
            }
        }
示例#5
0
        protected override void OnButtonDown(MenuInputButton button)
        {
            switch (button)
            {
            case MenuInputButton.Cancel:
                cancelButton = true;
                break;
            }

            base.OnButtonDown(button);
        }
示例#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);
 }
示例#8
0
 void IWidgetEventArgsInitialize.InitializeButtonUp(MenuInputButton button)
 {
     InitializeButtonUp(button);
 }
示例#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));
 }