public RepositoryViewController(string owner, string repository) : this() { ViewModel = new RepositoryViewModel(); ViewModel.Init(new RepositoryViewModel.NavObject { Username = owner, Repository = repository }); }
public RepositoryViewController( string owner, string repositoryName, Octokit.Repository repository = null) : this() { ViewModel = new RepositoryViewModel(); ViewModel.Init(new RepositoryViewModel.NavObject { Username = owner, Repository = repositoryName }); ViewModel.Repository = repository; }
/// <summary> /// A helper method for opening a new repository for the given path. /// /// This will bring up a question regarding the name to use and initialize the repository view model and load it up in the tab control. /// </summary> /// <param name="path"></param> /// <returns></returns> private bool OpenNewRepository(string path) { var repository = new RepositoryViewModel { NotOpened = false, RepositoryFullPath = path }; // Try loading the repository information and see if it worked. var result = repository.Init(); if (result) { var mainWindowViewModel = (MainWindowViewModel)Application.Current.MainWindow.DataContext; // Ask the user for the Name. var nameDialog = new PromptDialog { ResponseText = repository.RepositoryFullPath.Split(System.IO.Path.DirectorySeparatorChar).Last(), Message = "Give a name for this repository:", Title = "Information needed" }; repository.Name = nameDialog.ShowDialog() == true ? nameDialog.ResponseText : repository.RepositoryFullPath; // Open the repository and display it visually. mainWindowViewModel.RepositoryViewModels.Add(repository); mainWindowViewModel.RecentRepositories.Add(repository); repository.SetThisRepositoryAsTheActiveTab(); } else { return(false); } return(true); }
/// <summary> /// A helper method for opening a new repository for the given path. /// /// This will bring up a question regarding the name to use and initialize the repository view model and load it up in the tab control. /// </summary> /// <param name="path"></param> /// <returns></returns> private bool OpenNewRepository(string path) { var repository = new RepositoryViewModel { NotOpened = false, RepositoryFullPath = path }; // Try loading the repository information and see if it worked. var result = repository.Init(); if (result) { var mainWindowViewModel = (MainWindowViewModel) Application.Current.MainWindow.DataContext; // Ask the user for the Name. var nameDialog = new PromptDialog { ResponseText = repository.RepositoryFullPath.Split(System.IO.Path.DirectorySeparatorChar).Last(), Message = "Give a name for this repository:", Title = "Information needed" }; repository.Name = nameDialog.ShowDialog() == true ? nameDialog.ResponseText : repository.RepositoryFullPath; // Open the repository and display it visually. mainWindowViewModel.RepositoryViewModels.Add(repository); mainWindowViewModel.RecentRepositories.Add(repository); repository.SetThisRepositoryAsTheActiveTab(); } else { return false; } return true; }