int main() { int input; PrintGreeting(); /*Unless 4 is selected, restart program Does this work?*/ do { DisplayMainMenu(); input = GetValidInt(1, 4); /*Main Menu Options select*/ switch (input) { case 1: ConvertTime(); break; case 2: ConvertCurrency(); break; case 3: ConvertTemp(); break; default: break; } }while(input !=4); return 0; }
EFI_STATUS SctMenu ( VOID ) /*++ Routine Description: Build the menu system Returns: EFI_SUCCESS - Build the menu system successfully Other Value - Somthing failed --*/ { EFI_STATUS Status; INTN Mode; // // Get the cols and rows of the displayed screen // ST->ConOut->QueryMode ( ST->ConOut, (UINTN)ST->ConOut->Mode->Mode, &mCols, &mRows ); Mode = ST->ConOut->Mode->Mode; if (ST->ConOut->Mode->Mode != 0) { Status = ST->ConOut->SetMode (ST->ConOut, 0); if (EFI_ERROR (Status)) { Print (L"Bug and SCT can't execute: Simple Text Output Protocol should support Mode 0 ! \n"); return Status; } ST->ConOut->QueryMode ( ST->ConOut, (UINTN)ST->ConOut->Mode->Mode, &mCols, &mRows ); } InitializeTestFrameworkUi (&Mode); // // Display the main menu // DisplayMainMenu (); TestFrameworkUiRestore (); return EFI_SUCCESS; }
TInt CActiveConsole::RunError(TInt aError) /** * Called by the Active Scheduler when a RunL in this active object leaves. */ { // This actually happens when a test object fails to construct properly. Write(_L8("Error creating test object: %d"), aError); iInputBuffer = KNullDesC8(); DisplayMainMenu(); // It's OK to carry on with the program itself, so repost asynchronous // request. RequestCharacter(); return KErrNone; }
void main(void) { char choice; //Declare Variables int i = 0; BOOLEAN quit = FALSE; FIRST = NULL; //Initialize variables LAST = NULL; for(i = 0; i < 256; i++) InitializeRec(&array[i]); filename[0] = '\0'; i = 0; do //menu open until quit = TRUE { choice = DisplayMainMenu(); //Display Main Menu and Get Main Menu Choice switch(choice) //Menu swithc { case 'o': OpenData(); break; case 'a': AddRec(); break; case 's': SearchData(); break; case 'b': BrowseData(); break; case 'd': printf("\nDelete Record\n"); break; case 'c': CloseData(); break; case 'q': quit = QuitProgram(); break; default: printf("\nError\nPlease enter a valid response.\n"); break; } }while(!quit); return; //Exit the program. }
//------------ //Main Program //------------ int main(void) { Initialization(); Info_Msg = MemString(Info_Msg, "Ncurses initialized\n"); SplashScreen(); Info_Msg = MemString(Info_Msg, "SplashScreen displayed\n"); ScreenBorderSetup(); if ((MaxRows <= 19) & (MaxCols <= 58) | (MaxRows <= 19) | (MaxCols <= 30)) { free(Info_Msg); endwin(); return(0); } Info_Msg = MemString(Info_Msg, "ScreenBorderSetup\n"); ScreenWindowSetup(); Info_Msg = MemString(Info_Msg, "Windows Initialized\n"); InfoLineCounter(); InfoScroller(); wprintw(MainWin, "The Main Window"); wrefresh(MainWin); mvwprintw(StatusWin, 0, COLS - 43, "Window: Menu | "); wrefresh(StatusWin); DisplayMainMenu(HighlightedChoice); ChoiceSelection(); free(Info_Msg); End(); return 0; }
void CActiveConsole::DoActionKeyL(TKeyCode aKeyCode) { OstTraceFunctionEntry0( CACTIVECONSOLE_DOACTIONKEYL_ENTRY ); WriteNoReturn(_L8("%c"), aKeyCode); // Examine the key that just came in. switch ( TUint(aKeyCode) ) { case EKeyEscape: { Write(_L8("Exiting")); CActiveScheduler::Stop(); OstTraceFunctionExit0( CACTIVECONSOLE_DOACTIONKEYL_EXIT ); return; } case EKeyEnter: // Tell the test about what's in the buffer so far, if anything. Write(_L8("You entered \'%S\'"), &iInputBuffer); switch ( iInputBuffer.Length() ) { case 0: // Don't pass anything on- nothing to pass on. break; case 1: if ( iInputBuffer == _L8("S") || iInputBuffer == _L8("s") ) { StopCurrentTest(); } else { // Tell the test via the old 'single character' interface. // If there is a test, then let it process the key. If there isn't a // test, we process it to (possibly) create and run a new test object. if ( iTest ) { TRAPD(err, iTest->ProcessKeyL((TKeyCode)iInputBuffer[0])); if ( err ) { Write(_L8("CTestBase::ProcessKeyL left with %d"), err); StopCurrentTest(); } } else { SelectTestL(); } } iInputBuffer = KNullDesC8(); break; default: // Tell the test via the new 'multi character' interface. // If there is a test, then let it process the key. If there isn't a // test, we process it to (possibly) create and run a new test object. if ( iTest ) { TRAPD(err, iTest->ProcessKeyL(iInputBuffer)); if ( err ) { Write(_L8("CTestBase::ProcessKeyL left with %d"), err); StopCurrentTest(); } } else { SelectTestL(); } iInputBuffer = KNullDesC8(); break; } DisplayMainMenu(); break; default: iInputBuffer.Append(aKeyCode); break; } OstTraceFunctionExit0( DUP1_CACTIVECONSOLE_DOACTIONKEYL_EXIT ); }