Exemple #1
0
        public void Test_AtFirst()
        {
            var input = new CyclicIteratableList <int>(new List <int> {
                1, 2, 3
            });

            Assert.IsTrue(input.AtFirst());
        }
Exemple #2
0
        private void SearchBox_OnOnKeyPressed(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.Up:
            case Key.Left:
                _iteratableList.GoToPrevious();
                var current1 = (CheckBoxWithListDownMenu)_iteratableList.GetCurrent();
                if (current1 == null)
                {
                    return;
                }
                current1.Highlight();
                if (_iteratableList.AtLast())
                {
                    ScrollViewer.ScrollToBottom();
                }
                else if (!current1.IsVisibleToUser(ScrollViewer))
                {
                    ScrollViewer.PageUp();
                }
                break;

            case Key.Down:
            case Key.Right:
                _iteratableList.GoToNext();
                var current = (CheckBoxWithListDownMenu)_iteratableList.GetCurrent();
                if (current == null)
                {
                    return;
                }
                current.Highlight();
                if (_iteratableList.AtFirst())
                {
                    ScrollViewer.ScrollToHome();
                }
                else if (!current.IsVisibleToUser(ScrollViewer))
                {
                    ScrollViewer.PageDown();
                }
                break;

            case Key.Enter:
                var current2 = (CheckBoxWithListDownMenu)_iteratableList.GetCurrent();
                if (current2 == null)
                {
                    return;
                }
                current2.IsChecked = !_iteratableList.GetCurrent().IsChecked;
                break;

            default: break;
            }
        }