Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 04862c5

Browse files
author
Jasmine
committed
remove unrelated methods, restore relevant method
1 parent 3427f93 commit 04862c5

File tree

2 files changed

+7
-37
lines changed

2 files changed

+7
-37
lines changed

src/GitHub.VisualStudio/Base/MenuBase.cs

-36
Original file line numberDiff line numberDiff line change
@@ -54,42 +54,6 @@ protected MenuBase(IServiceProvider serviceProvider)
5454
this.serviceProvider = serviceProvider;
5555
}
5656

57-
protected ISimpleRepositoryModel GetActiveRepo()
58-
{
59-
var activeRepo = ServiceProvider.GetExportedValue<ITeamExplorerServiceHolder>()?.ActiveRepo;
60-
// activeRepo can be null at this point because it is set elsewhere as the result of async operation that may not have completed yet.
61-
if (activeRepo == null)
62-
{
63-
var path = ServiceProvider.GetExportedValue<IVSServices>()?.GetActiveRepoPath() ?? String.Empty;
64-
try
65-
{
66-
activeRepo = !string.IsNullOrEmpty(path) ? new SimpleRepositoryModel(path) : null;
67-
}
68-
catch (Exception ex)
69-
{
70-
VsOutputLogger.WriteLine(string.Format(CultureInfo.CurrentCulture, "Error loading the repository from '{0}'. {1}", path, ex));
71-
}
72-
}
73-
return activeRepo;
74-
}
75-
76-
protected void StartFlow(UIControllerFlow controllerFlow)
77-
{
78-
var uiProvider = ServiceProvider.GetExportedValue<IUIProvider>();
79-
Debug.Assert(uiProvider != null, "MenuBase:StartFlow:No UIProvider available.");
80-
if (uiProvider == null)
81-
return;
82-
83-
IConnection connection = null;
84-
if (controllerFlow != UIControllerFlow.Authentication)
85-
{
86-
var activeRepo = GetActiveRepo();
87-
connection = ServiceProvider.GetExportedValue<IConnectionManager>()?.Connections
88-
.FirstOrDefault(c => activeRepo?.CloneUrl?.RepositoryName != null && c.HostAddress.Equals(HostAddress.Create(activeRepo.CloneUrl)));
89-
}
90-
uiProvider.RunUI(controllerFlow, connection);
91-
}
92-
9357
void RefreshRepo()
9458
{
9559
ActiveRepo = ServiceProvider.GetExportedValue<ITeamExplorerServiceHolder>().ActiveRepo;

src/GitHub.VisualStudio/Menus/AddConnection.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace GitHub.VisualStudio.Menus
1111
{
1212
[Export(typeof(IMenuHandler))]
1313
[PartCreationPolicy(CreationPolicy.Shared)]
14-
public class AddConnection: MenuBase, IMenuHandler
14+
public class AddConnection : MenuBase, IMenuHandler
1515
{
1616
[ImportingConstructor]
1717
public AddConnection([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, ISimpleApiClientFactory apiFactory)
@@ -26,5 +26,11 @@ public void Activate()
2626
{
2727
StartFlow(UIControllerFlow.Authentication);
2828
}
29+
30+
void StartFlow(UIControllerFlow controllerFlow)
31+
{
32+
var uiProvider = ServiceProvider.GetExportedValue<IUIProvider>();
33+
uiProvider.RunUI(controllerFlow, null);
34+
}
2935
}
3036
}

0 commit comments

Comments
 (0)