Example #1
0
        private Widget FindFocusableWidgetAbove(Widget from)
        {
            var ImmediateAbove = ActivableChildren.Where(c => c.Left == from.Left && c.Top < from.Top).OrderByDescending(c => c.Top).FirstOrDefault();

            if (ImmediateAbove == null)
            {
                return(ActivableChildren.Where(c => c.Top < from.Top).OrderByDescending(c => c.Top).OrderBy(c => c.Left).FirstOrDefault());
            }

            return(ImmediateAbove);
        }
Example #2
0
        private Widget FindFocusableWidgetBelow(Widget from)
        {
            var ImmediateBelow = ActivableChildren.Where(c => c.Left == from.Left && c.Top > from.Top).OrderBy(c => c.Top).FirstOrDefault();

            if (ImmediateBelow == null)
            {
                return(ActivableChildren.Where(c => c.Top > from.Top).OrderBy(c => c.Left).OrderBy(c => c.Top).FirstOrDefault());
            }

            return(ImmediateBelow);
        }
Example #3
0
        private Widget FindFocusableWidgetToLeftOf(Widget from)
        {
            var ImmediateLeft = ActivableChildren.Where(c => c.Top == from.Top && c.Left < from.Left).OrderByDescending(c => c.Left).FirstOrDefault();

            if (ImmediateLeft == null)
            {
                var RoughLeft = ActivableChildren.Where(c => c.Left < from.Left && Math.Abs(c.Top - from.Top) < 2).OrderByDescending(c => c.Left).OrderBy(c => Math.Abs(c.Top - from.Top)).FirstOrDefault();

                if (RoughLeft == null)
                {
                    return(ActivableChildren.Where(c => c.Top == from.Top).OrderByDescending(c => c.Left).FirstOrDefault());
                }

                return(RoughLeft);
            }

            return(ImmediateLeft);
        }