public void Filter_is_respected_by_instantiation()
        {
            var source = new[] { 1, 2, 3, 4 };
            var subject = new ObservableCollectionView<int>(source, x => x % 2 == 0);

            subject.AssertAreEqual(new[] { 2, 4 });
        }
Example #2
0
        public void Filter_is_respected_by_instantiation()
        {
            var source  = new[] { 1, 2, 3, 4 };
            var subject = new ObservableCollectionView <int>(source, x => x % 2 == 0);

            subject.AssertAreEqual(new[] { 2, 4 });
        }
Example #3
0
        public void New_collection_gets_populated_from_source()
        {
            var source  = new[] { 1, 2, 3 };
            var subject = new ObservableCollectionView <int>(source);

            subject.AssertAreEqual(source);
        }
Example #4
0
        public Escalation_Thread_Agents()
        {
            this.InitializeComponent();
            StartDatePicker.Date = DateTime.Today.AddDays(-7);
            EndDatePicker.Date   = DateTime.Today;
            EscalationThreadList = new ObservableCollectionView <Models.EscalationThread>();
            EscalationThread EscalationThread = new EscalationThread();

            EscalationThread.ThreadTitle      = "[C++][UWP] MJPEG MediaPlayer support";
            EscalationThread.ThreadLink       = new Uri("https://social.msdn.microsoft.com/Forums/windowsapps/en-US/bec39605-b09d-4c3b-80a1-f40a8aaa203b/cuwp-mjpeg-mediaplayer-support?forum=wpdevelop");
            EscalationThread.EscalationReason = "I am not good at it";
            EscalationThread.FTEOnwer         = "Fang Peng";
            EscalationThread.ThreadOwner      = "Barry Wang";
            EscalationThread.ThreadCreateDate = DateTime.Parse("Tuesday, September 05, 2017 4:23 PM");
            EscalationThread.EscalationDate   = DateTime.Parse("Wednesday, September 06, 2017 5:23 PM");
            EscalationThread.EscalationStatus = "Closed:Replied";
            EscalationThreadList.Items.Add(EscalationThread);
            EscalationThread EscalationThread1 = new EscalationThread();

            EscalationThread1.ThreadTitle      = "[C++][UWP] MJPEG MediaPlayer support";
            EscalationThread1.ThreadLink       = new Uri("https://social.msdn.microsoft.com/Forums/windowsapps/en-US/bec39605-b09d-4c3b-80a1-f40a8aaa203b/cuwp-mjpeg-mediaplayer-support?forum=wpdevelop");
            EscalationThread1.EscalationReason = "I am not good at it";
            EscalationThread1.FTEOnwer         = "Fang Peng";
            EscalationThread1.ThreadOwner      = "Barry Wang";
            EscalationThread1.ThreadCreateDate = DateTime.Parse("Tuesday, September 05, 2017 4:23 PM");
            EscalationThread1.EscalationDate   = DateTime.Parse("Wednesday, September 06, 2017 5:23 PM");
            EscalationThread1.EscalationStatus = "Closed:Replied";
            EscalationThreadList.Items.Add(EscalationThread1);
            MyDataGrid.ItemsSource = EscalationThreadList;
            this.DataContext       = this;
        }
        public void When_adding_an_element_then_filter_should_work()
        {
            //// Arrange
            var source = new ObservableCollection <SampleClass>
            {
                new SampleClass {
                    First = "a", Last = "b"
                },
                new SampleClass {
                    First = "a", Last = "b"
                },
                new SampleClass {
                    First = "b", Last = "c"
                },
                new SampleClass {
                    First = "b", Last = "c"
                },
            };

            //// Act
            var view = new ObservableCollectionView <SampleClass>(source);

            view.Filter = c => c.First == "a";

            source.Add(new SampleClass {
                First = "a"
            });

            //// Assert
            Assert.AreEqual(3, view.Count);
        }
        public void When_changing_element_then_view_should_update()
        {
            //// Arrange
            var source = new ObservableCollection <SampleClass>
            {
                new SampleClass {
                    First = "a", Last = "b"
                },
                new SampleClass {
                    First = "a", Last = "b"
                },
                new SampleClass {
                    First = "b", Last = "c"
                },
                new SampleClass {
                    First = "b", Last = "c"
                },
            };

            //// Act
            var view = new ObservableCollectionView <SampleClass>(source);

            view.TrackItemChanges = true;
            view.Filter           = c => c.First == "a";

            var item = source.First();

            item.First = "b";

            //// Assert
            Assert.AreEqual(1, view.Count);
        }
        public void When_filtering_collection_then_count_should_be_correct()
        {
            //// Arrange
            var source = new ObservableCollection <SampleClass>
            {
                new SampleClass {
                    First = "a", Last = "b"
                },
                new SampleClass {
                    First = "a", Last = "b"
                },
                new SampleClass {
                    First = "b", Last = "c"
                },
                new SampleClass {
                    First = "b", Last = "c"
                },
            };

            //// Act
            var view = new ObservableCollectionView <SampleClass>(source);

            Assert.AreEqual(4, view.Count);
            view.Filter = c => c.First == "a";

            //// Assert
            Assert.AreEqual(2, view.Count);
        }
