diff --git a/README.md b/README.md index 307df9f9fb..803d3e698a 100644 --- a/README.md +++ b/README.md @@ -35,19 +35,123 @@ dotnet run * [API Documentation](https://gui-cs.github.io/Terminal.GuiV2Docs/api/Terminal.Gui.html) * [Documentation Home](https://gui-cs.github.io/Terminal.GuiV2Docs) +_The Documentation matches the most recent Nuget release from the `v2_develop` branch. The documentation for v1 is here: ([![Version](https://img.shields.io/nuget/v/Terminal.Gui.svg)](https://www.nuget.org/packages/Terminal.Gui))_ + +See the [`Terminal.Gui/` README](https://github.com/gui-cs/Terminal.Gui/tree/master/Terminal.Gui) for an overview of how the library is structured. + ## Showcase & Examples -* **[UI Catalog](./UICatalog/README.md)** - The UI Catalog project provides an easy to use and extend sample illustrating the capabilities of **Terminal.Gui**. Run `dotnet run --project UICatalog` to run the UI Catalog. -* **[C# Example](./Example/README.md)** - Run `dotnet run` in the `Example` directory to run the C# Example. -* **[F# Example](./FSharpExample/)** - An example showing how to build a Terminal.Gui app using F#. -* **[Reactive Example](./ReactiveExample/README.md)** - A sample app that shows how to use `System.Reactive` and `ReactiveUI` with `Terminal.Gui`. The app uses the MVVM architecture that may seem familiar to folks coming from WPF, Xamarin Forms, UWP, Avalonia, or Windows Forms. In this app, we implement the data bindings using ReactiveUI `WhenAnyValue` syntax and [Pharmacist](https://github.com/reactiveui/pharmacist) — a tool that converts all events in a NuGet package into observable wrappers. -* **[CommunityToolkit Example](./CommunityToolkitExample/README.md)** - A example of using the `CommunityToolkit.MVVM` framework's `ObservableObject`, `ObservableProperty`, and `IRecipient` in conjunction with `Microsoft.Extensions.DependencyInjection`. -* **[C# SelfContained](./SelfContained/README.md)** - An example showing how to publish a Terminal.Gui app using C# self-contained single file. -* **[PowerShell's `Out-ConsoleGridView`](https://github.com/PowerShell/GraphicalTools)** - `OCGV` sends the output from a command to an interactive table. -* **[F7History](https://github.com/gui-cs/F7History)** - Graphical Command History for PowerShell (built on PowerShell's `Out-ConsoleGridView`). -* **[PoshRedisViewer](https://github.com/En3Tho/PoshRedisViewer)** - A compact Redis viewer module for PowerShell written in F#. -* **[PoshDotnetDumpAnalyzeViewer](https://github.com/En3Tho/PoshDotnetDumpAnalyzeViewer)** - dotnet-dump UI module for PowerShell. -* **[TerminalGuiDesigner](https://github.com/tznind/TerminalGuiDesigner)** - Cross platform view designer for building Terminal.Gui applications. +**Terminal.Gui** can be used with any .Net language to create feature rich and robust applications. +[Showcase](https://github.com/gui-cs/Terminal.Gui/blob/develop/Showcase.md) is a place where you can find all kind of projects from simple examples to advanced real world apps that fully utilize capabilities of the toolkit. +The team is looking forward to seeing new amazing projects made by the community to be added there! + +## Sample Usage in C# + +The following example shows a basic Terminal.Gui application in C#: + +```csharp +// This is a simple example application. For the full range of functionality +// see the UICatalog project + +// A simple Terminal.Gui example in C# - using C# 9.0 Top-level statements + +using System; +using Terminal.Gui; + +Application.Run ().Dispose (); + +// Before the application exits, reset Terminal.Gui for clean shutdown +Application.Shutdown (); + +// To see this output on the screen it must be done after shutdown, +// which restores the previous screen. +Console.WriteLine ($@"Username: {ExampleWindow.UserName}"); + +// Defines a top-level window with border and title +public class ExampleWindow : Window +{ + public static string UserName; + + public ExampleWindow () + { + Title = $"Example App ({Application.QuitKey} to quit)"; + + // Create input components and labels + var usernameLabel = new Label { Text = "Username:" }; + + var userNameText = new TextField + { + // Position text field adjacent to the label + X = Pos.Right (usernameLabel) + 1, + + // Fill remaining horizontal space + Width = Dim.Fill () + }; + + var passwordLabel = new Label + { + Text = "Password:", X = Pos.Left (usernameLabel), Y = Pos.Bottom (usernameLabel) + 1 + }; + + var passwordText = new TextField + { + Secret = true, + + // align with the text box above + X = Pos.Left (userNameText), + Y = Pos.Top (passwordLabel), + Width = Dim.Fill () + }; + + // Create login button + var btnLogin = new Button + { + Text = "Login", + Y = Pos.Bottom (passwordLabel) + 1, + + // center the login button horizontally + X = Pos.Center (), + IsDefault = true + }; + + // When login button is clicked display a message popup + btnLogin.Accept += (s, e) => + { + if (userNameText.Text == "admin" && passwordText.Text == "password") + { + MessageBox.Query ("Logging In", "Login Successful", "Ok"); + UserName = userNameText.Text; + Application.RequestStop (); + } + else + { + MessageBox.ErrorQuery ("Logging In", "Incorrect username or password", "Ok"); + } + }; + + // Add the views to the Window + Add (usernameLabel, userNameText, passwordLabel, passwordText, btnLogin); + } +} +``` + +When run the application looks as follows: + +![Simple Usage app](./docfx/images/Example.png) + +## Installing + +Use NuGet to install the `Terminal.Gui` NuGet package: https://www.nuget.org/packages/Terminal.Gui + +### Installation in .NET Core Projects + +To install Terminal.Gui into a .NET Core project, use the `dotnet` CLI tool with this command. + +``` +dotnet add package Terminal.Gui +``` + +Or, you can use the [Terminal.Gui.Templates](https://github.com/gui-cs/Terminal.Gui.templates). ## Contributing diff --git a/Release.ps1 b/Release.ps1 index bc293c44f3..287d4d0366 100644 --- a/Release.ps1 +++ b/Release.ps1 @@ -5,8 +5,8 @@ param( [int]$Version ) -$branch = "v2_develop" -$tag = "v2.0.0-alpha.$Version" +$branch = "v2_release" +$tag = "$Version-prealpha" $releaseMessage = "Release $tag" try { diff --git a/Showcase.md b/Showcase.md new file mode 100644 index 0000000000..03b664874e --- /dev/null +++ b/Showcase.md @@ -0,0 +1,31 @@ +# Showcase # + +* **[UI Catalog](https://github.com/gui-cs/Terminal.Gui/tree/master/UICatalog)** - The UI Catalog project provides an easy to use and extend sample illustrating the capabilities of **Terminal.Gui**. Run `dotnet run --project UICatalog` to run the UI Catalog. + ![Sample app](docfx/images/sample.gif) + ⠀ +* **[PowerShell's `Out-ConsoleGridView`](https://github.com/PowerShell/GraphicalTools)** - `OCGV` sends the output from a command to an interactive table. + ![OutConsoleGridView.png](docfx/images/OutConsoleGridView.png) + ⠀ +* **[F7History](https://github.com/gui-cs/F7History)** - Graphical Command History for PowerShell (built on PowerShell's `Out-ConsoleGridView`). + ![F7History.gif](docfx/images/F7History.gif) + ⠀ +* **[PoshRedisViewer](https://github.com/En3Tho/PoshRedisViewer)** - A compact Redis viewer module for PowerShell written in F#. + ![PoshRedisViewer.png](docfx/images/PoshRedisViewer.png) + ⠀ +* **[PoshDotnetDumpAnalyzeViewer](https://github.com/En3Tho/PoshDotnetDumpAnalyzeViewer)** - dotnet-dump UI module for PowerShell. + ![PoshDotnetDumpAnalyzerViewer.png](docfx/images/PoshDotnetDumpAnalyzerViewer.png) + ⠀ +* **[TerminalGuiDesigner](https://github.com/tznind/TerminalGuiDesigner)** - Cross platform view designer for building Terminal.Gui applications. + ![TerminalGuiDesigner.gif](docfx/images/TerminalGuiDesigner.gif) + +* **[Capital and Cargo](https://github.com/dhorions/Capital-and-Cargo)** - A retro console game where you buy, sell, produce and transport goods built with Terminal.Gui + ![image](https://github.com/gui-cs/Terminal.Gui/assets/1682004/ed89f3d6-020f-4a8a-ae18-e057514f4c43) + + +# Examples # + +* **[C# Example](https://github.com/gui-cs/Terminal.Gui/tree/master/Example)** - Run `dotnet run` in the `Example` directory to run the C# Example. + +* **[F# Example](https://github.com/gui-cs/Terminal.Gui/tree/master/FSharpExample)** - An example showing how to build a Terminal.Gui app using F#. + +* **[Reactive Example](https://github.com/gui-cs/Terminal.Gui/tree/master/ReactiveExample)** - A sample app that shows how to use `System.Reactive` and `ReactiveUI` with `Terminal.Gui`. The app uses the MVVM architecture that may seem familiar to folks coming from WPF, Xamarin Forms, UWP, Avalonia, or Windows Forms. In this app, we implement the data bindings using ReactiveUI `WhenAnyValue` syntax and [Pharmacist](https://github.com/reactiveui/pharmacist) — a tool that converts all events in a NuGet package into observable wrappers. diff --git a/docfx/images/Example.png b/docfx/images/Example.png index bf3570f1c0..aa02ecc364 100644 Binary files a/docfx/images/Example.png and b/docfx/images/Example.png differ diff --git a/docfx/images/sample.gif b/docfx/images/sample.gif index b540b876f1..5027de6ae4 100644 Binary files a/docfx/images/sample.gif and b/docfx/images/sample.gif differ