Esempio n. 1
0
        public DirectoryViewModel(DirectoryEntry directoryEntry, IFileSystem fileSystem, IUiTools uiTools, bool isNode)
        {
            _fileSystem = fileSystem;
            _uiTools    = uiTools;
            _source     = directoryEntry;

            if (directoryEntry is DriveDirectoryEntry driveDirectory)
            {
                Size        = driveDirectory.UsedSpace;
                Description = Tx.T($"FileExplorer:DriveTypes.{driveDirectory.DriveType}");
            }
            else
            {
                Description = Tx.T("FileExplorer:Directory");
            }

            UpdateName();

            if (isNode)
            {
                fileSystem.EntryAdded              += FileSystemOnEntryAdded;
                fileSystem.EntryRemoved            += FileSystemOnEntryRemoved;
                fileSystem.DirectoryEntriesUpdated += FileSystemOnDirectoryEntriesUpdated;
            }

            fileSystem.EntryUpdated += FileSystemOnEntryUpdated;
            _isNodeViewModel         = isNode;
        }
Esempio n. 2
0
        public ProcessingEntryViewModel(FileTransferViewModel fileTransferViewModel, IFileSystem fileSystem,
                                        IUiTools uiTools)
        {
            _fileSystem = fileSystem;
            _uiTools    = uiTools;
            Label       = fileTransferViewModel.Name;
            Name        = fileTransferViewModel.Name;
            SortName    = fileTransferViewModel.Name;
            IsDirectory = fileTransferViewModel.IsDirectory;
            Description = Tx.T("FileExplorer:Upload");

            if (IsDirectory)
            {
                Source = new DirectoryEntry {
                    HasSubFolder = true
                }
            }
            ;
            else
            {
                Source = new FileEntry {
                    Size = fileTransferViewModel.TotalSize
                }
            };

            Source.CreationTime = DateTimeOffset.Now;
            Source.LastAccess   = DateTimeOffset.Now;
            Source.Name         = fileTransferViewModel.Name;
            Source.Path         = Path.Combine(fileTransferViewModel.TargetPath, Name);

            _lazyIcon     = new Lazy <ImageSource>(CreateIcon);
            CancelCommand = fileTransferViewModel.CancelCommand;
        }
Esempio n. 3
0
        public FileViewModel(FileEntry fileEntry, IFileSystem fileSystem, IUiTools uiTools)
        {
            _fileSystem = fileSystem;
            _uiTools    = uiTools;
            _fileEntry  = fileEntry;

            UpdateName();

            fileSystem.EntryUpdated += FileSystemOnEntryUpdated;
        }
Esempio n. 4
0
        public DirectoryViewModel(DirectoryTreeViewModel rootViewModel, DirectoryViewModel parentViewModel,
                                  DirectoryEntry directoryEntry, IFileSystem fileSystem, IUiTools uiTools) : this(directoryEntry, fileSystem,
                                                                                                                  uiTools, true)
        {
            _rootViewModel = rootViewModel;
            Parent         = parentViewModel;

            Entries   = new EntriesHelper <DirectoryViewModel>(LoadEntriesAsync);
            Selection = new TreeSelector <DirectoryViewModel, FileExplorerEntry>(Source, this,
                                                                                 parentViewModel?.Selection ?? rootViewModel.Selection, Entries);

            if (!directoryEntry.HasSubFolder)
            {
                Entries.SetEntries(ImmutableList <DirectoryViewModel> .Empty);
            }
        }
Esempio n. 5
0
 public DirectoryViewModel(DirectoryEntry directoryEntry, IFileSystem fileSystem, int orderNumber,
                           IUiTools uiTools) : this(directoryEntry, fileSystem, uiTools, false)
 {
     _sortName = orderNumber.ToString("0000");
 }