Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions src/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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();
}
}

Expand Down