Example #8
0
        public async Task <ObservableCollectionView <EscalationAndStatusThread> > QueryAllEscalationAndStatusThread(ProductWithSelectedItem AllMyPlatform, EscalationStatusWithSelectedItem EscalatonStatusList, string startDatestring, string endDatestring)
        {
            ObservableCollectionView <EscalationAndStatusThread> EscalationThreadList = new ObservableCollectionView <EscalationAndStatusThread>();
            HttpClient HttpClient = new HttpClient();
            Product    MyProduct  = new Product();

            MyProduct = AllMyPlatform.SelectedItem;
            string           plaform            = MyProduct.Platform;
            EscalationStatus MyEscalationStatus = new EscalationStatus();

            MyEscalationStatus = EscalatonStatusList.SelectedItem;
            string status = MyEscalationStatus.Status;
            var    HttpResponseMessage = await HttpClient.GetAsync(new Uri(string.Format("http://escalationmanagerwebapi.azurewebsites.net/api/ethreads?etime1={0}&etime2={1}&alias={2}&platform={3}&forum={4}&status={5}", startDatestring, endDatestring, "fapeng", plaform, "", status)));

            ObservableCollection <EscalationThread> AllMyEscalationThread = new ObservableCollection <EscalationThread>();

            if (HttpResponseMessage.StatusCode == HttpStatusCode.Ok)
            {
                EscalationThreadList.Items.Clear();
                var result = await HttpResponseMessage.Content.ReadAsStringAsync();

                AllMyEscalationThread = JsonConvert.DeserializeObject <ObservableCollection <EscalationThread> >(result);
                foreach (var escalationthread in AllMyEscalationThread)
                {
                    EscalationAndStatusThread EscalationAndStatusThread = new EscalationAndStatusThread();
                    EscalationAndStatusThread.EscalationThread     = escalationthread;
                    EscalationAndStatusThread.EscalationStatusList = EscalatonStatusList.MyEscalationStatusList;
                    EscalationThreadList.Items.Add(EscalationAndStatusThread);
                }
                Task <bool> tk = LogSearchCaseStatesExist(AllMyEscalationThread);
                bool        a  = await tk;
            }
            return(EscalationThreadList);
        }
Example #9
0
 public ContactDto()
 {
     Messages = new ObservableCollectionView <MessageDto>()
     {
         Order = p => p.DispatchedAt
     };
 }
