Exemplo n.º 1
0
        /// <inheritdoc/>
        public DriveItemViewModel LoadChildDirectoryAndFileViewModels(DriveItemViewModel driveItemVM)
        {
            var driveItemModel = this.PresentationLogic.LoadChildDirectoriesAndFiles(driveItemVM.DriveItemModel);

            driveItemVM.ChildTreeItemVMs = ConvertExplorerTreeChildItemModelsInExplorerTreeChildItemVMs(driveItemVM, driveItemModel.Childs);
            return(driveItemVM);
        }
Exemplo n.º 2
0
        public void MultiselectDesicions_IsEnsuredOnlyDrivesAreNowSelectableByMultiselectTrue_DriveVMIsInListSelectedDrives()
        {
            SelectionConfiguration          selectionConfiguration          = new SelectionConfiguration();
            SelectedExplorerTreeItemHandler selectedExplorerTreeItemHandler = new SelectedExplorerTreeItemHandler(selectionConfiguration);
            DriveSelectionHandler           driveSelectionHandler           = new DriveSelectionHandler(selectedExplorerTreeItemHandler, selectionConfiguration);
            DriveItemViewModel driveItemVM = new DriveItemViewModel();

            driveSelectionHandler.MultiselectDesicions(true, driveItemVM);

            Assert.AreEqual(driveItemVM, selectedExplorerTreeItemHandler.SelectedDrives.First());
        }
Exemplo n.º 3
0
        public void AddOrRemoveDriveAccordingToIsSelected_Add_DriveVMIsInListSelectedDirectories()
        {
            SelectionConfiguration          selectionConfiguration          = new SelectionConfiguration();
            SelectedExplorerTreeItemHandler selectedExplorerTreeItemHandler = new SelectedExplorerTreeItemHandler(selectionConfiguration);
            DriveSelectionHandler           driveSelectionHandler           = new DriveSelectionHandler(selectedExplorerTreeItemHandler, selectionConfiguration);
            DriveItemViewModel driveItemVM = new DriveItemViewModel();

            driveSelectionHandler.AddOrRemoveDriveAccordingToIsSelected(true, driveItemVM);

            Assert.AreEqual(driveItemVM, selectedExplorerTreeItemHandler.SelectedDrives.First());
        }
