public DirectoryItemPresentationCoordinator(UINavigationController controller, FileSpecifications fileSpecifications, Configuration configuration, IFileService <object> fileService)
 {
     _navigationController = controller;
     _fileSpecifications   = fileSpecifications;
     _configuration        = configuration;
     _fileService          = fileService;
 }
Esempio n. 2
0
        public DirectoryContentViewModel(LoadedItem <object> loadedDirectoryItem, FileSpecifications fileSpecifications,
                                         Configuration configuration, IFileService <object> fileService)
        {
            url = loadedDirectoryItem.Url;
            _fileSpecifications = fileSpecifications;
            this.configuration  = configuration;
            _fileService        = fileService;

            var  filterConfig      = configuration.FilteringConfiguration;
            var  allItems          = loadedDirectoryItem.Resource as IEnumerable <Item <object> >;
            bool hasAnyFileFIlters = filterConfig.FileFilters.Any();

            _allItems =
                allItems.Where(
                    x => !hasAnyFileFIlters || filterConfig.FileFilters.Any(filter => filter.MatchesItem <object>(x))).ToList();

            _itemsToDisplay = DirectoryContentViewModel.GetItemsWithAppliedFilterAndSortCriterias(string.Empty, SortMode, _allItems).ToList();

            NSNotificationCenter.DefaultCenter.AddObserver(new NSString("ItemsDeleted"), notifiaction =>
            {
                var deletedItems = notifiaction.Object as IEnumerable <Item <object> >;
                if (deletedItems == null)
                {
                    return;
                }

                foreach (var deletedItem in deletedItems)
                {
                    Remove(deletedItem);
                }

                Delegate?.ListChanged(this);
            });
        }
Esempio n. 3
0
 public DirectoryViewModel(NSUrl url, LoadedItem <object> loadedDirectoryItem, FileSpecifications fileSpecifications, Configuration configuration, bool finishButtonHidden)
 {
     this.url  = url;
     this.item = loadedDirectoryItem;
     this.fileSpecifications = fileSpecifications;
     this.configuration      = configuration;
     this.FinishButtonHidden = finishButtonHidden;
 }
Esempio n. 4
0
 public FileItemPresentationCoordinator(UINavigationController navigationController,
                                        Item <object> item,
                                        FileSpecifications fileSpecifications,
                                        IFileService <object> fileService = null)
 {
     if (fileService == null)
     {
         fileService = new LocalStorageFileService <object>();
     }
     this.navigationController = navigationController;
     this.fileService          = fileService;
     this.fileSpecifications   = fileSpecifications;
     this.item = item;
 }
Esempio n. 5
0
        public void Start(Item <object> item, FileSpecifications fileSpecifications, Configuration configuration, bool animated)
        {
            this.configuration      = configuration;
            this.fileSpecifications = fileSpecifications;

            switch (item.Type)
            {
            case ItemType.Directory:
                var coordinator = new DirectoryItemPresentationCoordinator(_navigationController, fileSpecifications,
                                                                           configuration);
                coordinator.Delegate = this;
                coordinator.Start(item.Url, animated);
                _coordinators.Add(item);
                break;

            case ItemType.File:
                var fileCoordinator = new FileItemPresentationCoordinator(_navigationController, item, fileSpecifications);
                fileCoordinator.Start(animated);
                _coordinators.Add(fileCoordinator);
                break;
            }
        }
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            var fileSpecifications = new FileSpecifications();

            var actionsConfiguration = new ActionsConfiguration()
            {
                CanRemoveFiles          = CanRemoveFiles,
                CanRemoveDirectories    = CanRemoveDirectories,
                CanChooseDirectories    = CanChooseDirectories,
                CanChooseFiles          = CanChooseFiles,
                AllowsMultipleSelection = AllowsMultipleSelection
            };

            var filteringConfiguration = new FilteringConfiguration()
            {
                FileFilters        = FileFilters,
                IgnoredFileFilters = IgnoredFileFilters
            };

            var configuration = new Configuration()
            {
                ActionsConfiguration   = actionsConfiguration,
                FilteringConfiguration = filteringConfiguration
            };

            var itemToExplore = Item <object> .At(InitialDirectoryOfUrl, isDirectory : true);

            if (itemToExplore != null)
            {
                itemPresentationCoordinator.Start(itemToExplore, fileSpecifications, configuration, false);
            }
            else
            {
                throw new InvalidOperationException("Passed url is incorrect.");
            }
        }
Esempio n. 7
0
 public DirectoryContentViewModel(LoadedItem <object> loadedDirectoryItem, FileSpecifications fileSpecifications,
                                  Configuration configuration)
     : this(loadedDirectoryItem, fileSpecifications, configuration, new LocalStorageFileService <object>())
 {
 }
Esempio n. 8
0
 internal void RemoveFileSpecification(string fileSpecification)
 {
     FileSpecifications.Remove(fileSpecification);
     Save();
 }
Esempio n. 9
0
 internal void AddFileSpecification(string fileSpecification)
 {
     FileSpecifications.Add(fileSpecification);
     Save();
 }
 public DirectoryItemPresentationCoordinator(UINavigationController controller, FileSpecifications fileSpecifications, Configuration configuration) : this(controller, fileSpecifications, configuration, new LocalStorageFileService <object>())
 {
 }