Example #10
0
        public async Task <ObservableCollectionView <Report> > QueryAllEscalationReport(ProductWithSelectedItem AllMyPlatform, string startDatestring, string endDatestring)
        {
            ObservableCollectionView <Report> ReportList = new ObservableCollectionView <Report>();
            HttpClient HttpClient = new HttpClient();
            Product    MyProduct  = new Product();

            MyProduct = AllMyPlatform.SelectedItem;
            string plaform             = MyProduct.Platform;
            var    HttpResponseMessage = await HttpClient.GetAsync(new Uri(string.Format("http://escalationmanagerwebapi.azurewebsites.net/api/reports?Alias={0}&Platform={1}&Forum={2}&ETime1={3}&ETime2={4}&VFlag={5}", "All", plaform, "", startDatestring, endDatestring, false)));

            ObservableCollection <Report> AllMyReport = new ObservableCollection <Report>();

            if (HttpResponseMessage.StatusCode == HttpStatusCode.Ok)
            {
                ReportList.Items.Clear();
                var result = await HttpResponseMessage.Content.ReadAsStringAsync();

                AllMyReport = JsonConvert.DeserializeObject <ObservableCollection <Report> >(result);
                foreach (var report in AllMyReport)
                {
                    ReportList.Items.Add(report);
                }
            }

            return(ReportList);
        }
        public void New_collection_gets_populated_from_source()
        {
            var source = new[] { 1, 2, 3 };
            var subject = new ObservableCollectionView<int>(source);

            subject.AssertAreEqual(source);
        }
        public void Collection_accepts_new_items_from_source()
        {
            var source = new ObservableCollection<int> { 1, 2, 3, 4 };
            var subject = new ObservableCollectionView<int>(source);
            source.Add(5);

            Assert.Equal(5, subject.Last());
        }
 public AddressBookWindow(MessageService messageService)
 {
     MessageService = messageService;
     SearchResults  = new ObservableCollectionView <Contact>(MessageService.Contacts);
     InitializeComponent();
     DataContext = this;
     StatusBlock = new StatusBlock(StatusBar);
     StatusBlock.Alert("Search and select contacts from the list");
 }
        public void New_items_notifications_respect_filter()
        {
            var source = new ObservableCollection<int>();
            var subject = new ObservableCollectionView<int>(source, x => x % 2 == 0);
            source.Add(5);
            source.Add(6);

            Assert.Equal(6, subject.Single());
        }
Example #15
0
        public void New_items_notifications_respect_filter()
        {
            var source  = new ObservableCollection <int>();
            var subject = new ObservableCollectionView <int>(source, x => x % 2 == 0);

            source.Add(5);
            source.Add(6);

            Assert.Equal(6, subject.Single());
        }
Example #16
0
 public MainWindow()
 {
     Contacts = new ObservableCollectionView <ContactDto>()
     {
         Order     = c => c.LastMessage?.DispatchedAt,
         Ascending = false
     };
     Initialized += MainWindowLoaded;
     InitializeComponent();
 }
        private void FakeBooking()
        {
            _bookingList = new ObservableCollection <BILET>();
            db           = new DatabasePZEntities();
            foreach (var bilet in db.BILET.Include("ULGA").Include("GODZINY"))
            {
                _bookingList.Add(bilet);
            }

            _filteredBookingList = new ObservableCollectionView <BILET>(_bookingList);
        }
Example #18
0
        public void Collection_accepts_new_items_from_source()
        {
            var source = new ObservableCollection <int> {
                1, 2, 3, 4
            };
            var subject = new ObservableCollectionView <int>(source);

            source.Add(5);

            Assert.Equal(5, subject.Last());
        }
Example #19
0
        public PainViewModel()
        {
            AllElements = new MtObservableCollection<Pain>();
            LoadList();
            FilteredElements = new ObservableCollectionView<Pain>(AllElements);

            #region Commands

            DeletePainCommand = new AsyncRelayCommand<Pain>(DeletePain, pain => pain != null);

            #endregion
        }