Exemplo n.º 4
0
        public void MultiselectDesicions_IsEnsuredOnlyDrivesAreNowSelectableByMultiselectTrue_ReturnsTrue()
        {
            SelectionConfiguration          selectionConfiguration          = new SelectionConfiguration();
            SelectedExplorerTreeItemHandler selectedExplorerTreeItemHandler = new SelectedExplorerTreeItemHandler(selectionConfiguration);
            DriveSelectionHandler           driveSelectionHandler           = new DriveSelectionHandler(selectedExplorerTreeItemHandler, selectionConfiguration);
            DriveItemViewModel driveItemVM = new DriveItemViewModel();

            bool result = driveSelectionHandler.MultiselectDesicions(true, driveItemVM);

            Assert.AreEqual(true, result);
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Index(string name)
        {
            var drive = await _explorer.GetDriveByName(name);

            ViewBag.DriveName = name;
            var children = await _explorer.GetDriveRoot(drive.Id);

            var items = children.Select(item => DriveItemViewModel.Create(item, drive.Id));

            return(View("Folder", items));
        }
Exemplo n.º 6
0
 internal void AddOrRemoveDriveAccordingToIsSelected(bool isSelected, DriveItemViewModel driveItemVM)
 {
     if (isSelected)
     {
         this.SelectedItemHandler.AddDriveToSelectedItems(driveItemVM);
     }
     else
     {
         this.SelectedItemHandler.RemoveDriveFromSelectedItems(driveItemVM);
     }
 }
Exemplo n.º 7
0
        public async Task <IActionResult> Folders(string name, string id)
        {
            var drive = await _explorer.GetDriveByName(name);

            var folderItems = await _client.Me.Drives[drive.Id].Items[id].Children
                              .Request()
                              .GetAsync();

            var models = folderItems.Select(item => DriveItemViewModel.Create(item, drive.Id));

            return(View("Folder", models));
        }
Exemplo n.º 8
0
        public void MultiselectDesicions_IsEnsuredOnlyDrivesAreNowSelectableByMultiselectFalseBecauseFileWasSelectedFirst_ReturnsFalse()
        {
            SelectionConfiguration          selectionConfiguration          = new SelectionConfiguration();
            SelectedExplorerTreeItemHandler selectedExplorerTreeItemHandler = new SelectedExplorerTreeItemHandler(selectionConfiguration);

            selectedExplorerTreeItemHandler.SelectedFiles.Add(new FileItemViewModel());
            DriveSelectionHandler driveSelectionHandler = new DriveSelectionHandler(selectedExplorerTreeItemHandler, selectionConfiguration);
            DriveItemViewModel    driveItemVM           = new DriveItemViewModel();

            bool result = driveSelectionHandler.MultiselectDesicions(true, driveItemVM);

            Assert.AreEqual(false, result);
        }
Exemplo n.º 9
0
        private bool MultiselectDrivesOnly(bool isSelected, DriveItemViewModel drive)
        {
            if (IsEnsuredOnlyDrivesAreNowSelectableByMultiselect())
            {
                AddOrRemoveDriveAccordingToIsSelected(isSelected, drive);
            }
            else
            {
                isSelected = false;
            }

            return(isSelected);
        }
Exemplo n.º 10
0
        public void MultiselectDesicions_IsMultiselectCombinationDirectoriesAndFilesAllowedTrue_ReturnsFalse()
        {
            SelectionConfiguration selectionConfiguration = new SelectionConfiguration();

            selectionConfiguration.IsMultiselectCombinationDirectoriesAndFilesAllowed = true;

            SelectedExplorerTreeItemHandler selectedExplorerTreeItemHandler = new SelectedExplorerTreeItemHandler(selectionConfiguration);
            DriveSelectionHandler           driveSelectionHandler           = new DriveSelectionHandler(selectedExplorerTreeItemHandler, selectionConfiguration);
            DriveItemViewModel driveItemVM = new DriveItemViewModel();


            bool result = driveSelectionHandler.MultiselectDesicions(true, driveItemVM);

            Assert.AreEqual(false, result);
        }
Exemplo n.º 11
0
        public void MultiselectDesicions_IsMultiselectCombinationAllTypesAllowedTrue_DriveVMIsInListSelectedDirectories()
        {
            SelectionConfiguration selectionConfiguration = new SelectionConfiguration();

            selectionConfiguration.IsMultiselectCombinationAllTypesAllowed = true;

            SelectedExplorerTreeItemHandler selectedExplorerTreeItemHandler = new SelectedExplorerTreeItemHandler(selectionConfiguration);
            DriveSelectionHandler           driveSelectionHandler           = new DriveSelectionHandler(selectedExplorerTreeItemHandler, selectionConfiguration);
            DriveItemViewModel driveItemVM = new DriveItemViewModel();


            driveSelectionHandler.MultiselectDesicions(true, driveItemVM);

            Assert.AreEqual(driveItemVM, selectedExplorerTreeItemHandler.SelectedDrives.First());
        }
Exemplo n.º 12
0
 /// <summary>
 ///
 /// <para>
 /// If the order of the if-queries is changed,
 /// the documentation in <see cref="ExplorerTree.API.Configuration.SelectionConfiguration.SelectionConfiguration"/>
 /// has to be adapted
 /// </para>
 /// </summary>
 /// <param name="isSelected"></param>
 /// <param name="drive"></param>
 /// <returns></returns>
 internal bool MultiselectDesicions(bool isSelected, DriveItemViewModel drive)
 {
     if (SelectionConfiguration.IsMultiselectCombinationAllTypesAllowed)
     {
         this.AddOrRemoveDriveAccordingToIsSelected(isSelected, drive);
     }
     else if (SelectionConfiguration.IsMultiselectCombinationDirectoriesAndFilesAllowed)
     {
         isSelected = false;
     }
     else
     {
         isSelected = MultiselectDrivesOnly(isSelected, drive);
     }
     return(isSelected);
 }
Exemplo n.º 13
0
        public void AddOrRemoveDriveAccordingToIsSelected_Remove_DriveVMIsInListSelectedExplorerTreeItems()
        {
            SelectionConfiguration          selectionConfiguration          = new SelectionConfiguration();
            SelectedExplorerTreeItemHandler selectedExplorerTreeItemHandler = new SelectedExplorerTreeItemHandler(selectionConfiguration);

            DriveSelectionHandler driveSelectionHandler = new DriveSelectionHandler(selectedExplorerTreeItemHandler, selectionConfiguration);
            DriveItemViewModel    driveItemVM           = new DriveItemViewModel();

            selectedExplorerTreeItemHandler.SelectedExplorerTreeItems.Add(new DriveItemViewModel());
            selectedExplorerTreeItemHandler.SelectedExplorerTreeItems.Add(driveItemVM);
            selectedExplorerTreeItemHandler.SelectedExplorerTreeItems.Add(new DriveItemViewModel());
            selectedExplorerTreeItemHandler.SelectedExplorerTreeItems.Add(new DriveItemViewModel());


            driveSelectionHandler.AddOrRemoveDriveAccordingToIsSelected(false, driveItemVM);

            Assert.AreEqual(-1, selectedExplorerTreeItemHandler.SelectedExplorerTreeItems.IndexOf(driveItemVM));
        }
Exemplo n.º 14
0
 public virtual void RemoveDriveFromSelectedItems(DriveItemViewModel driveItemVM)
 {
     this.SelectedExplorerTreeItems.Remove(driveItemVM);
     this.SelectedDrives.Remove(driveItemVM);
 }
Exemplo n.º 15
0
 public virtual void AddDriveToSelectedItems(DriveItemViewModel driveItemVM)
 {
     this.SelectedExplorerTreeItems.Add(driveItemVM);
     this.SelectedDrives.Add(driveItemVM);
 }
Exemplo n.º 16
0
 /// <summary>
 /// To generate a drive foreach drive Type from Enum: <see cref="DriveType"/>
 /// </summary>
 private static void SetDriveTypeAccordingToEnumDriveTypeAndTheLocalVariable_i(int i, DriveItemViewModel drive)
 {
     string[] driveTyps = Enum.GetNames(typeof(DriveType));
     drive.DriveType = (DriveType)Enum.Parse(typeof(DriveType), driveTyps.ElementAt(i));
 }