예제 #1
0
 public CollectionsVM(
     CollectionsFABButtonVM fabPlusButtonVM,
     UploadVM uploadVM,
     TagVM tagVM,
     TagImageDialogVM tagImageDialogVM,
     SearchBoxVM searchBoxVM,
     TagDropDownMenuVM tagDropdownMenuVM,
     SortDropdownMenuVM sortDropdownMenuVM,
     DeleteConfirmationBarVM deleteConfirmationVM,
     ImageViewerVM imageViewerVM,
     ProjectService projectService,
     TagsService tagsService)
 {
     State = CollectionsState.Main;
     CollectionsFABButtonVM = fabPlusButtonVM;
     UploadVM                    = uploadVM;
     TagImageDialogVM            = tagImageDialogVM;
     TagVM                       = tagVM;
     SearchBoxVM                 = searchBoxVM;
     SearchBoxVM.HasErrorMessage = true;
     SearchBoxVM.ErrorMessage    = "No search results";
     SearchBoxVM.PlaceHolderText = "Search by name";
     TagDropdownMenuVM           = tagDropdownMenuVM;
     SortDropdownMenuVM          = sortDropdownMenuVM;
     DeleteConfirmationBarVM     = deleteConfirmationVM;
     ImageViewerVM               = imageViewerVM;
     ProjectService              = projectService;
     TagsService                 = tagsService;
     RegisterEvents();
     ImageThumbnails = new ObservableCollection <ImageThumbnailCollectionsVM>();
 }
예제 #2
0
        public void Test_FilterItems_Sets_FilteredItems_To_Items_Matching_SearchText()
        {
            var dummies  = GetDummies();
            var searchVM = new SearchBoxVM <Dummy>(dummies, converter);

            searchVM.SearchText = "key";

            searchVM.FilterItems();
            var result = searchVM.Filtered;

            Assert.Equal(3, result.Count);
            Assert.True(GetDummiesWithKey().TrueForAll(dummy => result.Contains(converter(dummy))));
        }
예제 #3
0
        public void Test_FilterItems_Sets_AutoCompleteItem_To_Entry_When_Only_Result()
        {
            var dummies      = GetDummiesWithoutKey();
            var dummyWithKey = new Dummy {
                stringItem = "with key", otherValue = 0
            };

            dummies.Add(dummyWithKey);
            var searchVM = new SearchBoxVM <Dummy>(dummies, converter);

            searchVM.SearchText = "key";

            searchVM.FilterItems();
            var result = searchVM.Filtered;

            Assert.Single(result);
            Assert.Equal(dummyWithKey, searchVM.AutoCompleteItem);
        }
예제 #4
0
 public ProjectsVM(
     ProjectsFABButtonVM fABPlusButtonVM,
     CreateProjectVM createProjectVM,
     SortDropdownMenuVM sortDropdownMenuVM,
     SearchBoxVM searchBoxVM,
     ProjectService projectService)
 {
     ProjectsFABButtonVM             = fABPlusButtonVM;
     CreateProjectVM                 = createProjectVM;
     SortDropdownMenuVM              = sortDropdownMenuVM;
     SortDropdownMenuVM.SortDateText = "Date Created";
     SearchBoxVM = searchBoxVM;
     SearchBoxVM.PlaceHolderText = "Search by name";
     SearchBoxVM.HasErrorMessage = true;
     SearchBoxVM.ErrorMessage    = "No search results";
     ProjectService = projectService;
     RegisterEvents();
 }
예제 #5
0
        public void Test_FilterItems_Sets_AutoCompleteItem_To_Default_When_Not_Only_Result()
        {
            var dummies      = GetDummiesWithoutKey();
            var dummyWithKey = new Dummy {
                stringItem = "with key", otherValue = 0
            };

            dummies.Add(dummyWithKey);
            var searchVM = new SearchBoxVM <Dummy>(dummies, converter);

            searchVM.SearchText = "key";

            searchVM.FilterItems();
            Assert.NotNull(searchVM.AutoCompleteItem);

            dummies.AddRange(GetDummiesWithKey());
            searchVM.FilterItems();
            var result = searchVM.Filtered;

            Assert.Equal(4, result.Count);
            Assert.Null(searchVM.AutoCompleteItem);
        }
예제 #6
0
 public UploadVM(TagsService imageService, SearchBoxVM AHAHA)
 {
     _imageService  = imageService;
     ImagesToUpload = new ObservableCollection <ImageThumbnailUploadVM>();
 }