ConsoleMenuDN 0.0.7

There is a newer version of this package available.
See the version list below for details.
dotnet add package ConsoleMenuDN --version 0.0.7
                    
NuGet\Install-Package ConsoleMenuDN -Version 0.0.7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ConsoleMenuDN" Version="0.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ConsoleMenuDN" Version="0.0.7" />
                    
Directory.Packages.props
<PackageReference Include="ConsoleMenuDN" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ConsoleMenuDN --version 0.0.7
                    
#r "nuget: ConsoleMenuDN, 0.0.7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ConsoleMenuDN@0.0.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ConsoleMenuDN&version=0.0.7
                    
Install as a Cake Addin
#tool nuget:?package=ConsoleMenuDN&version=0.0.7
                    
Install as a Cake Tool

ConsoleMenuDN

ConsoleMenuDN is a helper library for creating interactive menus within console applications. This library simplifies the process of building and managing console-based menus, making it easier to create user-friendly command-line interfaces.

Features

  • Easy-to-use API for creating console menus.
  • Support for asynchronous menu actions.
  • Automatic handling of key inputs (navigation, selection).
  • Responsive to console window resize events.

Installation

You can install the ConsoleMenuDN package via NuGet:

dotnet add package ConsoleMenuDN

Usage

Basic Example

Here's a simple example of how to use ConsoleMenuDN to create a console menu:

using ConsoleMenuDN;

class Program
{
    static async Task Main(string[] args)
    {
        var menuOptions = new List<MenuOption>
        {
            new MenuOption("Option 1", async () => await Task.Run(() => Console.WriteLine("Option 1 selected"))),
            new MenuOption("Option 2", async () => await Task.Run(() => Console.WriteLine("Option 2 selected"))),
            new MenuOption("Exit", async () => Environment.Exit(0))
        };

        var menu = new MenuManager(menuOptions, "Main Menu");
        menu.Show();
    }
}

Creating Menu Options

Menu options can be created by instantiating the MenuOption class. Each option requires a name and an action to perform when selected:

var option = new MenuOption("Option 1", async () => await Task.Run(() => Console.WriteLine("Option 1 selected")));

Displaying the Menu

To display the menu, create an instance of MenuManager and call the Show method:

var menu = new MenuManager(menuOptions, "Main Menu");
menu.Show();

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.6 245 6/23/2024
0.1.5 150 6/23/2024
0.1.4 177 6/19/2024
0.1.3 179 6/19/2024
0.1.2 177 6/19/2024
0.1.1 159 6/19/2024
0.0.8 156 6/19/2024
0.0.7 156 6/19/2024
0.0.6 142 6/19/2024
0.0.5 163 6/19/2024
0.0.4 172 6/19/2024
0.0.3 174 6/19/2024
0.0.2 163 6/19/2024
0.0.1 162 6/19/2024