Example #20
0
        public void Sort_items_upon_instantiation()
        {
            var source = new ObservableCollection <int> {
                8, 3, 1, 5, 0, 4, 3
            };
            var subject = new ObservableCollectionView <int>(
                source,
                null,
                Comparer <int> .Default);

            subject.AssertAreEqual(new[] { 0, 1, 3, 3, 4, 5, 8 });
        }
        public void Collection_propagates_new_items_notifications()
        {
            var source = new ObservableCollection<int>();
            var subject = new ObservableCollectionView<int>(source);
            var notifications = new List<NotifyCollectionChangedEventArgs>();
            subject.ObserveCollectionChanged().Subscribe(notifications.Add);

            source.Add(5);

            var notification = notifications.Single();
            Assert.Equal(NotifyCollectionChangedAction.Add, notification.Action);
            Assert.Equal(5, notification.NewItems.Cast<int>().Single());
        }
Example #22
0
        /// <summary>Initializes a new instance of the <see cref="MainWindowModel"/> class. </summary>
        public MainWindowModel()
        {
#if DEBUG
            RootDirectory = @"C:\Data";
#endif

            IgnoreExceptions = true;

            Logs         = new ObservableCollection <string>();
            AllProjects  = new MtObservableCollection <VsProject>();
            AllSolutions = new MtObservableCollection <VsSolution>();

            UsedNuGetPackages     = new MtObservableCollection <NuGetPackageReference>();
            UsedNuGetPackageNames = new MtObservableCollection <NuGetPackageVersionGroup>();
            UsedProjectReferences = new MtObservableCollection <VsProjectReference>();

            FilteredProjects    = new ObservableCollectionView <VsProject>(AllProjects);
            LoadProjectsCommand = new AsyncRelayCommand(LoadProjectsAsync);

            FilteredProjects.CollectionChanged += (sender, args) =>
            {
                if (SelectedProject == null || !FilteredProjects.Contains(SelectedProject))
                {
                    SelectedProject = FilteredProjects.FirstOrDefault();
                }
            };

            ShowPreviousProjectCommand      = new RelayCommand(ShowPreviousProject, () => _previouslySelectedProjects.Count > 0);
            OpenNuGetWebsiteCommand         = new RelayCommand <NuGetPackageReference>(OpenNuGetWebsite);
            CopyNuGetIdCommand              = new RelayCommand <NuGetPackageReference>(CopyNuGetId);
            OpenProjectDirectoryCommand     = new RelayCommand <VsObject>(OpenProjectDirectory);
            EditProjectCommand              = new RelayCommand <VsObject>(EditProject);
            CopyProjectDirectoryPathCommand = new RelayCommand <VsProject>(CopyProjectDirectoryPath);
            ShowProjectDetailsCommand       = new RelayCommand <VsProject>(ShowProjectDetails);
            StartProjectPowershellCommand   = new RelayCommand <VsProject>(StartProjectPowershell);
            TryOpenSolutionCommand          = new RelayCommand <VsSolution>(TryOpenSolution);

            CopyNameCommand     = new RelayCommand <object>(CopyName);
            SelectObjectCommand = new RelayCommand <object>(SelectObject);
            SetProjectReferenceFilterCommand = new AsyncRelayCommand <VsObject>(SetProjectReferenceFilterAsync);
            SetSolutionFilterCommand         = new RelayCommand <VsSolution>(SetSolutionFilter);
            SetNuGetPackageNameFilterCommand = new RelayCommand <NuGetPackageReference>(SetNuGetPackageNameFilter);
            SetNuGetPackageFilterCommand     = new RelayCommand <NuGetPackageReference>(SetNuGetPackageFilter);
            SetNuGetPackageIdFilterCommand   = new RelayCommand <NuGetPackageReference>(SetNuGetPackageIdFilter);

            ClearFilterCommand = new RelayCommand(ClearFilter);

            Filter = new ProjectFilter(FilteredProjects);
        }
