private bool SearchForMatchingSubjectAndDisplayThem(string searchedText) { bool somethingFound = false; var found = new List <ICheckBoxWithListDownMenu>(); foreach (UIElement child in CheckerBoxStackPanel.Children) { if (child is ICheckBoxWithListDownMenu) { var target = child as ICheckBoxWithListDownMenu; string comparedString = target.SubjectName.ToLower() + target.SubjectCode.ToLower(); if (comparedString.Contains(searchedText)) { somethingFound = true; child.Visibility = Visible; found.Add(target); (child as ICheckBoxWithListDownMenu).HighlightText = searchedText; } else { child.Visibility = Collapsed; } } } _iteratableList = new CyclicIteratableList <ICheckBoxWithListDownMenu>(found); _iteratableList.GetCurrent()?.Highlight(); return(somethingFound); }
public void Test_InputHasNoElements_ReferenceTypes() { var input = new CyclicIteratableList <object>(new List <object>() { }); Assert.IsTrue(input.GetCurrent() == null); }
public void Test_InputHasNoElements_NumericTypes() { var input = new CyclicIteratableList <int>(new List <int>() { }); Assert.IsTrue(input.GetCurrent() == 0); }
public void Test_GetCurrent() { var input = new CyclicIteratableList <int>(new List <int> { 1, 2, 3 }); Assert.IsTrue(input.GetCurrent() == 1); }
public void Test_AtFirst() { var input = new CyclicIteratableList <int>(new List <int> { 1, 2, 3 }); Assert.IsTrue(input.AtFirst()); }
public void Test_Counts() { var input = new CyclicIteratableList <int>(new List <int> { 1, 2, 3 }); Assert.IsTrue(input.Counts == 3); }
public FocusNavigator(List <IFocusable> focusables) { _iteratableList = new CyclicIteratableList <IFocusable>(focusables); foreach (var f in focusables) { f.SetSupervisor(this); } }
public void Test_AtLast() { var input = new CyclicIteratableList <int>(new List <int> { 1, 2, 3 }); input.GoToPrevious(); Assert.IsTrue(input.AtLast()); }
public void Test_Index() { var input = new CyclicIteratableList <int>(new List <int> { 1, 2, 3 }); Assert.IsTrue(input.MaxIndex() == 2); Assert.IsTrue(input.CurrentIndex() == 0); }
public void Test_GoToPrevious() { var input = new CyclicIteratableList <int>(new List <int>() { 1, 2, 3 }); input.GoToPrevious(); Assert.IsTrue(input.GetCurrent() == 3); input.GoToPrevious(); Assert.IsTrue(input.GetCurrent() == 2); input.GoToPrevious(); Assert.IsTrue(input.GetCurrent() == 1); }
public void SetDataContext(List <SubjectModel> dataContext) { var subjectModels = dataContext; _nameAndCodeOfAllSubjects = new List <string>(); foreach (var subject in subjectModels) { _nameAndCodeOfAllSubjects.Add(subject.Name); _nameAndCodeOfAllSubjects.Add(subject.Code); var box = new CheckBoxWithListDownMenu(); box.SetDataContext(subject); CheckerBoxStackPanel.Children.Add(box); box.Checked += Box_CheckChanged; box.ListViewCheckBox_Checked += Box_ListViewCheckBox_Checked; } _anyCheckBoxs = new List <ICheckBoxWithListDownMenu>(CheckerBoxStackPanel.Children.OfType <ICheckBoxWithListDownMenu>()); _iteratableList = new CyclicIteratableList <ICheckBoxWithListDownMenu>(_anyCheckBoxs); }