// public ICommand GoToSubmoduleCommand // { // get { return new MvxCommand<SourceModel>(GoToSubmodule);} // } // private void GoToSubmodule(SourceModel x) // { // var nameAndSlug = x.GitUrl.Substring(x.GitUrl.IndexOf("/repos/", System.StringComparison.Ordinal) + 7); // var repoId = new RepositoryIdentifier(nameAndSlug.Substring(0, nameAndSlug.IndexOf("/git", System.StringComparison.Ordinal))); // var sha = x.GitUrl.Substring(x.GitUrl.LastIndexOf("/", System.StringComparison.Ordinal) + 1); // ShowViewModel<SourceTreeViewModel>(new NavObject {Username = repoId.Owner, Repository = repoId.Name, Branch = sha}); // } public SourceTreeViewModel() { _content = new FilterableCollectionViewModel<SourceModel, SourceFilterModel>("SourceViewModel"); _content.FilteringFunction = FilterModel; _content.Bind(x => x.Filter).Subscribe(_ => _content.Refresh()); this.Bind(x => x.Filter).Subscribe(_ => _content.Refresh()); GoToSourceCommand = ReactiveUI.ReactiveCommand.Create(); GoToSourceCommand.OfType<SourceModel>().Subscribe(x => { if (x.Type.Equals("dir", StringComparison.OrdinalIgnoreCase)) { ShowViewModel<SourceTreeViewModel>(new NavObject { Username = Username, Branch = Branch, Repository = Repository, Path = x.Path }); } else if (x.Type.Equals("file", StringComparison.OrdinalIgnoreCase)) { ShowViewModel<SourceViewModel>(new SourceViewModel.NavObject { Name = x.Name, User = Username, Repository = Repository, Branch = Branch, Path = x.Path }); } }); }