/** * This is called from the 5th loop * It should be used for initializing the application. * > adding pages * > adding components to the pages * > linking logic and animations */ private void InitApplication() { // Set up the target screen TerminalUtils.SetupTextSurfaceForMatrixDisplay(GridTerminalSystem, TARGET_BLOCK_NAME, SURFACE_INDEX, PIXEL_SIZE); // Initialize the application OnScreenApplication = UiFrameworkUtils.InitSingleScreenApplication(GridTerminalSystem, TARGET_BLOCK_NAME, SURFACE_INDEX, RES_X, RES_Y, false) .WithDefaultPostPage((MyOnScreenApplication app) => { // The POST page should disappear after the configured number of frames currFrame++; return(currFrame >= POST_SCREEN_DURATION); }); // Create the main page and add it to the application MyPage MainPage = InitMainPage(); if (INVERT_COLORS) { MainPage.WithInvertedColors(); } OnScreenApplication.AddPage(MainPage); }