From 1b17225ce1b3369c43cc45e9b77cb393d30b956a Mon Sep 17 00:00:00 2001 From: "EU\\amosekr" Date: Tue, 21 Oct 2025 16:22:17 +0530 Subject: [PATCH 1/2] TMToast - Getting exception when click close button #450 --- .../Controls/Toast/TMToastContents.xaml.cs | 16 +++++++++------- .../Trimble.Modus.Components.csproj | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Trimble.Modus.Components/Controls/Toast/TMToastContents.xaml.cs b/Trimble.Modus.Components/Controls/Toast/TMToastContents.xaml.cs index 67666597..ce6c32c2 100644 --- a/Trimble.Modus.Components/Controls/Toast/TMToastContents.xaml.cs +++ b/Trimble.Modus.Components/Controls/Toast/TMToastContents.xaml.cs @@ -154,19 +154,21 @@ private void SetTheme(String toastTheme) } UpdateIconColor(); - } + } + + bool isPopupClosed = false; private void CloseButtonClicked(object sender, EventArgs e) - - { - PopupService.Instance.RemovePageAsync(this, true); - + { + PopupService.Instance.RemovePageAsync(this, true); + isPopupClosed = true; } public void CloseAfterDelay() { Task.Run(async () => { - await Task.Delay(DELAYTIME); - await PopupService.Instance.RemovePageAsync(this, true); + await Task.Delay(DELAYTIME); + if (!isPopupClosed) + await PopupService.Instance.RemovePageAsync(this, true); }); } diff --git a/Trimble.Modus.Components/Trimble.Modus.Components.csproj b/Trimble.Modus.Components/Trimble.Modus.Components.csproj index aa698959..a83f10bf 100644 --- a/Trimble.Modus.Components/Trimble.Modus.Components.csproj +++ b/Trimble.Modus.Components/Trimble.Modus.Components.csproj @@ -27,7 +27,7 @@ True Trimble.Modus.Components Trimble Modus - 1.3.0.2 + 1.3.0.3 Trimble Inc Trimble Inc Trimble.Modus.Components From 88aa368e98bca151be3b5bc9a6f9fe6499106c2f Mon Sep 17 00:00:00 2001 From: "EU\\amosekr" Date: Wed, 22 Oct 2025 10:53:07 +0530 Subject: [PATCH 2/2] Code review comments --- .../Controls/Toast/TMToastContents.xaml.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Trimble.Modus.Components/Controls/Toast/TMToastContents.xaml.cs b/Trimble.Modus.Components/Controls/Toast/TMToastContents.xaml.cs index ce6c32c2..ce6efeb2 100644 --- a/Trimble.Modus.Components/Controls/Toast/TMToastContents.xaml.cs +++ b/Trimble.Modus.Components/Controls/Toast/TMToastContents.xaml.cs @@ -155,19 +155,18 @@ private void SetTheme(String toastTheme) UpdateIconColor(); } - - bool isPopupClosed = false; + private void CloseButtonClicked(object sender, EventArgs e) - { - PopupService.Instance.RemovePageAsync(this, true); - isPopupClosed = true; + { + if (PopupService.Instance.PopupStack.Contains(this)) + PopupService.Instance.RemovePageAsync(this, true); } public void CloseAfterDelay() { Task.Run(async () => { await Task.Delay(DELAYTIME); - if (!isPopupClosed) + if (PopupService.Instance.PopupStack.Contains(this)) await PopupService.Instance.RemovePageAsync(this, true); }); }