Example #23
0
        public void Collection_propagates_new_items_notifications()
        {
            var source        = new ObservableCollection <int>();
            var subject       = new ObservableCollectionView <int>(source);
            var notifications = new List <NotifyCollectionChangedEventArgs>();

            subject.ObserveCollectionChanged().Subscribe(notifications.Add);

            source.Add(5);

            var notification = notifications.Single();

            Assert.Equal(NotifyCollectionChangedAction.Add, notification.Action);
            Assert.Equal(5, notification.NewItems.Cast <int>().Single());
        }
        public void New_items_preserve_sort_order()
        {
            var source = new ObservableCollection<int> { 1, 5, 0 };
            var subject = new ObservableCollectionView<int>(
                source,
                null,
                Comparer<int>.Default);

            source.Add(-2);
            source.Add(3);
            source.Add(3);
            source.Add(10);

            subject.AssertAreEqual(new[] { -2, 0, 1, 3, 3, 5, 10 });
        }
Example #25
0
        private async void QueryButton_Click(object sender, RoutedEventArgs e)
        {
            MyProgressRing.IsActive = true;
            DataGrid.ItemsSource    = null;
            DateTime startDate       = DateTime.Parse(StartDatePicker.Date.ToString());
            string   startDatestring = startDate.ToString("MM-dd-yyyy");
            DateTime endDate         = DateTime.Parse(EndDatePicker.Date.ToString());
            string   endDatestring   = endDate.ToString("MM-dd-yyyy");

            AllMyReport = await FTEEscalationReportViewModel.QueryAllEscalationReport(AllMyPlatform, startDatestring, endDatestring);

            DataGrid.ItemsSource = AllMyReport;
            await Task.Delay(new TimeSpan(3));

            MyProgressRing.IsActive = false;
        }
Example #26
0
        public FTE_All_EscalationThread()
        {
            this.InitializeComponent();
            this.EndDatePicker.Date = DateTime.Today;
            int date = DateTime.Today.Day;
            this.StartDatePicker.Date = DateTime.Today.AddDays(-(date-1));
            this.SizeChanged += FTE_All_EscalationThread_SizeChanged;
            EscalatonStatusList = new EscalationStatusWithSelectedItem();
            AllMyPlatform = new ProductWithSelectedItem();
            EscalationThreadList = new ObservableCollectionView<EscalationAndStatusThread>();
            EscalationThreadListPage = new ObservableCollectionView<EscalationAndStatusThread>();
            FTEEscalationThreadViewModel = new FTEEscalationThreadViewModel();
            EscalationThread = new EscalationThread();
            this.Loaded += FTE_All_EscalationThread_Loaded;
            this.DataContext = FTEEscalationThreadViewModel;

        }
Example #27
0
        public void New_items_preserve_sort_order()
        {
            var source = new ObservableCollection <int> {
                1, 5, 0
            };
            var subject = new ObservableCollectionView <int>(
                source,
                null,
                Comparer <int> .Default);

            source.Add(-2);
            source.Add(3);
            source.Add(3);
            source.Add(10);

            subject.AssertAreEqual(new[] { -2, 0, 1, 3, 3, 5, 10 });
        }
        public ProgramListControl()
        {
            DataContext = this;
            InitializeComponent();

            EventManager.RegisterClassHandler(typeof(MetroWindow), Keyboard.KeyDownEvent, new KeyEventHandler(KeyDown), true);
            SearchBar.ApplyAnimationClock(MarginProperty,
                                          new ThicknessAnimation(new Thickness(10, -40, 10, 0), TimeSpan.FromMilliseconds(10)).CreateClock());

            ProgramItems = new ObservableCollectionView <ProgramItemBase>();
            LoadProgramList();
            ProgramItems.Filter = (x => ((ProgramItemBase)x).ProgramName.ToLower().Contains(_searchString.ToLower()));
            ProgramItems.SortDescriptions.Add(new SortDescription("Favorite", ListSortDirection.Descending));
            ProgramItems.SortDescriptions.Add(new SortDescription("ProgramName", ListSortDirection.Ascending));

            ProgramList.ItemsSource = ProgramItems;

            Application.Current.Exit += SaveProgramList;
        }
        public void When_filtering_collection_then_count_should_be_correct()
        {
            //// Arrange
            var source = new ObservableCollection<SampleClass>
            {
                new SampleClass {First = "a", Last = "b"},
                new SampleClass {First = "a", Last = "b"},
                new SampleClass {First = "b", Last = "c"},
                new SampleClass {First = "b", Last = "c"},
            };

            //// Act
            var view = new ObservableCollectionView<SampleClass>(source);
            Assert.AreEqual(4, view.Count);
            view.Filter = c => c.First == "a";

            //// Assert
            Assert.AreEqual(2, view.Count);
        }
