Пример #1
0
 public CommitViewModel(Guid repositoryId)
 {
     _repositoryId    = repositoryId;
     _gitManager      = new GitManager();
     _branchService   = new BranchService();
     _commitService   = new CommitService();
     _branches        = new ObservableCollection <Branch>(_branchService.GetBranches(_repositoryId));
     _commits         = new ObservableCollection <CommitDto>(_branchService.GetBranches(_repositoryId).CreateCommitsDto());
     _changedFiles    = new ObservableCollection <string>(_gitManager.GitStatusAsync(_repositoryId).Result);
     _stage           = new ObservableCollection <string>();
     _visibility      = Visibility.Hidden;
     _mergeVisibility = Visibility.Hidden;
     Color            = Brushes.Blue;
     ColorPush        = Brushes.Blue;
     Task.Run(async() =>
     {
         HeadBranch = await _gitManager.NameHeadBranch(_repositoryId);
     });
     Task.Run(async() =>
     {
         var result = await _gitManager.IsExistPullAsync(_repositoryId).ConfigureAwait(false);
         if (!result)
         {
             Color = Brushes.Red;
         }
     });
 }
Пример #2
0
        private async Task CheckoutAsync()
        {
            if (_selectedBranch != null)
            {
                await _gitManager.GitCheckoutAsync(_repositoryId, _selectedBranch.Id).ConfigureAwait(false);

                HeadBranch = _selectedBranch.Name;
                var result = await _gitManager.IsExistPullAsync(_repositoryId).ConfigureAwait(false);

                if (!result)
                {
                    Color = Brushes.Red;
                }
                else
                {
                    Color = Brushes.Blue;
                }
            }
        }