public FileEntryViewModel(FileEntry fileEntry, IFileSystem fileSystem) { _fileSystem = fileSystem; _fileSystem.FileExplorerEntryRenamed += FileSystemOnFileExplorerEntryRenamed; _fileEntry = fileEntry; Name = fileEntry.Name; Commands = new EntryViewModelCommands(this, fileSystem); }
public DirectoryNodeViewModel(PackedDirectoryEntry packedDirectoryEntry, IFileSystem fileSystem) { Value = packedDirectoryEntry; _fileSystem = fileSystem; var driveDirectoryEntry = packedDirectoryEntry as DriveDirectoryEntry; if (driveDirectoryEntry != null) { IsDrive = true; Size = driveDirectoryEntry.UsedSpace; switch (driveDirectoryEntry.DriveType) { case DriveDirectoryType.Unknown: Description = (string)Application.Current.Resources["Unknown"]; break; case DriveDirectoryType.Removable: Description = (string)Application.Current.Resources["UsbDrive"]; break; case DriveDirectoryType.Fixed: Description = (string)Application.Current.Resources["LocalDisk"]; break; case DriveDirectoryType.Network: Description = (string)Application.Current.Resources["NetworkDrive"]; break; case DriveDirectoryType.CDRom: Description = (string)Application.Current.Resources["CdDrive"]; break; case DriveDirectoryType.Ram: Description = "RAM " + (string)Application.Current.Resources["Drive"]; break; default: Description = (string)Application.Current.Resources["Drive"]; break; } } else { Description = (string)Application.Current.Resources["Directory"]; } Name = packedDirectoryEntry.Name; fileSystem.DirectoryEntriesUpdated += FileSystemOnDirectoryEntriesUpdated; fileSystem.FileExplorerEntryRemoved += FileSystemOnFileExplorerEntryRemoved; fileSystem.FileExplorerEntryRenamed += FileSystemOnFileExplorerEntryRenamed; fileSystem.FileExplorerEntryAdded += FileSystemOnFileExplorerEntryAdded; Commands = new EntryViewModelCommands(this, fileSystem); }