public static void WindowClosed(Window sender) { if (Program.Project != null) { if (Program.Project.Window != null) { return; } foreach (Track track in Program.Project.Tracks) { if (track.Window != null) { return; } } } if (sender is PatternWindow) { return; } if (sender is ProjectWindow) { Program.Project = null; SplashWindow.Create(sender); } else if (sender is TrackWindow) { ProjectWindow.Create(sender); } else if (sender is SplashWindow) { Preferences.Window?.Close(); foreach (Launchpad lp in MIDI.Devices) { lp.Window?.Close(); } } }