private void SetCurrentItem(object item) { if (item is FileTreeNodeViewModel file) { _currentItem.ChangeTo(file.Model); return; } if (item is DirectoryTreeNodeViewModel directory) { _currentItem.ChangeTo(directory.Model); } }
public void A_file_can_be_set_as_current_item() { GivenSut(); Assert.Null(_sut.CurrentFile); Assert.Null(_sut.CurrentDirectory); _sut.ChangeTo(_file); Assert.Same(_file, _sut.CurrentFile); Assert.Null(_sut.CurrentDirectory); ThenChangedWasRaisedTimes(Times.Once()); }
internal PinnedFileViewModel(IFile file, ICurrentItem currentFile, IPinnedItems pinnedItems) { Model = file; _currentFile = currentFile; SetCurrentItemCommand = new RelayCommand(() => _currentFile.ChangeTo(Model)); _currentFile.Changed += SetIsActive; SetIsActive(); }
internal PinnedDirectoryViewModel(IDirectory directory, ICurrentItem currentItem, IPinnedItems selectedItems) { Model = directory; _currentItem = currentItem; SetCurrentItemCommand = new RelayCommand(() => _currentItem.ChangeTo(Model)); _currentItem.Changed += SetIsActive; SetIsActive(); }