public DropRepoViewModel(IScreen hostScreen, IAppState appState, IRepoAnalysisProvider analyzeFunc)
        {
            HostScreen = hostScreen;

            AnalyzeRepo = new ReactiveAsyncCommand();

            CoreUtility.ExtractLibGit2();

            var scanResult = AnalyzeRepo.RegisterAsyncObservable(x => analyzeFunc.AnalyzeRepo((string)x));

            scanResult.Select(x => x.Item1).ToProperty(this, x => x.CurrentRepoPath);
            scanResult
            .Select(x => x.Item2.Select(y => (IBranchInformationViewModel) new BranchInformationViewModel(y.Key, y.Value)))
            .Select(x => new ReactiveCollection <IBranchInformationViewModel>(x))
            .ToProperty(this, x => x.BranchInformation);

            this.WhenAny(x => x.BranchInformation, x => x.Value != null ? Visibility.Visible : Visibility.Hidden)
            .ToProperty(this, x => x.RepairButtonVisibility);

            RepairButton = new ReactiveCommand();
            RepairButton.Subscribe(_ => {
                appState.BranchInformation           = BranchInformation.Where(x => x.BranchName != Constants.WorkingDirectory).ToArray();
                appState.WorkingDirectoryInformation = BranchInformation.First(x => x.BranchName == Constants.WorkingDirectory).Model;
                appState.CurrentRepo = CurrentRepoPath;

                HostScreen.Router.Navigate.Execute(RxApp.GetService <IRepairViewModel>());
            });

            var viewStates = Observable.Merge(
                AnalyzeRepo.ItemsInflight.Where(x => x > 0).Select(_ => "Analyzing"),
                scanResult.Select(_ => "RepoAdded"));

            MessageBus.Current.RegisterMessageSource(viewStates, "DropRepoViewState");

            this.WhenNavigatedTo(() =>
                                 MessageBus.Current.Listen <string>("DropFolder").Subscribe(path => AnalyzeRepo.Execute(path)));
        }
        public DropRepoViewModel(IScreen hostScreen, IAppState appState, IRepoAnalysisProvider analyzeFunc)
        {
            HostScreen = hostScreen;

            AnalyzeRepo = new ReactiveAsyncCommand();

            CoreUtility.ExtractLibGit2();

            var scanResult = AnalyzeRepo.RegisterAsyncObservable(x => analyzeFunc.AnalyzeRepo((string) x));

            scanResult.Select(x => x.Item1).ToProperty(this, x => x.CurrentRepoPath);
            scanResult
                .Select(x => x.Item2.Select(y => (IBranchInformationViewModel)new BranchInformationViewModel(y.Key, y.Value)))
                .Select(x => new ReactiveCollection<IBranchInformationViewModel>(x))
                .ToProperty(this, x => x.BranchInformation);

            this.WhenAny(x => x.BranchInformation, x => x.Value != null ? Visibility.Visible : Visibility.Hidden)
                .ToProperty(this, x => x.RepairButtonVisibility);

            RepairButton = new ReactiveCommand();
            RepairButton.Subscribe(_ => {
                appState.BranchInformation = BranchInformation.Where(x => x.BranchName != Constants.WorkingDirectory).ToArray();
                appState.WorkingDirectoryInformation = BranchInformation.First(x => x.BranchName == Constants.WorkingDirectory).Model;
                appState.CurrentRepo = CurrentRepoPath;

                HostScreen.Router.Navigate.Execute(RxApp.GetService<IRepairViewModel>());
            });

            var viewStates = Observable.Merge(
                AnalyzeRepo.ItemsInflight.Where(x => x > 0).Select(_ => "Analyzing"),
                scanResult.Select(_ => "RepoAdded"));

            MessageBus.Current.RegisterMessageSource(viewStates, "DropRepoViewState");

            this.WhenNavigatedTo(() =>
                MessageBus.Current.Listen<string>("DropFolder").Subscribe(path => AnalyzeRepo.Execute(path)));
        }