diff --git a/src/App.axaml.cs b/src/App.axaml.cs index 231936693..0468beab3 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -108,24 +108,9 @@ public static void LogException(Exception ex) #region Utility Functions public static void ShowWindow(object data, bool showAsDialog) { - var impl = (Views.ChromelessWindow target, bool isDialog) => - { - if (Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime { MainWindow: { } owner }) - { - if (isDialog) - target.ShowDialog(owner); - else - target.Show(owner); - } - else - { - target.Show(); - } - }; - if (data is Views.ChromelessWindow window) { - impl(window, showAsDialog); + Show(window, showAsDialog); return; } @@ -142,7 +127,22 @@ public static void ShowWindow(object data, bool showAsDialog) if (window != null) { window.DataContext = data; - impl(window, showAsDialog); + Show(window, showAsDialog); + } + } + + private static void Show(Views.ChromelessWindow target, bool showAsDialog) + { + if (Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime { MainWindow: { } owner }) + { + if (showAsDialog) + target.ShowDialog(owner); + else + target.Show(owner); + } + else + { + target.Show(); } }