namespace BeatBooth.Classes.Pages{ public abstract class EnginePage : Page { public abstract void open(); public abstract void close(); public static EnginePage currentPage { get; private set; } public static void SwitchPage<T>() where T : EnginePage, new() { if (currentPage != null) { currentPage.close(); } var newPage = new T(); currentPage = newPage; GameWindow.Viewport.Content = newPage; newPage.open(); } }}
namespace BeatBooth.Classes.Pages{ public partial class GameMainMenu : EnginePage { public GameMainMenu() { InitializeComponent(); } public override void open() { Console.WriteLine("Open"); } public override void close() { Console.WriteLine("Close"); } }}