@@ -25,7 +25,7 @@ public enum SourceControlTab
25
25
UnsyncedCommits ,
26
26
Settings
27
27
}
28
-
28
+
29
29
public sealed class SourceControlViewViewModel : ViewModelBase , IDisposable
30
30
{
31
31
private readonly VBE _vbe ;
@@ -368,11 +368,11 @@ private void AddOrUpdateLocalPathConfig(Repository repo)
368
368
var existing = _config . Repositories . Single ( repository => repository . LocalLocation == repo . LocalLocation ) ;
369
369
if ( string . IsNullOrEmpty ( repo . RemoteLocation ) && ! string . IsNullOrEmpty ( existing . RemoteLocation ) )
370
370
{
371
- // config already has remote location and correct repository name - nothing to update
371
+ // config already has remote location and correct repository id - nothing to update
372
372
return ;
373
373
}
374
374
375
- existing . Name = repo . Name ;
375
+ existing . Id = repo . Id ;
376
376
existing . RemoteLocation = repo . RemoteLocation ;
377
377
378
378
_configService . Save ( _config ) ;
@@ -391,15 +391,18 @@ private void OpenRepo()
391
391
var project = _vbe . ActiveVBProject ;
392
392
var repo = new Repository ( project . Name , folderPicker . SelectedPath , string . Empty ) ;
393
393
394
+ OnOpenRepoStarted ( ) ;
394
395
try
395
396
{
396
397
Provider = _providerFactory . CreateProvider ( project , repo , _wrapperFactory ) ;
397
398
}
398
399
catch ( SourceControlException ex )
399
400
{
401
+ OnOpenRepoCompleted ( ) ;
400
402
ViewModel_ErrorThrown ( null , new ErrorEventArgs ( ex . Message , ex . InnerException . Message , NotificationType . Error ) ) ;
401
403
return ;
402
404
}
405
+ OnOpenRepoCompleted ( ) ;
403
406
404
407
AddOrUpdateLocalPathConfig ( repo ) ;
405
408
@@ -409,14 +412,16 @@ private void OpenRepo()
409
412
410
413
private void CloneRepo ( )
411
414
{
415
+ OnOpenRepoStarted ( ) ;
416
+
412
417
try
413
418
{
414
419
_provider = _providerFactory . CreateProvider ( _vbe . ActiveVBProject ) ;
415
420
var repo = _provider . Clone ( RemotePath , LocalDirectory ) ;
416
421
Provider = _providerFactory . CreateProvider ( _vbe . ActiveVBProject , repo , _wrapperFactory ) ;
417
422
AddOrUpdateLocalPathConfig ( new Repository
418
423
{
419
- Name = _vbe . ActiveVBProject . Name ,
424
+ Id = _vbe . ActiveVBProject . HelpFile ,
420
425
LocalLocation = repo . LocalLocation ,
421
426
RemoteLocation = repo . RemoteLocation
422
427
} ) ;
@@ -427,6 +432,7 @@ private void CloneRepo()
427
432
return ;
428
433
}
429
434
435
+ OnOpenRepoCompleted ( ) ;
430
436
CloseCloneRepoGrid ( ) ;
431
437
432
438
SetChildPresenterSourceControlProviders ( _provider ) ;
@@ -454,15 +460,18 @@ private void OpenRepoAssignedToProject()
454
460
455
461
try
456
462
{
463
+ OnOpenRepoStarted ( ) ;
457
464
Provider = _providerFactory . CreateProvider ( _vbe . ActiveVBProject ,
458
- _config . Repositories . First ( repo => repo . Name == _vbe . ActiveVBProject . Name ) , _wrapperFactory ) ;
465
+ _config . Repositories . First ( repo => repo . Id == _vbe . ActiveVBProject . HelpFile ) , _wrapperFactory ) ;
459
466
Status = RubberduckUI . Online ;
460
467
}
461
468
catch ( SourceControlException ex )
462
469
{
463
470
ViewModel_ErrorThrown ( null , new ErrorEventArgs ( ex . Message , ex . InnerException . Message , NotificationType . Error ) ) ;
464
471
Status = RubberduckUI . Offline ;
465
472
}
473
+
474
+ OnOpenRepoCompleted ( ) ;
466
475
}
467
476
468
477
private void Refresh ( )
@@ -487,7 +496,7 @@ private bool ValidRepoExists()
487
496
return false ;
488
497
}
489
498
490
- var possibleRepos = _config . Repositories . Where ( repo => repo . Name == _vbe . ActiveVBProject . Name ) ;
499
+ var possibleRepos = _config . Repositories . Where ( repo => repo . Id == _vbe . ActiveVBProject . HelpFile ) ;
491
500
492
501
var possibleCount = possibleRepos . Count ( ) ;
493
502
@@ -535,7 +544,7 @@ public ICommand CloneRepoCommand
535
544
{
536
545
get { return _cloneRepoCommand ; }
537
546
}
538
-
547
+
539
548
private readonly ICommand _showFilePickerCommand ;
540
549
public ICommand ShowFilePickerCommand
541
550
{
@@ -590,6 +599,26 @@ public ICommand LoginGridCancelCommand
590
599
}
591
600
}
592
601
602
+ public event EventHandler < EventArgs > OpenRepoStarted ;
603
+ private void OnOpenRepoStarted ( )
604
+ {
605
+ var handler = OpenRepoStarted ;
606
+ if ( handler != null )
607
+ {
608
+ handler ( this , EventArgs . Empty ) ;
609
+ }
610
+ }
611
+
612
+ public event EventHandler < EventArgs > OpenRepoCompleted ;
613
+ private void OnOpenRepoCompleted ( )
614
+ {
615
+ var handler = OpenRepoCompleted ;
616
+ if ( handler != null )
617
+ {
618
+ handler ( this , EventArgs . Empty ) ;
619
+ }
620
+ }
621
+
593
622
public void Dispose ( )
594
623
{
595
624
if ( _state != null )
0 commit comments