コード例 #1
0
        public void ApplyPropertyChanges_ModifySomeVisiblesSourceItemsToNotVisible_GetsOnlyVisibleItems()
        {
            ///Arrange
            var visibleItemsList = new ObservableCollection <VisibleItem> ();

            for (int i = 0; i < 10; i++)
            {
                visibleItemsList.Add(new VisibleItem()
                {
                    Visible = (i % 2 == 0)
                });
            }

            ///Act

            var target = new VisibleRangeObservableProxy <VisibleItem> (visibleItemsList);

            foreach (var item in visibleItemsList)
            {
                item.Visible = false;
            }
            target.ApplyPropertyChanges();

            foreach (var item in visibleItemsList)
            {
                item.Visible = true;
            }
            target.ApplyPropertyChanges();

            ///Assert

            Assert.AreEqual(10, target.Count);
        }
コード例 #2
0
        public void ApplyPropertyChanges_AddSomeVisiblesOthersNotAndReplaceOriginalList_GetsNewVisibleItems()
        {
            ///Arrange
            var visibleItemsList = new RangeObservableCollection <VisibleItem> ();

            for (int i = 0; i < 10; i++)
            {
                visibleItemsList.Add(new VisibleItem()
                {
                    Visible = (i % 2 == 0)
                });
            }

            ///Act

            var target = new VisibleRangeObservableProxy <VisibleItem> (visibleItemsList);


            var newVisibleItemsList = new RangeObservableCollection <VisibleItem> ();

            for (int i = 0; i < 5; i++)
            {
                newVisibleItemsList.Add(new VisibleItem()
                {
                    Visible = (i % 2 == 0)
                });
            }

            visibleItemsList.Reset(newVisibleItemsList);
            target.ApplyPropertyChanges();

            ///Assert

            Assert.AreEqual(3, target.Count);
        }
コード例 #3
0
 public TemplatesManagerViewModel()
 {
     LoadedTemplate = new TViewModel();
     NewCommand     = new AsyncCommand(New)
     {
         IconName = "vas-plus"
     };
     SaveCommand       = new AsyncCommand <bool> (Save, () => LoadedTemplate.Model != null && LoadedTemplate.Edited);
     DeleteCommand     = new AsyncCommand <TViewModel> (Delete, CanDelete);
     ExportCommand     = new AsyncCommand(Export, () => LoadedTemplate.Model != null);
     ImportCommand     = new AsyncCommand(Import);
     OpenCommand       = new AsyncCommand <TModel> (Open);
     VisibleViewModels = new VisibleRangeObservableProxy <TViewModel> (ViewModels);
 }
コード例 #4
0
 public ProjectsManagerVM()
 {
     LoadedProject = new TViewModel();
     NewCommand    = new LimitationCommand(VASCountLimitedObjects.Projects.ToString(), New)
     {
         IconName = "vas-plus"
     };
     OpenCommand   = new AsyncCommand <TViewModel> (Open, (arg) => Selection.Count == 1);
     DeleteCommand = new AsyncCommand <TViewModel> (Delete, (arg) => Selection.Any() || arg != null)
     {
         IconName = "vas-delete"
     };
     SaveCommand   = new AsyncCommand(Save, () => LoadedProject?.Model != null && LoadedProject.IsChanged);
     ExportCommand = new AsyncCommand(Export, () => Selection.Count == 1);
     EmptyCard     = new EmptyCardVM {
         HeaderText      = ProjectsNoneCreated,
         DescriptionText = ProjectsCreateHelper,
         TipText         = ProjectsCreateTip,
     };
     VisibleViewModels = new VisibleRangeObservableProxy <TViewModel> (ViewModels);
 }
コード例 #5
0
        public void AddItems_SomeVisiblesOthersNot_GetsOnlyVisibleItems()
        {
            ///Arrange
            var visibleItemsList = new ObservableCollection <VisibleItem> ();

            for (int i = 0; i < 10; i++)
            {
                visibleItemsList.Add(new VisibleItem()
                {
                    Visible = (i % 2 == 0)
                });
            }

            ///Act

            var target = new VisibleRangeObservableProxy <VisibleItem> (visibleItemsList);

            ///Assert

            Assert.AreEqual(5, target.Count);
        }
コード例 #6
0
        public void ApplyPropertyChanges_AddSomeVisiblesOthersNotAndDeleteOneItemOnOriginalList_GetsOnlyVisibleItems()
        {
            ///Arrange
            var visibleItemsList = new ObservableCollection <VisibleItem> ();

            for (int i = 0; i < 10; i++)
            {
                visibleItemsList.Add(new VisibleItem()
                {
                    Visible = (i % 2 == 0)
                });
            }

            ///Act

            var target = new VisibleRangeObservableProxy <VisibleItem> (visibleItemsList);

            visibleItemsList.RemoveAt(0);

            ///Assert

            Assert.AreEqual(4, target.Count);
        }
コード例 #7
0
 public SportsProjectsManagerVM()
 {
     ResyncCommand     = new LimitationAsyncCommand(VASFeature.OpenMultiCamera.ToString(), Resync, () => LoadedProject.FileSet.Count() > 1);
     ProjectMenu       = CreateProjectMenu();
     VisibleViewModels = new VisibleRangeObservableProxy <LMProjectVM> (ViewModels);
 }