/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/ViewModels/Dialogs/AddBranchDialogViewModel.cs
63 строки
1 KB
Jupiter
Code Quality: Moved `GetBranchNames` operation into Git abstraction (#18440)
19 май 2026, 01:09
Не верифицирован
19 май 2026, 01:09
a7326cf
Код
Авторство
О чём код?
namespace Files.App.ViewModels.Dialogs { public sealed partial class AddBranchDialogViewModel : ObservableObject { private readonly string _repositoryPath; private string _NewBranchName = string.Empty; public string NewBranchName { get => _NewBranchName; set { if (!SetProperty(ref _NewBranchName, value)) return; IsBranchValid = !string.IsNullOrWhiteSpace(value) && GitHelpers.ValidateBranchNameForRepository(value, _repositoryPath); OnPropertyChanged(nameof(ShowWarningTip)); } } private bool _IsBranchValid; public bool IsBranchValid { get => _IsBranchValid; set { if (SetProperty(ref _IsBranchValid, value)) OnPropertyChanged(nameof(ShowWarningTip)); } } private string _BasedOn = null!; public string BasedOn { get => _BasedOn; set => SetProperty(ref _BasedOn, value); } private bool _Checkout = true; public bool Checkout { get => _Checkout; set => SetProperty(ref _Checkout, value); } public bool ShowWarningTip => !string.IsNullOrEmpty(_NewBranchName) && !_IsBranchValid; public string[] Branches { get; private set; } public AddBranchDialogViewModel(string repositoryPath, string activeBranch) { _repositoryPath = repositoryPath; BasedOn = activeBranch; Branches = []; } public async Task LoadBranches() { Branches = (await GitHelpers.GetBranchNames(_repositoryPath)).Select(b => b.Name).ToArray(); OnPropertyChanged(nameof(Branches)); } } }