From f00ecbd0a11535586842acb2843c42df4404ceaa Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 5 Mar 2024 17:15:09 +0800 Subject: [PATCH] fix: should not use Active to close a running popup. --- src/ViewModels/PopupHost.cs | 23 +++++------------------ src/Views/Launcher.axaml | 1 + 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/ViewModels/PopupHost.cs b/src/ViewModels/PopupHost.cs index 1d1cec02..88f4c0c8 100644 --- a/src/ViewModels/PopupHost.cs +++ b/src/ViewModels/PopupHost.cs @@ -21,24 +21,11 @@ namespace SourceGit.ViewModels { Active.Popup = popup; } - public static async void ShowAndStartPopup(Popup popup) { - popup.HostPageId = Active.GetId(); - Active.Popup = popup; - - if (!popup.Check()) return; - - popup.InProgress = true; - var task = popup.Sure(); - if (task != null) { - var finished = await task; - if (finished) { - Active.Popup = null; - } else { - popup.InProgress = false; - } - } else { - Active.Popup = null; - } + public static void ShowAndStartPopup(Popup popup) { + var dumpPage = Active; + popup.HostPageId = dumpPage.GetId(); + dumpPage.Popup = popup; + dumpPage.ProcessPopup(); } public virtual string GetId() { diff --git a/src/Views/Launcher.axaml b/src/Views/Launcher.axaml index ede59c16..fd1d2655 100644 --- a/src/Views/Launcher.axaml +++ b/src/Views/Launcher.axaml @@ -282,6 +282,7 @@