Пример #1
0
        public void RemoveWorks()
        {
            var arr = new[] { "a", "b", "c", "d", "c" };
            var wc  = new WeakCollection <string>(arr);

            Assert.True(wc.Remove("c"));
            Assert.True(wc.OrderBy(x => x).SequenceEqual(new[] { "a", "b", "c", "d" }));
            Assert.True(wc.Remove("c"));
            Assert.True(wc.OrderBy(x => x).SequenceEqual(new[] { "a", "b", "d" }));
            Assert.False(wc.Remove("c"));
            Assert.True(wc.OrderBy(x => x).SequenceEqual(new[] { "a", "b", "d" }));
        }
Пример #2
0
 internal static IEnumerable <UIElement> GetSortedNavigableControls()
 {
     if (IsCommandNavigationOrderDirty)
     {
         var list = NavigableControls.OrderBy(GetCommandNavigationOrder).ToList();
         NavigableControls.Clear();
         foreach (var uiElement in list)
         {
             NavigableControls.Add(uiElement);
         }
         IsCommandNavigationOrderDirty = false;
     }
     return(NavigableControls);
 }