@@ -14,9 +14,9 @@ public class DirectoryPropertiesViewModel : ObservableObject
1414
1515 private string ? _gitRepositoryPath ;
1616
17- private readonly ObservableCollection < string > _localBranches = new ( ) ;
17+ private readonly ObservableCollection < BranchItem > _localBranches = new ( ) ;
1818
19- private readonly ObservableCollection < string > _remoteBranches = new ( ) ;
19+ private readonly ObservableCollection < BranchItem > _remoteBranches = new ( ) ;
2020
2121 public bool IsBranchesFlyoutExpaned { get ; set ; } = false ;
2222
@@ -43,9 +43,9 @@ public int SelectedBranchIndex
4343 if ( SetProperty ( ref _SelectedBranchIndex , value ) &&
4444 value != - 1 &&
4545 ( value != ACTIVE_BRANCH_INDEX || ! _ShowLocals ) &&
46- value < BranchesNames . Count )
46+ value < Branches . Count )
4747 {
48- CheckoutRequested ? . Invoke ( this , BranchesNames [ value ] ) ;
48+ CheckoutRequested ? . Invoke ( this , Branches [ value ] . Name ) ;
4949 }
5050 }
5151 }
@@ -58,7 +58,7 @@ public bool ShowLocals
5858 {
5959 if ( SetProperty ( ref _ShowLocals , value ) )
6060 {
61- OnPropertyChanged ( nameof ( BranchesNames ) ) ;
61+ OnPropertyChanged ( nameof ( Branches ) ) ;
6262
6363 if ( value )
6464 SelectedBranchIndex = ACTIVE_BRANCH_INDEX ;
@@ -80,7 +80,7 @@ public string ExtendedStatusInfo
8080 set => SetProperty ( ref _ExtendedStatusInfo , value ) ;
8181 }
8282
83- public ObservableCollection < string > BranchesNames => _ShowLocals
83+ public ObservableCollection < BranchItem > Branches => _ShowLocals
8484 ? _localBranches
8585 : _remoteBranches ;
8686
@@ -91,7 +91,7 @@ public string ExtendedStatusInfo
9191 public DirectoryPropertiesViewModel ( )
9292 {
9393 NewBranchCommand = new AsyncRelayCommand ( ( )
94- => GitHelpers . CreateNewBranchAsync ( _gitRepositoryPath ! , _localBranches [ ACTIVE_BRANCH_INDEX ] ) ) ;
94+ => GitHelpers . CreateNewBranchAsync ( _gitRepositoryPath ! , _localBranches [ ACTIVE_BRANCH_INDEX ] . Name ) ) ;
9595 }
9696
9797 public void UpdateGitInfo ( bool isGitRepository , string ? repositoryPath , BranchItem ? head )
@@ -128,12 +128,17 @@ public async Task LoadBranches()
128128 foreach ( var branch in branches )
129129 {
130130 if ( branch . IsRemote )
131- _remoteBranches . Add ( branch . Name ) ;
131+ _remoteBranches . Add ( branch ) ;
132132 else
133- _localBranches . Add ( branch . Name ) ;
133+ _localBranches . Add ( branch ) ;
134134 }
135135
136136 SelectedBranchIndex = ShowLocals ? ACTIVE_BRANCH_INDEX : - 1 ;
137137 }
138+
139+ public Task ExecuteDeleteBranch ( string ? branchName )
140+ {
141+ return GitHelpers . DeleteBranchAsync ( _gitRepositoryPath , GitBranchDisplayName , branchName ) ;
142+ }
138143 }
139144}
0 commit comments