public void DirectoryChanged(DirectoryViewModel parameter) { if (parameter.IsSelected) { SelectedDirectory = parameter; } }
public void Open_Clicked(object parameter) { var dlg = new OpenFileDialog(); dlg.Title = "Select archive"; if (dlg.ShowDialog() == true) { // open archive this.model.Load(dlg.FileName); var vm = new DirectoryViewModel(model.Archive.Root, null); directories_ = new List <IDirectoryViewModel>(); directories_.Add(vm); NotifyPropertyChanged("Directories"); var dirstack = new Stack <DirectoryViewModel>(); dirstack.Push(vm); while (dirstack.Count > 0) { var qq = dirstack.Pop(); qq.OnSelectionChanged = DirectoryChanged; foreach (var xx in qq.Children) { dirstack.Push(xx); } } vm.IsSelected = true; CommandManager.InvalidateRequerySuggested(); } }
public DirectoryViewModel(IArchiveDirectory directory, DirectoryViewModel parent) { this.directory = directory; this.parentDirectory = parent; childDirectories = new List <DirectoryViewModel>(); foreach (var f in directory.GetDirectories()) { var dd = new DirectoryViewModel(f, this); childDirectories.Add(dd); } }
public DirectoryViewModel(IArchiveDirectory directory, DirectoryViewModel parent) { this.directory = directory; this.parentDirectory = parent; childDirectories = new List<DirectoryViewModel>(); foreach (var f in directory.GetDirectories()) { var dd = new DirectoryViewModel(f, this); childDirectories.Add(dd); } }
public void Open_Clicked(object parameter) { var dlg = new OpenFileDialog(); dlg.Title = "Select archive"; if (dlg.ShowDialog() == true) { // open archive this.model.Load(dlg.FileName); var vm = new DirectoryViewModel(model.Archive.Root, null); directories_ = new List<IDirectoryViewModel>(); directories_.Add(vm); NotifyPropertyChanged("Directories"); var dirstack = new Stack<DirectoryViewModel>(); dirstack.Push(vm); while (dirstack.Count > 0) { var qq = dirstack.Pop(); qq.OnSelectionChanged = DirectoryChanged; foreach (var xx in qq.Children) dirstack.Push(xx); } vm.IsSelected = true; CommandManager.InvalidateRequerySuggested(); } }