public DirectoryStructureViewModel() { this.Items = new ObservableCollection <DirectoryItemViewModel>( DirectoryStructure.GetLogicalDrives() .Select(drive => new DirectoryItemViewModel(drive.FullPath, DirectoryItemType.Drive))); }
public SelectPathViewModel(DirectoryItemType searchToLevel, string startPath = "", string fileExtantion = "") { this.searchToLevel = searchToLevel; this.selectedPath = startPath; this.newFolderCommand = new RelayCommand <object>(OnNewFolderClick); this.renameFolderCommand = new RelayCommand <object>(OnRenameFolderClick); this.deleteFolderCommand = new RelayCommand <object>(OnDeleteFolderClick); this.okCommand = new RelayCommand <object>(OkCommandClick); this.closeCommand = new RelayCommand <object>(OnCloseCliked); this.pathChangeCommand = new RelayCommand <object>(OnPathChange); this.SelectionChanged += OnFolderPathChange; this.DirectoryItems = new ObservableCollection <DirectoryItemViewModel>(); var children = DirectoryStructure.GetLogicalDrives(); foreach (DirectoryItem drive in children) { var childViewModel = new DirectoryItemViewModel(drive.FullPath, drive.Type, searchToLevel, fileExtantion); childViewModel.SelectDirectoryItem += OnSelectDirectoryItem; this.DirectoryItems.Add(childViewModel); } if (!string.IsNullOrEmpty(startPath) && (System.IO.Directory.Exists(startPath) || File.Exists(startPath))) { var pathList = startPath.Split(Path.DirectorySeparatorChar).ToList(); Navigate(this.DirectoryItems, pathList); } //TODO: navigate to path }
public DirectoryStructureViewModel() { var children = DirectoryStructure.GetLogicalDrives(); this.Items = new ObservableCollection <DirectoryItemViewModel>( children.Select(drive => new DirectoryItemViewModel(drive.FullPath, drive.Type))); }
/// <summary> /// Default constructor /// </summary> public DirectoryStructureViewModel() { //Get the logical drives var children = DirectoryStructure.GetLogicalDrives(); //Create view models from data Items = new ObservableCollection <DirectoryItemViewModel>(children.Select(drive => new DirectoryItemViewModel(drive.FullPath, DirectoryItemType.Drive))); }
public DirectoryStructureViewModel() { var children = DirectoryStructure.GetLogicalDrives(); Selected = new List <DirectoryItemVievModel>(); Items = new ObservableCollection <DirectoryItemVievModel>( children.Select(drive => new DirectoryItemVievModel(drive.FullPath, DirectoryItemType.Drive))); }
public SelectPathViewModel(IDialogFactory dialogFactory, DirectoryItemType searchToLevel, IIOWrapper iOWrapper, string rootPath = "", string startPath = "", string fileExtantion = "") { if (dialogFactory == null) { throw new ArgumentNullException(nameof(dialogFactory)); } if (iOWrapper == null) { throw new ArgumentNullException(nameof(iOWrapper)); } this.dialogFactory = dialogFactory; this.iOWrapper = iOWrapper; this.searchToLevel = searchToLevel; this.selectedPath = startPath; this.newFolderCommand = new RelayCommand <object>(OnNewFolderClick); this.renameFolderCommand = new RelayCommand <object>(OnRenameFolderClick); this.deleteFolderCommand = new RelayCommand <object>(OnDeleteFolderClick); this.okCommand = new RelayCommand <object>(OkCommandClick); this.closeCommand = new RelayCommand <object>(OnCloseCliked); this.pathChangeCommand = new RelayCommand <object>(OnPathChange); this.SelectionChanged += OnFolderPathChange; this.DirectoryItems = new ObservableCollection <DirectoryItemViewModel>(); List <DirectoryItem> children; if (System.IO.Directory.Exists(rootPath)) { children = new List <DirectoryItem> { new DirectoryItem() { FullPath = rootPath, Type = DirectoryItemType.Folder } }; } else { children = DirectoryStructure.GetLogicalDrives(); } foreach (DirectoryItem drive in children) { var childViewModel = new DirectoryItemViewModel(drive.FullPath, drive.Type, searchToLevel, fileExtantion); childViewModel.SelectDirectoryItem += OnSelectDirectoryItem; this.DirectoryItems.Add(childViewModel); } if (!string.IsNullOrEmpty(startPath) && (System.IO.Directory.Exists(startPath) || File.Exists(startPath))) { var pathList = startPath.Split(Path.DirectorySeparatorChar).ToList(); Navigate(this.DirectoryItems, pathList); } //TODO: navigate to path }
public RootViewModel() { this._settingview = new SettingsView(); this._settingviewmodel = new SettingsViewModel(this._settingview, this); this._settingview.DataContext = this._settingviewmodel; this._backstack = new Stack <InspectViewModel>(); this._forwardstack = new Stack <InspectViewModel>(); ViewPort = new InspectViewModel(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), DirectoryType.MyDocuments, $"{Environment.SpecialFolder.MyDocuments}", false); RefreshViewPort(); NotifyOfPropertyChange(() => ViewPortChildren); this.Drives = new ObservableCollection <DirectoryItemViewModel>(DirectoryStructure.GetLogicalDrives().Select(e => new DirectoryItemViewModel(e.FullPath, e.Type, e.Name, e.Hidden))); DefultDirectoies(); }
public DirectoryStructureViewModel() { List <DirectoryItem> children = DirectoryStructure.GetLogicalDrives(); Items = new ObservableCollection <DirectoryItemViewModel>(children.Select(x => new DirectoryItemViewModel(x.FullPath, DirectoryItemType.Drive))); }
public DirectoryViewModel() { Directories = new ObservableCollection <DirectoryItemViewModel>(DirectoryStructure.GetLogicalDrives().Select(c => new DirectoryItemViewModel(c.FullPath, DirectoryItemType.Drive))); }