Example #30
0
        public Vendor_All_EscalationThread()
        {
            this.InitializeComponent();



            this.EndDatePicker.Date = DateTime.Today;
            int date = DateTime.Today.Day;

            this.StartDatePicker.Date = DateTime.Today.AddDays(-(date - 1));
            this.SizeChanged         += Vendor_All_EscalationThread_SizeChanged;

            EscalatonStatusList      = new ObservableCollection <EscalationStatus>();
            AllMyPlatform            = new ObservableCollection <Product>();
            EscalationThreadList     = new ObservableCollectionView <EscalationAndStatusThread>();
            EscalationThreadListPage = new ObservableCollectionView <EscalationAndStatusThread>();
            this.Loaded += Vendor_All_EscalationThread_Loaded;

            this.DataContext = this;
        }
        public void When_adding_an_element_then_filter_should_work()
        {
            //// Arrange
            var source = new ObservableCollection<SampleClass>
            {
                new SampleClass {First = "a", Last = "b"},
                new SampleClass {First = "a", Last = "b"},
                new SampleClass {First = "b", Last = "c"},
                new SampleClass {First = "b", Last = "c"},
            };

            //// Act
            var view = new ObservableCollectionView<SampleClass>(source);
            view.Filter = c => c.First == "a";

            source.Add(new SampleClass { First = "a" });

            //// Assert
            Assert.AreEqual(3, view.Count);
        }
Example #32
0
        public void CanTrackCollectionCount()
        {
            var source = new ObservableCollection <int> {
                1, 5, 0
            };
            var subject = new ObservableCollectionView <int>(source, x => x > 1);
            var list    = new List <int>();

            subject.ViewCountChanged
            .Aggregate(list, (acc, x) => { acc.Add(x); return(acc); })
            .Subscribe();

            source.Add(6);
            list.AssertAreEqual(new[] { 1, 2 });

            source.Add(7);
            list.AssertAreEqual(new[] { 1, 2, 3 });

            source.Add(0);
            list.AssertAreEqual(new[] { 1, 2, 3 });
        }
        public void When_changing_element_then_view_should_update()
        {
            //// Arrange
            var source = new ObservableCollection<SampleClass>
            {
                new SampleClass {First = "a", Last = "b"},
                new SampleClass {First = "a", Last = "b"},
                new SampleClass {First = "b", Last = "c"},
                new SampleClass {First = "b", Last = "c"},
            };

            //// Act
            var view = new ObservableCollectionView<SampleClass>(source);
            view.TrackItemChanges = true;
            view.Filter = c => c.First == "a";

            var item = source.First();
            item.First = "b";

            //// Assert
            Assert.AreEqual(1, view.Count);
        }
        public void When_adding_item_by_initialize_then_change_tracking_should_work()
        {
            //// Arrange
            var source = new MtObservableCollection <SampleClass>
            {
                new SampleClass {
                    First = "a", Last = "b"
                },
                new SampleClass {
                    First = "a", Last = "b"
                },
                new SampleClass {
                    First = "b", Last = "c"
                },
                new SampleClass {
                    First = "b", Last = "c"
                },
            };

            //// Act
            var view = new ObservableCollectionView <SampleClass>(source);

            view.TrackItemChanges = true;
            view.Filter           = c => c.First == "a";

            var item = new SampleClass {
                First = "b", Last = "c"
            };
            var copy = source.ToList();

            copy.Add(item);

            source.Initialize(copy);

            item.First = "a";

            //// Assert
            Assert.AreEqual(3, view.Count);
        }
