public void Post([FromBody] MENUS value) { if (ModelState.IsValid) { _repo.Incluir(value); } }
public IActionResult Put(int id, [FromBody] MENUS value) { if (ModelState.IsValid) { _repo.Alterar(id, value); return(Ok()); //200 } return(BadRequest()); }
private string Update(HttpContext context) { MENUS m = new MENUS(); m.ID = Convert.ToInt32(context.Request.Params["ID"]); m.NAME = context.Request.Params["NAME"]; m.URL = context.Request.Params["URLS"]; m.ORDERS = Convert.ToInt32(context.Request.Params["ORDERS"]); m.FATHERID = Convert.ToInt32(context.Request.Params["FATHERID"]); return(mb.Update(m).ToString()); }
private string Insert(HttpContext context) { MENUS m = new MENUS(); m.ID = menusm.GetSequence(); m.NAME = context.Request.Params["NAME"]; m.URL = context.Request.Params["URLS"]; m.ORDERS = Convert.ToInt32(context.Request.Params["ORDERS"]); m.FATHERID = Convert.ToInt32(context.Request.Params["FATHERID"]); return(mb.Add(m).ToString()); }
public static void Menu() { MENUS helpmenu = new MENUS(5); helpmenu[0] = new MENU("Test &1 \t1", NULL, NULL, D_DISABLED, NULL); helpmenu[1] = new MENU("Test &2 \t2", d_check_callback, NULL, D_SELECTED, NULL); helpmenu[2] = new MENU("", NULL, NULL, 0, NULL); helpmenu[3] = new MENU("&Quit \tq/Esc", NULL, NULL, 0, NULL); helpmenu[4] = new MENU(null, NULL, NULL, 0, NULL); int ret = do_menu(helpmenu, 10, 10); }
public void SetActiveMenu(MENUS selectedMenu) { StartGameMenu.SetActive(selectedMenu == MENUS.MAINMENU); JoinGameMenu.SetActive(selectedMenu == MENUS.LOCALGAMES); SelectLevelMenu.SetActive(selectedMenu == MENUS.SELECTLEVEL); ConfirmationMenu.SetActive(selectedMenu == MENUS.CONFIRMATION); //TODO I am using this hack to set the first selected item after changing // menus. There must be a better way to do this. try { GameObject nextButton = GetComponentInChildren <Button>().gameObject; EventSystem es = GetComponentInChildren <EventSystem>(); es.SetSelectedGameObject(null); es.SetSelectedGameObject(nextButton); } catch { } }
//Menus public void MenuMain() { char menuItem; Console.Clear(); string date = DateTime.Today.ToShortDateString(); Console.WriteLine("Welcome to Console Calculator!\nThe current date is: " + date + "\n\nWhat can I do for you today?"); Console.WriteLine(); Console.WriteLine("[1] Math Expression"); Console.WriteLine("[2] Base Conversions"); Console.WriteLine("[3] Logic Gate Solver"); Console.WriteLine("[4] Shooter/Target Solver"); Console.WriteLine(); Console.WriteLine("[0] Close Console Calculator"); menuItem = char.ToLower(Console.ReadKey().KeyChar); switch (menuItem) { case '1': menu = MENUS.MDEC; break; case '2': menu = MENUS.MCON; break; case '3': menu = MENUS.MLGS; break; case '4': menu = MENUS.MSTS; break; case '0': Environment.Exit(0); break; } }
public void SetActiveMenu(MENUS selectedMenu) { if (PauseGameMenu) { PauseGameMenu.SetActive(selectedMenu == MENUS.PAUSEMENU); } if (ConfirmationMenu) { ConfirmationMenu.SetActive(selectedMenu == MENUS.CONFIRMATION); } if (ShipSelectMenu) { ShipSelectMenu.SetActive(selectedMenu == MENUS.SHIPSELECT); } if (TeamSelectMenu) { TeamSelectMenu.SetActive(selectedMenu == MENUS.TEAMSELECT); } if (GameEndMenu) { GameEndMenu.SetActive(selectedMenu == MENUS.GAMEEND); } try { if (MENUS.NONE != selectedMenu) { GameObject nextButton = GetComponentInChildren <Button>().gameObject; EventSystem es = GetComponentInChildren <EventSystem>(); es.SetSelectedGameObject(null); es.SetSelectedGameObject(nextButton); } } catch (Exception e) { Debug.Log(e.Message); } }
public void MenuDecimal() { bool oktogo = false; char menuItem; while (!oktogo) { oktogo = true; Console.Clear(); Console.WriteLine("You are now in the Decimal Math section. Select an option below."); Console.WriteLine(); Console.WriteLine("[1] Enter Expressions"); Console.WriteLine("[2] Decimal to Binary Conversion"); Console.WriteLine("[3] Decimal to Hexadecimal Conversion"); Console.WriteLine(); Console.WriteLine("[~] Back to Main Menu"); menuItem = char.ToLower(Console.ReadKey().KeyChar); switch (menuItem) { case '1': menu = MENUS.MDEC1; break; case '2': menu = MENUS.MDEC2; break; case '3': menu = MENUS.MDEC3; break; case '`': menu = MENUS.MMAIN; break; } } }
public void SetActiveMenu(MENUS selectedMenu) { if (PauseGameMenu) PauseGameMenu.SetActive(selectedMenu == MENUS.PAUSEMENU); if (ConfirmationMenu) ConfirmationMenu.SetActive(selectedMenu == MENUS.CONFIRMATION); if (ShipSelectMenu) ShipSelectMenu.SetActive(selectedMenu == MENUS.SHIPSELECT); if (TeamSelectMenu) TeamSelectMenu.SetActive(selectedMenu == MENUS.TEAMSELECT); if (GameEndMenu) GameEndMenu.SetActive(selectedMenu == MENUS.GAMEEND); try { if (MENUS.NONE != selectedMenu) { GameObject nextButton = GetComponentInChildren<Button>().gameObject; EventSystem es = GetComponentInChildren<EventSystem>(); es.SetSelectedGameObject(null); es.SetSelectedGameObject(nextButton); } } catch (Exception e) { Debug.Log(e.Message); } }
public void MenuDecimalExpression() { bool oktogo = false; while (!oktogo) { Console.Clear(); Console.WriteLine("Enter expressions below:\nType ESC to go back."); Console.WriteLine(); string playerInput2 = Console.ReadLine(); if (playerInput2 == "ESC") { oktogo = true; menu = MENUS.MDEC; } else { DataTable table = new DataTable(); var answer = table.Compute(playerInput2, ""); Console.WriteLine(answer); Console.ReadKey(); } } }
//Setters public void SetMenu(MENUS newMen) { menu = newMen; }
static int Main(string[] argv) { // /* the submenu */ MENUS submenu = new MENUS(5); submenu[0] = new MENU("Submenu", NULL, NULL, D_DISABLED, NULL); submenu[1] = new MENU("", NULL, NULL, 0, NULL); submenu[2] = new MENU("Checked", check_callback, NULL, D_SELECTED, NULL); submenu[3] = new MENU("Disabled", NULL, NULL, D_DISABLED, NULL); submenu[4] = new MENU(null, NULL, NULL, 0, NULL); /* the first menu in the menubar */ MENUS menu1 = new MENUS(4); menu1[0] = new MENU("Test &1 \t1", menu_callback, NULL, 0, NULL); menu1[1] = new MENU("Test &2 \t2", menu_callback, NULL, 0, NULL); menu1[2] = new MENU("&Quit \tq/Esc", Marshal.GetFunctionPointerForDelegate(d_quit), NULL, 0, NULL); menu1[3] = new MENU(null, NULL, NULL, 0, NULL); /* the second menu in the menubar */ MENUS menu2 = new MENUS(3); menu2[0] = new MENU("&Test", menu_callback, NULL, 0, NULL); menu2[1] = new MENU("&Submenu", NULL, submenu, 0, NULL); menu2[2] = new MENU(null, NULL, NULL, 0, NULL); /* the help menu */ MENUS helpmenu = new MENUS(2); helpmenu[0] = new MENU("&About \tF1", Marshal.GetFunctionPointerForDelegate(d_about), NULL, 0, NULL); helpmenu[1] = new MENU(null, NULL, NULL, 0, NULL); /* the main menu-bar */ MENUS the_menu = new MENUS(4); the_menu[0] = new MENU("&First", NULL, menu1, 0, NULL); the_menu[1] = new MENU("&Second", NULL, menu2, 0, NULL); the_menu[2] = new MENU("&Help", NULL, helpmenu, 0, NULL); the_menu[3] = new MENU(null, NULL, NULL, 0, NULL); the_dialog[0] = new DIALOG(d_clear_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL); /* these just display text, either left aligned, centered, or right aligned */ the_dialog[1] = new DIALOG("d_text_proc", 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_text_proc"), NULL, NULL); the_dialog[2] = new DIALOG("d_ctext_proc", 318, 20, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_ctext_proc"), NULL, NULL); the_dialog[3] = new DIALOG("d_rtext_proc", 636, 20, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_rtext_proc"), NULL, NULL); ///* lots of descriptive text elements */ the_dialog[4] = new DIALOG("d_text_proc", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_menu_proc->"), NULL, NULL); the_dialog[5] = new DIALOG("d_text_proc", 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_button_proc->"), NULL, NULL); the_dialog[6] = new DIALOG("d_text_proc", 0, 70, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_check_proc->"), NULL, NULL); the_dialog[7] = new DIALOG("d_text_proc", 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_radio_proc->"), NULL, NULL); the_dialog[8] = new DIALOG("d_text_proc", 0, 130, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_edit_proc->"), NULL, NULL); the_dialog[9] = new DIALOG("d_text_proc", 0, 150, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_list_proc->"), NULL, NULL); the_dialog[10] = new DIALOG("d_text_proc", 0, 200, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_text_list_proc->"), NULL, NULL); the_dialog[11] = new DIALOG("d_text_proc", 0, 250, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_textbox_proc->"), NULL, NULL); the_dialog[12] = new DIALOG("d_text_proc", 0, 300, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_slider_proc->"), NULL, NULL); the_dialog[13] = new DIALOG("d_text_proc", 0, 330, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_box_proc->"), NULL, NULL); the_dialog[14] = new DIALOG("d_text_proc", 0, 360, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_shadow_box_proc->"), NULL, NULL); the_dialog[15] = new DIALOG("d_text_proc", 0, 390, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_keyboard_proc. Press F1 to see me trigger the about box."), NULL, NULL); the_dialog[16] = new DIALOG("d_text_proc", 0, 410, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_clear_proc. I draw the white background."), NULL, NULL); the_dialog[17] = new DIALOG("d_text_proc", 0, 430, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("d_yield_proc. I make us play nice with the OS scheduler."), NULL, NULL); the_dialog[18] = new DIALOG("d_rtext_proc", 636, 40, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("<-d_bitmap_proc"), NULL, NULL); the_dialog[19] = new DIALOG("d_rtext_proc", 636, 80, 0, 0, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi("<-d_icon_proc"), NULL, NULL); ///* a menu bar - note how it auto-calculates its dimension if they are not given */ the_dialog[20] = new DIALOG("d_menu_proc", 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, the_menu, NULL, NULL); ///* some more GUI elements, all of which require you to specify their dimensions */ the_dialog[21] = new DIALOG("d_button_proc", 160, 40, 160, 20, 0, 0, 't', 0, 0, 0, Marshal.StringToCoTaskMemAnsi("&Toggle Me!"), NULL, NULL); the_dialog[22] = new DIALOG("d_check_proc", 160, 70, 160, 20, 0, 0, 'c', 0, 0, 0, Marshal.StringToCoTaskMemAnsi("&Check Me!"), NULL, NULL); the_dialog[23] = new DIALOG("d_radio_proc", 160, 100, 160, 19, 0, 0, 's', 0, 0, 0, Marshal.StringToCoTaskMemAnsi("&Select Me!"), NULL, NULL); the_dialog[24] = new DIALOG("d_radio_proc", 320, 100, 160, 19, 0, 0, 'o', 0, 0, 0, Marshal.StringToCoTaskMemAnsi("&Or Me!"), NULL, NULL); the_dialog[25] = new DIALOG("d_edit_proc", 160, 130, 160, 8, 0, 0, 0, 0, LEN, 0, Marshal.StringToCoTaskMemAnsi(the_string), NULL, NULL); the_dialog[26] = new DIALOG("d_list_proc", 160, 150, 160, 44, 0, 0, 0, 0, 0, 0, Marshal.GetFunctionPointerForDelegate(d_listbox_getter), sel, NULL); the_dialog[27] = new DIALOG("d_text_list_proc", 160, 200, 160, 44, 0, 0, 0, 0, 0, 0, Marshal.GetFunctionPointerForDelegate(d_listbox_getter), NULL, NULL); the_dialog[28] = new DIALOG("d_textbox_proc", 160, 250, 160, 48, 0, 0, 0, 0, 0, 0, Marshal.StringToCoTaskMemAnsi(the_text), NULL, NULL); the_dialog[29] = new DIALOG("d_slider_proc", 160, 300, 160, 12, 0, 0, 0, 0, 100, 0, NULL, NULL, NULL); the_dialog[30] = new DIALOG("d_box_proc", 160, 330, 160, 20, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL); the_dialog[31] = new DIALOG("d_shadow_box_proc", 160, 360, 160, 20, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL); ///* note how we don't fill in the dp field yet, because we first need to load the bitmap */ the_dialog[32] = new DIALOG("d_bitmap_proc", 480, 40, 30, 30, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL); the_dialog[33] = new DIALOG("d_icon_proc", 480, 80, 30, 30, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL); ///* the quit and info buttons use our customized dialog procedure, using dp3 as callback */ the_dialog[34] = new DIALOG(d_my_button_proc, 0, 450, 160, 20, 0, 0, 'q', D_EXIT, 0, 0, Marshal.StringToCoTaskMemAnsi("&Quit"), NULL, Marshal.GetFunctionPointerForDelegate(d_quit)); the_dialog[35] = new DIALOG(d_my_button_proc, 400, 150, 160, 20, 0, 0, 'i', D_EXIT, 0, 0, Marshal.StringToCoTaskMemAnsi("&Info"), NULL, Marshal.GetFunctionPointerForDelegate(d_info1)); the_dialog[36] = new DIALOG(d_my_button_proc, 400, 200, 160, 20, 0, 0, 'n', D_EXIT, 0, 0, Marshal.StringToCoTaskMemAnsi("I&nfo"), NULL, Marshal.GetFunctionPointerForDelegate(d_info2)); the_dialog[37] = new DIALOG(d_my_button_proc, 400, 300, 160, 20, 0, 0, 'f', D_EXIT, 0, 0, Marshal.StringToCoTaskMemAnsi("In&fo"), NULL, Marshal.GetFunctionPointerForDelegate(d_info3)); ///* the next two elements don't draw anything */ the_dialog[38] = new DIALOG("d_keyboard_proc", 0, 0, 0, 0, 0, 0, 0, 0, KEY_F1, 0, Marshal.GetFunctionPointerForDelegate(d_about), NULL, NULL); the_dialog[39] = new DIALOG("d_yield_proc", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL); the_dialog[the_dialog.Length - 1] = new DIALOG(NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL); //char buf[256]; byte[] buf = new byte[256]; int i; /* initialise everything */ if (allegro_init() != 0) { return(1); } install_keyboard(); install_mouse(); install_timer(); if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) != 0) { if (set_gfx_mode(GFX_SAFE, 640, 480, 0, 0) != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message(string.Format("Unable to set any graphic mode\n{0}\n", allegro_error)); return(1); } } /* load the datafile */ //replace_filename(buf, argv[0], "example.dat", sizeof(buf)); //datafile = load_datafile(buf); replace_filename(buf, "./", "example.dat", buf.Length); datafile = load_datafile(Encoding.ASCII.GetString(buf)); if (!datafile) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message(string.Format("Error loading {0}!\n", buf)); return(1); } set_palette(datafile[THE_PALETTE].dat); /* set up colors */ gui_fg_color = makecol(0, 0, 0); gui_mg_color = makecol(128, 128, 128); gui_bg_color = makecol(200, 240, 200); set_dialog_color(the_dialog, gui_fg_color, gui_bg_color); /* white color for d_clear_proc and the d_?text_procs */ the_dialog[0].bg = makecol(255, 255, 255); for (i = 4; the_dialog[i].proc != NULL; i++) { if (the_dialog[i].proc == GetAddress("d_text_proc") || the_dialog[i].proc == GetAddress("d_ctext_proc") || the_dialog[i].proc == GetAddress("d_rtext_proc")) { the_dialog[i].bg = the_dialog[0].bg; } } /* fill in bitmap pointers */ the_dialog[BITMAP_OBJECT].dp = datafile[SILLY_BITMAP].dat; the_dialog[ICON_OBJECT].dp = datafile[SILLY_BITMAP].dat; /* shift the dialog 2 pixels away from the border */ position_dialog(the_dialog, 2, 2); /* do the dialog */ do_dialog(the_dialog, -1); unload_datafile(datafile); return(0); }
public void SetActiveMenu(MENUS selectedMenu) { StartGameMenu.SetActive(selectedMenu == MENUS.MAINMENU); JoinGameMenu.SetActive(selectedMenu == MENUS.LOCALGAMES); SelectLevelMenu.SetActive(selectedMenu == MENUS.SELECTLEVEL); ConfirmationMenu.SetActive(selectedMenu == MENUS.CONFIRMATION); //TODO I am using this hack to set the first selected item after changing // menus. There must be a better way to do this. try { GameObject nextButton = GetComponentInChildren<Button>().gameObject; EventSystem es = GetComponentInChildren<EventSystem>(); es.SetSelectedGameObject(null); es.SetSelectedGameObject(nextButton); } catch { } }