From 2a57646d6be4ddc0b27e249fa7fbe47fead7091d Mon Sep 17 00:00:00 2001 From: Kristen Schau <47155823+krschau@users.noreply.github.com> Date: Mon, 12 Feb 2024 17:31:37 -0500 Subject: [PATCH] show error when subscribe to widget catalog events fails --- .../Views/DashboardView.xaml.cs | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs b/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs index e7021eead8..2338b0cdcf 100644 --- a/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs +++ b/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs @@ -120,19 +120,25 @@ private async Task InitializeDashboard() if (ViewModel.WidgetHostingService.CheckForWidgetServiceAsync()) { ViewModel.HasWidgetService = true; - await SubscribeToWidgetCatalogEventsAsync(); + if (await SubscribeToWidgetCatalogEventsAsync()) + { + // Cache the widget icons before we display the widgets, since we include the icons in the widgets. + await ViewModel.WidgetIconService.CacheAllWidgetIconsAsync(); - // Cache the widget icons before we display the widgets, since we include the icons in the widgets. - await ViewModel.WidgetIconService.CacheAllWidgetIconsAsync(); + var isFirstDashboardRun = !(await _localSettingsService.ReadSettingAsync(WellKnownSettingsKeys.IsNotFirstDashboardRun)); + Log.Logger()?.ReportInfo("DashboardView", $"Is first dashboard run = {isFirstDashboardRun}"); + if (isFirstDashboardRun) + { + await Application.Current.GetService().SaveSettingAsync(WellKnownSettingsKeys.IsNotFirstDashboardRun, true); + } - var isFirstDashboardRun = !(await _localSettingsService.ReadSettingAsync(WellKnownSettingsKeys.IsNotFirstDashboardRun)); - Log.Logger()?.ReportInfo("DashboardView", $"Is first dashboard run = {isFirstDashboardRun}"); - if (isFirstDashboardRun) + await InitializePinnedWidgetListAsync(isFirstDashboardRun); + } + else { - await Application.Current.GetService().SaveSettingAsync(WellKnownSettingsKeys.IsNotFirstDashboardRun, true); + Log.Logger()?.ReportError("DashboardView", $"Catalog event subscriptions failed, show error"); + RestartDevHomeMessageStackPanel.Visibility = Visibility.Visible; } - - await InitializePinnedWidgetListAsync(isFirstDashboardRun); } else {