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

Commit fc267e9

Browse files
committed
Lazy load IDialogService.
As it causes Rx to get loaded.
1 parent b80e0ab commit fc267e9

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/GitHub.VisualStudio/Commands/AddConnectionCommand.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ namespace GitHub.VisualStudio.Commands
1313
[Export(typeof(IAddConnectionCommand))]
1414
public class AddConnectionCommand : VsCommand, IAddConnectionCommand
1515
{
16-
readonly IDialogService dialogService;
16+
readonly Lazy<IDialogService> dialogService;
1717

1818
[ImportingConstructor]
19-
protected AddConnectionCommand(IDialogService dialogService)
19+
protected AddConnectionCommand(IGitHubServiceProvider serviceProvider)
2020
: base(CommandSet, CommandId)
2121
{
22-
this.dialogService = dialogService;
22+
dialogService = new Lazy<IDialogService>(() => serviceProvider.TryGetService<IDialogService>());
2323
}
2424

2525
/// <summary>
@@ -37,7 +37,7 @@ protected AddConnectionCommand(IDialogService dialogService)
3737
/// </summary>
3838
public override Task Execute()
3939
{
40-
return dialogService.ShowLoginDialog();
40+
return dialogService.Value.ShowLoginDialog();
4141
}
4242
}
4343
}

src/GitHub.VisualStudio/Commands/CreateGistCommand.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@ namespace GitHub.VisualStudio.Commands
1414
[Export(typeof(ICreateGistCommand))]
1515
public class CreateGistCommand : VsCommand, ICreateGistCommand
1616
{
17-
readonly IDialogService dialogService;
17+
readonly Lazy<IDialogService> dialogService;
1818
readonly Lazy<ISelectedTextProvider> selectedTextProvider;
1919

2020
[ImportingConstructor]
21-
protected CreateGistCommand(
22-
IDialogService dialogService,
23-
IGitHubServiceProvider serviceProvider)
21+
protected CreateGistCommand(IGitHubServiceProvider serviceProvider)
2422
: base(CommandSet, CommandId)
2523
{
26-
this.dialogService = dialogService;
24+
dialogService = new Lazy<IDialogService>(() => serviceProvider.TryGetService<IDialogService>());
2725
selectedTextProvider = new Lazy<ISelectedTextProvider>(() => serviceProvider.TryGetService<ISelectedTextProvider>());
2826
}
2927

@@ -44,7 +42,7 @@ protected CreateGistCommand(
4442
/// </summary>
4543
public override Task Execute()
4644
{
47-
return dialogService.ShowCreateGist();
45+
return dialogService.Value.ShowCreateGist();
4846
}
4947

5048
protected override void QueryStatus()

0 commit comments

Comments
 (0)