fix: should not use Active to close a running popup.

This commit is contained in:
leo 2024-03-05 17:15:09 +08:00
parent 4b405dfc5f
commit f00ecbd0a1
2 changed files with 6 additions and 18 deletions

View file

@ -21,24 +21,11 @@ namespace SourceGit.ViewModels {
Active.Popup = popup; Active.Popup = popup;
} }
public static async void ShowAndStartPopup(Popup popup) { public static void ShowAndStartPopup(Popup popup) {
popup.HostPageId = Active.GetId(); var dumpPage = Active;
Active.Popup = popup; popup.HostPageId = dumpPage.GetId();
dumpPage.Popup = popup;
if (!popup.Check()) return; dumpPage.ProcessPopup();
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 virtual string GetId() { public virtual string GetId() {

View file

@ -282,6 +282,7 @@
</StackPanel> </StackPanel>
<TextBlock HorizontalAlignment="Stretch" <TextBlock HorizontalAlignment="Stretch"
TextWrapping="Wrap" TextWrapping="Wrap"
FontSize="12"
FontStyle="Italic" FontStyle="Italic"
Text="{Binding ProgressDescription}"/> Text="{Binding ProgressDescription}"/>
<ProgressBar Margin="0,8,0,0" <ProgressBar Margin="0,8,0,0"