private void OnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs) { switch (propertyChangedEventArgs.PropertyName) { case nameof(ProgramLocation): IsRepositoryPathChangable = ProgramLocation == ProgramLocation.GitRepository; RefreshDiscoveryTypes(); break; case nameof(DiscoveryType): IsIntededChangesEditingEnabled = DiscoveryType == DiscoveryType.UserIntendedChangesDiscovery; IsFromCommitChangeable = DiscoveryType == DiscoveryType.OfflineDiscovery && FromCommitModels.Any(); IsToCommitChangeable = DiscoveryType == DiscoveryType.OfflineDiscovery && ToCommitModels.Any(); break; case nameof(RunStatus): IsRunning = RunStatus == RunStatus.Running; break; case nameof(RepositoryPath): RefreshCommitsSelection(); break; case nameof(FromCommit): var toCommitId = ToCommit?.Identifier; ToCommitModels.Clear(); ToCommitModels.Add(new CommitViewModel { DisplayName = "Uncommitted Changes", Identifier = UncommittedChangesIdentifier }); ToCommitModels.AddRange(gitCommitsProvider.GetAllCommits(RepositoryPath).TakeWhile(x => x.ShaId != FromCommit?.Identifier).Select(ConvertCommit)); ToCommit = ToCommitModels.SingleOrDefault(x => x.Identifier == toCommitId) ?? ToCommitModels.FirstOrDefault(); break; case nameof(TimeLimit): userRunConfigurationProvider.TimeLimit = TimeLimit; break; case nameof(TestType): RefreshProcessingTypes(); IsCsvTestsFileSelectable = TestType == TestType.CsvList; break; case nameof(CsvTestsFile): userRunConfigurationProvider.CsvTestsFile = CsvTestsFile; break; } }
private void RefreshCommitsSelection() { var fromCommitId = FromCommit?.Identifier; FromCommitModels.Clear(); FromCommitModels.AddRange(gitCommitsProvider.GetAllCommits(RepositoryPath).Select(ConvertCommit)); var oldFromCommit = FromCommitModels.SingleOrDefault(x => x.Identifier == fromCommitId); FromCommit = oldFromCommit ?? FromCommitModels.FirstOrDefault(); IsFromCommitChangeable = DiscoveryType == DiscoveryType.OfflineDiscovery && FromCommitModels.Any(); IsToCommitChangeable = DiscoveryType == DiscoveryType.OfflineDiscovery && ToCommitModels.Any(); }