public DirectoryTreeViewModel(IWindowManager windowManager, IEventAggregator events) { _events = events; if (events != null) { events.Subscribe(this); } Entries = new EntriesHelper <IDirectoryNodeViewModel>(); var selection = new TreeRootSelector <IDirectoryNodeViewModel, IEntryModel>(Entries) { Comparers = new[] { PathComparer.LocalDefault } }; selection.SelectionChanged += (o, e) => { BroadcastDirectoryChanged(EntryViewModel.FromEntryModel(selection.SelectedValue)); }; Selection = selection; Commands = new DirectoryTreeCommandManager(this, windowManager, events); DragHelper = new DirectoryTreeDragHelper(Entries, Selection); }
private void updateDisplayItemsAndCaption(IFileListViewModel flvm) { SelectionCount = flvm.Selection.SelectedItems.Count(); Metadata.LoadAsync(UpdateMode.Replace, true, flvm); DisplayItems.Clear(); switch (SelectionCount) { case 0: //Caption = String.Format(NoneSelected, flvm.CurrentDirectory.EntryModel.Label); DisplayItems.Add(EntryViewModel.FromEntryModel(flvm.CurrentDirectory)); break; case 1: //Caption = String.Format(OneSelected, flvm.SelectedItems.First().EntryModel.Label); DisplayItems.Add(flvm.Selection.SelectedItems.First()); break; default: //Caption = String.Format(ManySelected, flvm.SelectedItems.Count.ToString()); DisplayItems.AddRange(flvm.Selection.SelectedItems.Take(5)); break; } }
void OnSuggestPathChanged() { if (!EnableBreadcrumb) { Task.Run(async() => { foreach (var p in _profiles) { if (p.MatchPathPattern(SuggestedPath)) { if (String.IsNullOrEmpty(SuggestedPath) && Entries.AllNonBindable.Count() > 0) { SuggestedPath = Entries.AllNonBindable.First().EntryModel.FullPath; } var found = await p.ParseThenLookupAsync(SuggestedPath, CancellationToken.None); if (found != null) { _sbox.Dispatcher.BeginInvoke(new System.Action(() => { SelectAsync(found); })); EnableBreadcrumb = true; BroadcastDirectoryChanged(EntryViewModel.FromEntryModel(found)); } //else not found } } }); //.Start(); } }
public void GoUp() { if (!_updatingNavPosition && _currentFolder != null && _currentFolder.EntryModel.Parent != null) { AddAndBroadcast(EntryViewModel.FromEntryModel(_currentFolder.EntryModel.Parent)); } else { UpdateState(); } }
public FileListItemDropHelper(FileListItemViewModel flvm) : base( new LambdaValueConverter <IEntryViewModel, IEntryModel>( (evm) => evm.EntryModel, (em) => EntryViewModel.FromEntryModel(em)), new LambdaValueConverter <IEnumerable <IEntryModel>, IDataObject>( ems => flvm.EntryModel.Profile.DragDrop.GetDataObject(ems), da => flvm.EntryModel.Profile.DragDrop.GetEntryModels(da)), (ems, eff) => flvm.EntryModel.Profile.DragDrop.QueryDrop(ems, flvm.EntryModel, eff), (ems, da, eff) => flvm.EntryModel.Profile.DragDrop.OnDropCompleted(ems, da, flvm.EntryModel, eff)) { }
public DirectoryNodeDropHelper(IEntryModel curDir, IEntriesHelper <IDirectoryNodeViewModel> entries, ITreeSelector <IDirectoryNodeViewModel, IEntryModel> selection) : base( new LambdaValueConverter <IEntryViewModel, IEntryModel>( (evm) => evm.EntryModel, (em) => EntryViewModel.FromEntryModel(em)), new LambdaValueConverter <IEnumerable <IEntryModel>, IDataObject>( ems => curDir.Profile.DragDrop.GetDataObject(ems), da => dataObjectFunc(da, selection)), (ems, eff) => curDir.Profile.DragDrop.QueryDrop(ems, curDir, eff), (ems, da, eff) => curDir.Profile.DragDrop.OnDropCompleted(ems, da, curDir, eff)) { }
public BreadcrumbViewModel(IEventAggregator events) { _events = events; if (events != null) { events.Subscribe(this); } Entries = new EntriesHelper <IBreadcrumbItemViewModel>(); var selection = new TreeRootSelector <IBreadcrumbItemViewModel, IEntryModel>(Entries) { Comparers = new[] { PathComparer.LocalDefault } }; selection.SelectionChanged += (o, e) => { BroadcastDirectoryChanged(EntryViewModel.FromEntryModel(selection.SelectedValue)); }; Selection = selection; Commands = new BreadcrumbCommandManager(this, events); }
public void Handle(DirectoryChangedEvent message) { this.DisplayName = String.Format(WindowTitleMask, message.NewModel.Label); _currentDirectoryViewModel = EntryViewModel.FromEntryModel(message.NewModel); NotifyOfPropertyChange(() => CurrentDirectory); }
public IEntryViewModel Clone() { return(EntryViewModel.FromEntryModel(this.EntryModel)); }