Skip to content

Commit 915fe63

Browse files
committed
refactor: remove anonymous function in ShowWindow
1 parent 4bfcfb8 commit 915fe63

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/App.axaml.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,9 @@ public static void LogException(Exception ex)
108108
#region Utility Functions
109109
public static void ShowWindow(object data, bool showAsDialog)
110110
{
111-
var impl = (Views.ChromelessWindow target, bool isDialog) =>
112-
{
113-
if (Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime { MainWindow: { } owner })
114-
{
115-
if (isDialog)
116-
target.ShowDialog(owner);
117-
else
118-
target.Show(owner);
119-
}
120-
else
121-
{
122-
target.Show();
123-
}
124-
};
125-
126111
if (data is Views.ChromelessWindow window)
127112
{
128-
impl(window, showAsDialog);
113+
Show(window, showAsDialog);
129114
return;
130115
}
131116

@@ -142,7 +127,22 @@ public static void ShowWindow(object data, bool showAsDialog)
142127
if (window != null)
143128
{
144129
window.DataContext = data;
145-
impl(window, showAsDialog);
130+
Show(window, showAsDialog);
131+
}
132+
}
133+
134+
private static void Show(Views.ChromelessWindow target, bool showAsDialog)
135+
{
136+
if (Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime { MainWindow: { } owner })
137+
{
138+
if (showAsDialog)
139+
target.ShowDialog(owner);
140+
else
141+
target.Show(owner);
142+
}
143+
else
144+
{
145+
target.Show();
146146
}
147147
}
148148

0 commit comments

Comments
 (0)