示例#1
0
        public void SelectItemByID(String Id)
        {
            if (Inputs.All(x => !x.Selectable)) //No Selectable inputs on page
                return;

            var newSelectedInput = Inputs.FirstOrDefault(x => x.ID == Id);
            if (newSelectedInput == null) //No Input with this ID
                return;

            CurrentlySelected = newSelectedInput;

            SetSelected();
        }
示例#2
0
        public void MovetoNextItemUp(int startX, int startY, int searchWidth)
        {
            if (Inputs.All(x => !x.Selectable)) //No Selectable inputs on page
                return;

            if (Inputs.Count(x => x.Selectable) == 1) //Only one selectable input on page, thus no point chnaging it
                return;

            IInput nextItem = null;
            while (nextItem == null && startX > PostionX)
            {
                foreach (var input in Inputs.Where(x => x.Selectable && x != CurrentlySelected))
                {
                    var overlap = DoAreasOverlap(startX - 1, startY, 1, searchWidth, input.Xpostion, input.Ypostion, input.Height, input.Width);
                    if (overlap)
                    {
                        nextItem = input;
                        break; //end foreach
                    }
                }
                startX--;
            }

            if (nextItem == null) //No element found
            {
                MoveToLastItem();
                return;
            }

            CurrentlySelected = nextItem;
            SetSelected();
        }
示例#3
0
        public void SelectFirstItem()
        {
            if (Inputs.All(x => !x.Selectable)) //No Selectable inputs on page
                return;

            CurrentlySelected = Inputs.First(x => x.Selectable);

            SetSelected();
        }
示例#4
0
        public void MoveToNextItem()
        {
            if (Inputs.All(x => !x.Selectable)) //No Selectable inputs on page
                return;

            if (Inputs.Count(x => x.Selectable) == 1) //Only one selectable input on page, thus no point chnaging it
                return;

            var IndexOfCurrent = Inputs.IndexOf(CurrentlySelected);

            while (true)
            {
                IndexOfCurrent = MoveIndexAlongOne(IndexOfCurrent);

                if (Inputs[IndexOfCurrent].Selectable)
                    break;
            }
            CurrentlySelected = Inputs[IndexOfCurrent];

            SetSelected();
        }