From edef88875a0b6c3a7d18d3cfadc56491aac66ee3 Mon Sep 17 00:00:00 2001 From: Felipe da Conceicao Guimaraes Date: Thu, 28 Mar 2024 13:35:59 -0700 Subject: [PATCH 1/4] Unsubscribing when unloading --- .../DevHome.Dashboard/Views/DashboardView.xaml.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs b/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs index d2e00aa537..dc08e13921 100644 --- a/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs +++ b/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs @@ -119,6 +119,16 @@ private async Task OnLoadedAsync() private void OnUnloaded() { Application.Current.GetService().RendererUpdated -= HandleRendererUpdated; + + UnsubscribeFromWidgets(); + } + + private void UnsubscribeFromWidgets() + { + foreach (var widget in PinnedWidgets) + { + widget.UnsubscribeFromWidgetUpdates(); + } } private async Task InitializeDashboard() @@ -656,10 +666,7 @@ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) Log.Logger()?.ReportDebug("DashboardView", $"Leaving Dashboard, deactivating widgets."); // Deactivate widgets if we're not on the Dashboard. - foreach (var widget in PinnedWidgets) - { - widget.UnsubscribeFromWidgetUpdates(); - } + UnsubscribeFromWidgets(); } public void Dispose() From c697d0aa595ee609e13be3c56f2689d55285d7ab Mon Sep 17 00:00:00 2001 From: Felipe da Conceicao Guimaraes Date: Thu, 28 Mar 2024 14:51:25 -0700 Subject: [PATCH 2/4] Removing OnNavigatingFrom call --- .../DevHome.Dashboard/Views/DashboardView.xaml.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs b/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs index dc08e13921..1c4e70e4f4 100644 --- a/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs +++ b/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs @@ -120,6 +120,7 @@ private void OnUnloaded() { Application.Current.GetService().RendererUpdated -= HandleRendererUpdated; + Log.Logger()?.ReportDebug("DashboardView", $"Leaving Dashboard, deactivating widgets."); UnsubscribeFromWidgets(); } @@ -661,14 +662,6 @@ private async void WidgetControl_Drop(object sender, DragEventArgs e) Log.Logger()?.ReportDebug("DashboardView", $"Drop ended"); } - protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) - { - Log.Logger()?.ReportDebug("DashboardView", $"Leaving Dashboard, deactivating widgets."); - - // Deactivate widgets if we're not on the Dashboard. - UnsubscribeFromWidgets(); - } - public void Dispose() { Dispose(disposing: true); From 5e8efb08833b2b8e48c3f6e59ef97fbb496e2700 Mon Sep 17 00:00:00 2001 From: Felipe da Conceicao Guimaraes Date: Fri, 29 Mar 2024 11:45:41 -0700 Subject: [PATCH 3/4] Making Unloaded async --- .../Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs b/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs index 1c4e70e4f4..5cddd814a2 100644 --- a/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs +++ b/tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs @@ -116,12 +116,13 @@ private async Task OnLoadedAsync() } [RelayCommand] - private void OnUnloaded() + private async Task OnUnloadedAsync() { Application.Current.GetService().RendererUpdated -= HandleRendererUpdated; Log.Logger()?.ReportDebug("DashboardView", $"Leaving Dashboard, deactivating widgets."); - UnsubscribeFromWidgets(); + + await Task.Run(() => UnsubscribeFromWidgets()); } private void UnsubscribeFromWidgets() From 3df958d2486c50d0ba37e99383261275e868b640 Mon Sep 17 00:00:00 2001 From: Felipe da Conceicao Guimaraes Date: Mon, 1 Apr 2024 13:45:01 -0700 Subject: [PATCH 4/4] Adding automation properties name to baseline banner view --- common/Views/Banner.xaml | 1 + 1 file changed, 1 insertion(+) diff --git a/common/Views/Banner.xaml b/common/Views/Banner.xaml index 214c91df0d..f0762b842a 100644 --- a/common/Views/Banner.xaml +++ b/common/Views/Banner.xaml @@ -5,6 +5,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:commonviews="using:DevHome.Common.Views" + AutomationProperties.Name="{x:Bind Title}" mc:Ignorable="d">