public void LaunchApp(KeyboardApp app) { //Suspend active app if (apps.Count > 0) { apps[apps.Count - 1].OnAppSuspended(); apps[apps.Count - 1].hidden = true; apps[apps.Count - 1].suspended = true; } //Start frame.children.Add(app); apps.Add(app); app.OnAppLaunched(); app.OnAppResumed(); app.suspended = false; }
public void CloseApp(KeyboardApp app) { //Get the index int index = apps.IndexOf(app); //Close it if (!app.suspended) { app.OnAppSuspended(); } app.OnAppClosed(); frame.children.Remove(app); //If this is the active app and there are other apps, open the next one if (apps.Count > 1 && index == apps.Count - 1) { apps[apps.Count - 2].OnAppResumed(); apps[apps.Count - 2].hidden = false; apps[apps.Count - 2].suspended = false; } //Remove this app from the list apps.Remove(app); }