예제 #1
0
        public CurrentP4kFileSystemViewModel(ICurrentP4k currentP4k,
                                             ICurrentItem currentFile,
                                             IPinnedItems selectedItems,
                                             IExtractP4kContent extractP4KContent,
                                             ISearch search,
                                             ISearchOptions searchOptions,
                                             IUiDispatch uiDispatch,
                                             SearchOptionsViewModel searchOptionsViewModel,
                                             IEnumerable <IFileSubStructureProvider> subFileFactories = null)
        {
            _currentP4K        = currentP4k;
            _currentFile       = currentFile;
            _selectedItems     = selectedItems;
            _extractP4KContent = extractP4KContent;
            _search            = search;
            _searchOptions     = searchOptions;
            _uiDispatch        = uiDispatch;
            _subFileFactories  = subFileFactories != null?subFileFactories.ToArray() : new IFileSubStructureProvider[0];

            SearchOptionsViewModel = searchOptionsViewModel;

            Initialize();

            _currentP4K.Changed += Initialize;
        }
예제 #2
0
        public P4kFileSystemViewModel(IFileSystem fileSystem,
                                      ICurrentItem currentItem,
                                      IPinnedItems selectedItems,
                                      IExtractP4kContent extractP4KContent)
        {
            _fileSystem        = fileSystem;
            _currentItem       = currentItem;
            _selectedItems     = selectedItems;
            _extractP4KContent = extractP4KContent;

            RootItems = new ObservableCollection <object>();

            SetCurrentItemCommand               = new RelayCommand <object>(SetCurrentItem);
            SetCurrentFileToNothingCommand      = new RelayCommand(_currentItem.Clear);
            ToggleSelectionOfCurrentItemCommand = new RelayCommand(ToggleSelectionOfCurrentItem);
            ExtractCommand = new RelayCommand <object>(ExtractItem);

            ExpandCommand = new RelayCommand <object>(async p =>
            {
                if (!(p is DirectoryViewModel directory))
                {
                    return;
                }

                await directory.LoadChildrenAsync();
            });
            CreateContainedDirectories();
            CreateContainedFiles();
        }
        public CurrentP4kFileSystemViewModel(ICurrentP4k currentP4k,
                                             ICurrentItem currentFile,
                                             IPinnedItems selectedItems,
                                             IExtractP4kContent extractP4KContent)
        {
            _currentP4K        = currentP4k;
            _currentFile       = currentFile;
            _selectedItems     = selectedItems;
            _extractP4KContent = extractP4KContent;
            Initialize();

            _currentP4K.Changed += Initialize;
        }
예제 #4
0
        internal PinnedFileViewModel(IFile file,
                                     ICurrentItem currentFile,
                                     IPinnedItems pinnedItems)
        {
            Model        = file;
            _currentFile = currentFile;

            SetCurrentItemCommand = new RelayCommand(() => _currentFile.ChangeTo(Model));

            _currentFile.Changed += SetIsActive;

            SetIsActive();
        }
예제 #5
0
        internal PinnedDirectoryViewModel(IDirectory directory,
                                          ICurrentItem currentItem,
                                          IPinnedItems selectedItems)
        {
            Model = directory;

            _currentItem = currentItem;

            SetCurrentItemCommand = new RelayCommand(() => _currentItem.ChangeTo(Model));

            _currentItem.Changed += SetIsActive;

            SetIsActive();
        }
예제 #6
0
        public PinnedItemsViewModel(ICurrentItem currentItem,
                                    IPinnedItems pinnedItems,
                                    IOutputDirectory outputDirectory,
                                    IExtractP4kContent extractP4KContent)
        {
            _currentItem       = currentItem;
            _pinnedItems       = pinnedItems;
            _outputDirectory   = outputDirectory;
            _extractP4KContent = extractP4KContent;

            Items = new ObservableCollection <object>();
            ChooseOutputDirectoryCommand = new RelayCommand(ChooseOutputDirectory);
            ExtractCommand = new RelayCommand <object>(ExtractItem);

            _pinnedItems.Changed     += Update;
            _outputDirectory.Changed += RaiseOutputDirectoryChanged;

            Update();
        }
예제 #7
0
        public P4kFileSystemViewModel(IFileSystem fileSystem,
                                      ICurrentItem currentItem,
                                      IPinnedItems selectedItems,
                                      IExtractP4kContent extractP4KContent,
                                      ISearch search,
                                      ISearchOptions searchOptions,
                                      IUiDispatch uiDispatch,
                                      IEnumerable <IFileSubStructureProvider> subFileFactories)
        {
            _fileSystem        = fileSystem;
            _currentItem       = currentItem;
            _selectedItems     = selectedItems;
            _extractP4KContent = extractP4KContent;
            _search            = search;
            _searchOptions     = searchOptions;
            _uiDispatch        = uiDispatch;
            _subFileFactories  = subFileFactories.ToArray();
            RootItems          = new ObservableCollection <TreeNodeViewModel>();

            SetCurrentItemCommand               = new RelayCommand <object>(SetCurrentItem);
            SetCurrentFileToNothingCommand      = new RelayCommand(_currentItem.Clear);
            ToggleSelectionOfCurrentItemCommand = new RelayCommand(ToggleSelectionOfCurrentItem);
            ExtractCommand = new RelayCommand <object>(ExtractItem);

            ExpandCommand = new RelayCommand <object>(async p =>
            {
                if (!(p is DirectoryTreeNodeViewModel directory))
                {
                    return;
                }

                await directory.LoadChildrenAsync();
            });

            CreateRootItems();

            _search.Finished       += FilterRootItems;
            _search.ResultsCleared += CreateRootItems;
        }
예제 #8
0
 private void WhenItIsCreated()
 {
     _sut          = new PinnedItems();
     _sut.Changed += _changedWasRaised;
 }