/// <summary> /// Initializes a new instance of the <see cref="DriveVM"/> class. /// </summary> /// <param name="another">Another <see cref="DriveVM"/> instance to copy data from.</param> protected DriveVM(DriveVM another) { AbsolutePath = another.AbsolutePath; isSelected = another.IsSelected; Model = another.Model; Drive = another.Drive; }
/// <summary> /// Fetch data from corresponding folder model and its childs folder and files. /// </summary> public override void Refresh() { base.Refresh(); IList <IViewModel> list = new List <IViewModel>(); foreach (DriveInfo drive in Model.LocalDrives) { var vm = new DriveVM(Model) { AbsolutePath = drive.Name }; vm.Refresh(); list.Add(vm); } // TODO: remove this temporary "parent simulator" from childs collection // and make it separate in UI and code, but navigatable like always. IEnumerable <IViewModel> resultList = Enumerable.Empty <IViewModel>(); var fullVM = NavigateOut(); var parent = new ParentNodeVM(fullVM) { AbsolutePath = ((IViewModel)fullVM).AbsolutePath }; resultList = Enumerable.Repeat((IViewModel)parent, 1); resultList = resultList.Concat(list); // -- TODOEND -- OnPropertyChanging("Childs"); childs.Clear(); childs = new ObservableCollection <IViewModel>(resultList); OnPropertyChanged("Childs"); if (CurrentItemIndex == -1 && childs.Count > 0) { CurrentItemIndex = 0; } Header.Text = Name; // var imageConverter = new FileToIconConverter // { // DefaultSize = 16 // }; // // Header.Icon = imageConverter.GetImage(AbsolutePath, 16); }