From f1673cde77f3f194b274b1c55522ccacf8800488 Mon Sep 17 00:00:00 2001 From: tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Date: Fri, 3 Apr 2026 11:37:44 +0300 Subject: [PATCH] Use the Loaded event in view init --- DiscordChatExporter.Gui/Framework/ViewManager.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/DiscordChatExporter.Gui/Framework/ViewManager.cs b/DiscordChatExporter.Gui/Framework/ViewManager.cs index f4d14e95..9fb09266 100644 --- a/DiscordChatExporter.Gui/Framework/ViewManager.cs +++ b/DiscordChatExporter.Gui/Framework/ViewManager.cs @@ -29,15 +29,7 @@ public partial class ViewManager return null; view.DataContext ??= viewModel; - - if (view.IsInitialized) - { - _ = viewModel.InitializeAsync(); - } - else - { - view.Initialized += async (_, _) => await viewModel.InitializeAsync(); - } + view.Loaded += async (_, _) => await viewModel.InitializeAsync(); return view; }