CloneRequest ShowCloneDialog(IGitHubServiceProvider gitHubServiceProvider, IGitRepositoriesExt gitRepositories, IRepositoryModel repository = null) { string basePath = null; gitHubServiceProvider.AddService(this, gitRepositories); var uiProvider = gitHubServiceProvider.GetService <IUIProvider>(); var controller = uiProvider.Configure(repository == null ? UIControllerFlow.Clone : UIControllerFlow.StartPageClone, null //TODO: set the connection corresponding to the repository if the repository is not null ); controller.TransitionSignal.Subscribe(x => { if ((repository == null && x.Data.ViewType == Exports.UIViewType.Clone) || // fire the normal clone dialog (repository != null && x.Data.ViewType == Exports.UIViewType.StartPageClone) // fire the clone dialog for re-acquiring a repo ) { var vm = x.View.ViewModel as IBaseCloneViewModel; if (repository != null) { vm.SelectedRepository = repository; } x.View.Done.Subscribe(_ => { basePath = vm.BaseRepositoryPath; if (repository == null) { repository = vm.SelectedRepository; } }); } }); uiProvider.RunInDialog(controller); gitHubServiceProvider.RemoveService(typeof(IGitRepositoriesExt), this); return(repository != null && basePath != null ? new CloneRequest(basePath, repository) : null); }
CloneRequest ShowCloneDialog(IUIProvider uiProvider, IGitRepositoriesExt gitRepositories, ISimpleRepositoryModel repository = null) { string basePath = null; uiProvider.AddService(this, gitRepositories); var load = uiProvider.SetupUI(repository == null ? UIControllerFlow.Clone : UIControllerFlow.StartPageClone, null //TODO: set the connection corresponding to the repository if the repository is not null ); load.Subscribe(x => { if ((repository == null && x.Data.ViewType == Exports.UIViewType.Clone) || // fire the normal clone dialog (repository != null && x.Data.ViewType == Exports.UIViewType.StartPageClone) // fire the clone dialog for re-acquiring a repo ) { var vm = x.View.ViewModel as IBaseCloneViewModel; if (repository != null) { vm.SelectedRepository = repository; } x.View.Done.Subscribe(_ => { basePath = vm.BaseRepositoryPath; if (repository == null) { repository = vm.SelectedRepository; } }); } }); uiProvider.RunUI(); uiProvider.RemoveService(typeof(IGitRepositoriesExt), this); return(new CloneRequest(basePath, repository)); }