{"id":18875931,"url":"https://github.com/chobbycode/raspberry","last_synced_at":"2026-02-18T00:30:18.319Z","repository":{"id":203508054,"uuid":"708747045","full_name":"ChobbyCode/Raspberry","owner":"ChobbyCode","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-25T11:06:36.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-31T10:03:52.495Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChobbyCode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-23T10:01:45.000Z","updated_at":"2023-10-23T13:07:29.000Z","dependencies_parsed_at":"2023-10-25T13:51:20.656Z","dependency_job_id":null,"html_url":"https://github.com/ChobbyCode/Raspberry","commit_stats":null,"previous_names":["chobbycode/raspberry"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChobbyCode%2FRaspberry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChobbyCode%2FRaspberry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChobbyCode%2FRaspberry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChobbyCode%2FRaspberry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChobbyCode","download_url":"https://codeload.github.com/ChobbyCode/Raspberry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239830309,"owners_count":19704222,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T06:09:49.597Z","updated_at":"2026-02-18T00:30:18.255Z","avatar_url":"https://github.com/ChobbyCode.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raspberry\n\nRaspberry is an easy way to quickly make menus for your next Console Application in c#.\n\n## Getting Started\n\n### Installation\n\nTo download Raspberry, navigate to the NuGet package manager in Visual Studios and search for RaspberryMenus. Click on the one by ChobbyCode, and hit install.\n\n### Creating \n\nTo create a menu in Raspberry, simply create an instance of the Menu class:\n\n```c#\n// You must give it the name of the menu\n\nMenu menu = new Menu(\"PutTheNameOfTheMenuHere\");\n```\n\nTo create an option to add to your menu, you can create a menu option:\n\n\u003e Options should be provided with a name, description and a menu that they will open.\n\n```c#\n// Options require a name, description and an already existing menu to open.\n\nMenuOption newOption = new MenuOption(\"OptionName\", \"OptionDescription\", MenuTheOptionWillOpen);\n```\n\nTo add an option to a menu:\n\n```c#\n// To add it to a menu, type the name of the menu and say addOption and pass in your option.\n\nmenu.AddOption(newOption);\n```\n\nRaspberry also needs to be provided a default menu, and told when to start:\n\n```c#\n// Just pass in an already existing menu\nRasp.SetDefaultMenu(defaultMenu);\nRasp.StartRaspberry();\n```\n\nBelow is a quick demo, that allows you to move between two different menus.\n\n```c#\nusing Raspberry;\nusing Raspberry.Menus;\n\nnamespace Demo\n{\n    public class Program\n    {\n        public static void Main(string[] args)\n        {\n            Menu menu = new Menu(\"main\"); // main menu\n            Menu sec = new Menu(\"second\"); // second menu\n\n            // Create buttons for main menu\n            MenuOption openSec = new MenuOption(\"second\", \"Open the second menu\", sec);\n            menu.AddOption(openSec);\n\n            // Create buttons for second menu\n            MenuOption closeSec = new MenuOption(\"closeSec\", \"Close the second menu\", menu);\n            sec.AddOption(closeSec);\n\n            // Start the menu\n            Rasp.SetDefaultMenu(menu);\n            Rasp.StartRaspberry();\n        }\n    }\n}\n\n```\n\n### Custom Actions\n\nNow, just having menus on your app is no good. You need functionality. Luckily Raspberry has an easy way to add functionality to an option.\n\nInstead of creating a MenuOption, create a MenuAction. Menu actions have event handlers which are called when the window is opened.\n\nBelow is a modified version of the first program to have a MenuAction instead of an MenuOption.\n\n\u003e MenuActions work the same as MenuOptions but require event handlers instead.\n\n```c#\nMenu menu = new Menu(\"main\"); // main menu\nMenu actionMenu = new Menu(\"Action Menu\"); // main menu\n\n// Create buttons for main menu\nMenuOption openSec = new MenuOption(\"second\", \"Open the second menu\", actionMenu);\nmenu.AddOption(openSec);\n\n// Create buttons for second menu\nMenuAction action = new MenuAction(\"Action\", \"Run An Action\", actionMenu);\nactionMenu.AddOption(action);\n\n// When the event handler is called we run the function\naction.onOpen += ActionRunned;\n\n// Start the menu\nRasp.SetDefaultMenu(menu);\nRasp.StartRaspberry();\n```\n\naction.onOpen calls a function called ActionRunned. We can create this function as below.\n\n```c#\npublic static void ActionRunned (object sender, EventArgs e)\n{\n    Console.WriteLine(\"Action Run\");\n    Console.ReadLine();\n}\n```\n\nIn summary, we swapped the MenuOption out for a MenuAction and created a function for it to call when ran.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchobbycode%2Fraspberry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchobbycode%2Fraspberry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchobbycode%2Fraspberry/lists"}