fix: DispatcherTimer leak in toast, delete-before-toast ordering in PostDraft

This commit is contained in:
2026-04-16 02:15:30 +01:00
parent 1f7f28b3b9
commit 3cef63a472

View File

@@ -778,14 +778,14 @@ public partial class SavedListingsView : UserControl
var draft = _selected.ToListingDraft();
var url = await _ebayListing.PostListingAsync(draft);
ToastUrlText.Text = url;
ShowDraftPostedToast();
var posted = _selected;
_selected = null;
_service?.Delete(posted);
ClearDetail();
RefreshList();
ToastUrlText.Text = url;
ShowDraftPostedToast();
}
catch (Exception ex)
{
@@ -810,7 +810,11 @@ public partial class SavedListingsView : UserControl
private void ShowDraftPostedToast()
{
_toastTimer?.Stop();
if (_toastTimer != null)
{
_toastTimer.Stop();
_toastTimer = null;
}
ToastTranslate.BeginAnimation(System.Windows.Media.TranslateTransform.YProperty, null);
DraftPostedToast.Visibility = Visibility.Visible;
@@ -835,6 +839,7 @@ public partial class SavedListingsView : UserControl
private void DismissToastAnimated()
{
_toastTimer?.Stop();
_toastTimer = null;
var slideOut = new System.Windows.Media.Animation.DoubleAnimation(
0, 60, new Duration(TimeSpan.FromMilliseconds(180)))
{