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

Commit 2fc764b

Browse files
committed
Add placeholder initializing and error views
1 parent e9c8db9 commit 2fc764b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/GitHub.VisualStudio/UI/GitHubPane.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,14 @@ public void Initialize(IServiceProvider serviceProvider)
8888
{
8989
if (!initialized)
9090
{
91-
InitializeAsync(serviceProvider).Forget();
91+
InitializeAsync(serviceProvider).Catch(ShowError).Forget();
9292
}
9393
}
9494

9595
async Task InitializeAsync(IServiceProvider serviceProvider)
9696
{
9797
// Allow MEF to initialize its cache asynchronously
98+
ShowInitializing();
9899
var asyncServiceProvider = (IAsyncServiceProvider)GetService(typeof(SAsyncServiceProvider));
99100
await asyncServiceProvider.GetServiceAsync(typeof(SComponentModel));
100101

@@ -104,7 +105,7 @@ async Task InitializeAsync(IServiceProvider serviceProvider)
104105

105106
var factory = provider.GetService<IViewViewModelFactory>();
106107
viewModel = provider.ExportProvider.GetExportedValue<IGitHubPaneViewModel>();
107-
viewModel.InitializeAsync(this).Forget();
108+
viewModel.InitializeAsync(this).Catch(ShowError).Forget();
108109

109110
View = factory.CreateView<IGitHubPaneViewModel>();
110111
View.DataContext = viewModel;
@@ -145,6 +146,16 @@ public override void OnToolWindowCreated()
145146
UpdateSearchHost(pane?.IsSearchEnabled ?? false, pane?.SearchQuery);
146147
}
147148

149+
void ShowInitializing()
150+
{
151+
View = new Label { Content = "Initializing MEF" };
152+
}
153+
154+
void ShowError(Exception e)
155+
{
156+
View = new TextBox { Text = e.ToString() };
157+
}
158+
148159
void UpdateSearchHost(bool enabled, string query)
149160
{
150161
if (SearchHost != null)

0 commit comments

Comments
 (0)