Example #35
0
        public int GetPageIndex(ObservableCollectionView <EscalationAndStatusThread> EscalationThreadList, int pageSize)
        {
            int AllPageIndex;

            if (EscalationThreadList.Count > pageSize)
            {
                if (EscalationThreadList.Count % pageSize == 0)
                {
                    AllPageIndex = EscalationThreadList.Count / pageSize;
                }
                else
                {
                    AllPageIndex = (EscalationThreadList.Count / pageSize) + 1;
                }
            }

            else
            {
                AllPageIndex = 1;
            }

            return(AllPageIndex);
        }
Example #36
0
        public void Sort_when_item_property_changes_in_reactive_collection()
        {
            var source = new ReactiveCollection <Mock>(
                new List <Mock>
            {
                new Mock {
                    Name = "b"
                },
                new Mock {
                    Name = "a"
                },
                new Mock {
                    Name = "c", Enabled = true
                }
            })
            {
                ChangeTrackingEnabled = true
            };
            var subject = new ObservableCollectionView <Mock>(
                source,
                null,
                new SortByEnabledAndName());

            subject.Select(x => x.Name).AssertAreEqual(new[] { "c", "a", "b" });

            source.Add(new Mock {
                Name = "d", Enabled = true
            });
            subject.Select(x => x.Name).AssertAreEqual(new[] { "c", "d", "a", "b" });

            source.Single(x => x.Name == "c").Enabled = false;
            subject.Select(x => x.Name).AssertAreEqual(new[] { "d", "a", "b", "c" });

            source.Single(x => x.Name == "a").Name = "z";
            subject.Select(x => x.Name).AssertAreEqual(new[] { "d", "b", "c", "z" });
        }
Example #37
0
		public ListPageViewModel()
		{
			Persons = new ObservableCollectionView<Person>(App.Persons.Collection, null, p => p.Name);
		}
Example #38
0
 /// <summary>Initializes a new instance of the <see cref="ProjectFilter" /> class.</summary>
 /// <param name="filteredProjects">The filtered projects view.</param>
 public ProjectFilter(ObservableCollectionView <VsProject> filteredProjects)
 {
     FilteredProjects = filteredProjects;
 }
 public MainPageViewModel()
 {
     _homes = new MtObservableCollection<Home>();
     Homes = new ObservableCollectionView<Home>(_homes);
 }
Example #40
0
 public ListPageViewModel()
 {
     Persons = new ObservableCollectionView <Person>(App.Persons.Collection, null, p => p.Name);
 }
 public void Degenerate_test()
 {
     var items = new ObservableCollectionView<int>(new int[0]);
 }
        public void Sort_items_upon_instantiation()
        {
            var source = new ObservableCollection<int> { 8, 3, 1, 5, 0, 4, 3 };
            var subject = new ObservableCollectionView<int>(
                source,
                null,
                Comparer<int>.Default);

            subject.AssertAreEqual(new[] { 0, 1, 3, 3, 4, 5, 8 });
        }
Example #43
0
 public void Degenerate_test()
 {
     var items = new ObservableCollectionView <int>(new int[0]);
 }
        public void When_adding_item_then_change_tracking_should_work()
        {
            //// Arrange
            var source = new ObservableCollection<SampleClass>
            {
                new SampleClass {First = "a", Last = "b"},
                new SampleClass {First = "a", Last = "b"},
                new SampleClass {First = "b", Last = "c"},
                new SampleClass {First = "b", Last = "c"},
            };

            //// Act
            var view = new ObservableCollectionView<SampleClass>(source);
            view.TrackItemChanges = true;
            view.Filter = c => c.First == "a";

            var item = new SampleClass { First = "b", Last = "c" };
            source.Add(item);

            item.First = "a";

            //// Assert
            Assert.AreEqual(3, view.Count);
        }
Example #45
0
 public MainPageViewModel()
 {
     Library = new ObservableCollectionView<ePub>(ViewModel.EPubs);
     Collections = new ObservableCollectionView<Collection>(ViewModel.Collections);
 }