Skip to content

Commit e4490d8

Browse files
committed
code_review: PR #1314
Signed-off-by: leo <[email protected]>
1 parent 85b223a commit e4490d8

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/App.axaml.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,24 @@ public static void LogException(Exception ex)
107107
#region Utility Functions
108108
public static void ShowWindow(object data, bool showAsDialog)
109109
{
110-
if (data is Views.ChromelessWindow window)
110+
var impl = (Views.ChromelessWindow target, bool isDialog) =>
111111
{
112112
if (Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime { MainWindow: { } owner })
113113
{
114-
if (showAsDialog)
115-
window.ShowDialog(owner);
114+
if (isDialog)
115+
target.ShowDialog(owner);
116116
else
117-
window.Show(owner);
117+
target.Show(owner);
118118
}
119119
else
120-
window.Show();
120+
{
121+
target.Show();
122+
}
123+
};
121124

125+
if (data is Views.ChromelessWindow window)
126+
{
127+
impl(window, showAsDialog);
122128
return;
123129
}
124130

@@ -135,10 +141,7 @@ public static void ShowWindow(object data, bool showAsDialog)
135141
if (window != null)
136142
{
137143
window.DataContext = data;
138-
if (showAsDialog && Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime { MainWindow: { } owner })
139-
window.ShowDialog(owner);
140-
else
141-
window.Show();
144+
impl(window, showAsDialog);
142145
}
143146
}
144147

0 commit comments

Comments
 (0)