diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index eac428de..81401c93 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -21,10 +21,8 @@
]
},
"dotnet-reportgenerator-globaltool": {
- "version": "5.2.1",
- "commands": [
- "reportgenerator"
- ]
+ "version": "5.2.2",
+ "commands": ["reportgenerator"]
}
}
}
\ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f84d25a8..047ac824 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,7 +1,7 @@
name: CI and docs
env:
- ACTIONS_RUNNER_NODE16: true
+ ACTIONS_RUNNER_NODE20: true
on:
push:
@@ -14,13 +14,13 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Setup .NET
- uses: actions/setup-dotnet@v3
+ uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Restore dependencies
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
@@ -41,7 +41,7 @@ jobs:
- name: Convert coverage report to lcov format
run: reportgenerator "-reports:./coverage.opencover.xml" "-targetdir:coverage" "-reporttypes:lcov"
- name: Coveralls upload
- uses: coverallsapp/github-action@master
+ uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage/lcov.info
@@ -52,9 +52,9 @@ jobs:
timeout-minutes: 15
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Setup .NET
- uses: actions/setup-dotnet@v3
+ uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Build
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 1b1ad688..6cd8bdd3 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -22,7 +22,7 @@ jobs:
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Build
- run: dotnet build --configuration Release /p:Version=${VERSION}
+ run: dotnet build -c Release /p:Version=${VERSION} /p:ContinuousIntegrationBuild=true
- name: Pack
run: dotnet pack src/ConsoleAppVisuals/ConsoleAppVisuals.csproj --configuration Release /p:ContinuousIntegrationBuild=true /p:Version=${VERSION} --no-build --output .
- name: Push to GitHub Packages
diff --git a/README.md b/README.md
index 7c8388a6..ea909948 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
> User-friendly .NET visuals library designed for console apps
-[](https://www.nuget.org/packages/ConsoleAppVisuals/) [](https://www.nuget.org/packages/ConsoleAppVisuals/) [](https://github.com/MorganKryze/ConsoleAppVisuals) [](https://coveralls.io/github/MorganKryze/ConsoleAppVisuals?branch=main) [](https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/LICENSE)
+[](https://www.nuget.org/packages/ConsoleAppVisuals/) [](https://www.nuget.org/packages/ConsoleAppVisuals/) [](https://github.com/MorganKryze/ConsoleAppVisuals) [](https://coveralls.io/github/MorganKryze/ConsoleAppVisuals?branch=main) [](https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/LICENSE) [](https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/src/ConsoleAppVisuals)

@@ -10,7 +10,7 @@
Feel free to check out the following resources to help you get started:
-- Take a quick look at our [example project](https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/Program.cs) to understand how to implement the library in your own project
+- Take a quick look at our [example project](https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/) to understand how to implement the library in your own project
- A [complete documentation](https://morgankryze.github.io/ConsoleAppVisuals/) is also available.
## Install
@@ -51,6 +51,7 @@ After installing the library, do not forget to add the following statement at th
```csharp
using ConsoleAppVisuals;
+using ConsoleAppVisuals.Elements;
```
#### Work with static elements
@@ -73,20 +74,15 @@ Finally, you can display the `Window`:
Window.Render();
```
-Now at each refresh, the `Title` element will appear on screen. To disable it, you may choose one of these options:
+Now at each refresh, the `Title` element will appear on screen. To disable it, you can use:
```csharp
-// Will look for a Title element and deactivate it, the first on the list
-Window.DeactivateElement
();
-
-// Will deactivate the exampleTitle element
Window.DeactivateElement(exampleTitle);
```
Or simply remove it from the list:
```csharp
-Window.RemoveElement();
Window.RemoveElement(exampleTitle);
```
@@ -95,7 +91,7 @@ Window.RemoveElement(exampleTitle);
The process is similar to the static elements. The difference is that you can get a response from your interaction with these elements. Let's create a `Prompt` element:
```csharp
-Prompt examplePrompt = new Prompt("What is your name?", "Theo");
+Prompt examplePrompt = new Prompt("What is your name?");
```
Then, you can add it to `Window`:
@@ -110,13 +106,13 @@ Finally, you can display the `Window`, remember that interactive element are dis
// Add this line if you have static elements to display
Window.Render();
-Window.ActivateElement();
+Window.ActivateElement(examplePrompt);
```
To get the response simply add:
```csharp
-var responsePrompt = Window.GetResponse();
+var responsePrompt = examplePrompt.GetResponse();
```
Access to the response data using:
@@ -130,12 +126,12 @@ Console.WriteLine(responsePrompt?.Info);
```
> [!NOTE]
-> Getting the response from an interactive element will automatically deactivate it.
+> The `InteractiveElement` object deactivate themselves after their execution.
You may now remove the element from the list if you want to:
```csharp
-Window.RemoveElement();
+Window.RemoveElement(examplePrompt);
```
## Roadmap
diff --git a/SECURITY.md b/SECURITY.md
index 8c24a48a..8d77bf6e 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -4,6 +4,7 @@
| Version | Supported |
| ------- | ------------------ |
+| 3.1.x | :warning: |
| 3.0.x | :warning: |
| 2.7.x | :white_check_mark: |
| 2.6.x | :white_check_mark: |
@@ -14,7 +15,7 @@
| 2.1.x | :white_check_mark: |
| < 2.1.0 | :x: |
-3.0.x are the latest versions. They are not fully tested yet and may contain some bugs. Please report any issue you may encounter.
+3.0.x and 3.0.x are the latest versions. They are not fully tested yet and may contain some bugs. Please report any issue you may encounter.
1.0.x and 2.0.x are not supported anymore. Please update to the latest version to benefit from the latest security updates.
diff --git a/docs/articles/create_element.md b/docs/articles/create_element.md
index a6af44e1..c6420bb7 100644
--- a/docs/articles/create_element.md
+++ b/docs/articles/create_element.md
@@ -172,26 +172,26 @@ Once your customization is done, you may use your element in your application ju
Now that you know how to create your own elements, you can check if they are available in the library. To do so, you can use built-in elements to display all the elements available in the library (available in the [example project](https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/InteractiveDemo.cs)). Here is an example of how to do it:
```csharp
-ElementsList list = new();
-Window.AddElement(list);
+ElementsList elementList = new ElementsList();
+Window.AddElement(elementList);
-Window.Render();
-Window.StopExecution();
+Window.Render(elementList);
+Window.Freeze();
-Window.Clear();
-Window.RemoveElement(list);
+Window.DeactivateElement(elementList);
+Window.RemoveElement(elementList);
```
Or target only interactive elements:
```csharp
-InteractiveList list = new();
-Window.AddElement(list);
+InteractiveList interactiveList = new InteractiveList();
+Window.AddElement(interactiveList);
-Window.Render();
-Window.StopExecution();
+Window.Render(interactiveList);
+Window.Freeze();
-Window.Clear();
-Window.RemoveElement(list);
+Window.DeactivateElement(interactiveList);
+Window.RemoveElement(interactiveList);
```
diff --git a/docs/articles/publish_library.md b/docs/articles/publish_library.md
index 1bf6ac12..2658ddaf 100644
--- a/docs/articles/publish_library.md
+++ b/docs/articles/publish_library.md
@@ -90,6 +90,8 @@ Here is a template for a `.csproj` file made for publishing a package:
net8.0
enable
enable
+
+ true
@@ -110,15 +112,15 @@ Here is a template for a `.csproj` file made for publishing a package:
git
README.md
LICENSE
-
- true
true
-
-
- true
+
+
+ true
+ true
+ true
@@ -210,7 +212,7 @@ jobs:
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Build
- run: dotnet build --configuration Release /p:Version=${VERSION}
+ run: dotnet build --configuration Release /p:ContinuousIntegrationBuild=true /p:Version=${VERSION}
- name: Pack
run: dotnet pack --configuration Release /p:ContinuousIntegrationBuild=true /p:Version=${VERSION} --no-build --output .
- name: Push to GitHub Packages
@@ -242,7 +244,6 @@ If that project was indeed for you for demo purposes, you cannot delete it from
## Resources
- [Official NuGet documentation](https://learn.microsoft.com/nuget/quickstart/create-and-publish-a-package-using-the-dotnet-cli)
-
- [Main Source](https://acraven.medium.com/a-nuget-package-workflow-using-github-actions-7da8c6557863)
-
- [Recap](https://levelup.gitconnected.com/publish-to-nuget-with-github-actions-4e1486e7c19f)
+- [Deterministic Builds](https://github.com/clairernovotny/DeterministicBuilds)
diff --git a/docs/elements/first_element.md b/docs/elements/first_element.md
deleted file mode 100644
index ab790eb9..00000000
--- a/docs/elements/first_element.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# First element
-
-Work in progress...
-
-> [!NOTE]
-> If this part really raises your interest, feel free to notify me by [opening an issue](https://github.com/MorganKryze/ConsoleAppVisuals/issues) or [contact me by email](mailto:morgan@kodelab.fr).
diff --git a/docs/elements/index.md b/docs/elements/index.md
deleted file mode 100644
index f844a34d..00000000
--- a/docs/elements/index.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# Elements
-
-Work in progress...
-
-> [!NOTE]
-> This subject is briefly tackled in the docs but if this part really thrills you, feel free to notify me by [opening an issue](https://github.com/MorganKryze/ConsoleAppVisuals/issues) or [contact me by email](mailto:morgan@kodelab.fr).
diff --git a/docs/elements/toc.yml b/docs/elements/toc.yml
deleted file mode 100644
index ce6d4da3..00000000
--- a/docs/elements/toc.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-items:
- - name: Getting Started
- href: index.md
- - name: First element
- href: first_element.md
diff --git a/docs/index.md b/docs/index.md
index c8e267cf..9f2f5c40 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,6 +1,6 @@
# ConsoleAppVisuals
-[](https://www.nuget.org/packages/ConsoleAppVisuals/) [](https://www.nuget.org/packages/ConsoleAppVisuals/) [](https://github.com/MorganKryze/ConsoleAppVisuals) [](https://coveralls.io/github/MorganKryze/ConsoleAppVisuals?branch=main)[](https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/LICENSE)
+[](https://www.nuget.org/packages/ConsoleAppVisuals/) [](https://www.nuget.org/packages/ConsoleAppVisuals/) [](https://github.com/MorganKryze/ConsoleAppVisuals) [](https://coveralls.io/github/MorganKryze/ConsoleAppVisuals?branch=main)[](https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/LICENSE) [](https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/src/ConsoleAppVisuals)

@@ -9,12 +9,11 @@
This is the documentation for the `ConsoleAppVisuals` library. This is a simple and easy-to-use library that allows you to create visual elements in the console. Here are all the resources available:
1. [Introduction](/ConsoleAppVisuals/introduction/index.html): find the installation process, the first steps into the library and the description of the `Core` and `Window` classes.
-2. [Elements](/ConsoleAppVisuals/elements/index.html): find the detailed features of the visual elements available and recommendations.
-3. [References](/ConsoleAppVisuals/references/index.html): find all methods, properties and classes with their description and all arguments available.
-4. [Articles](/ConsoleAppVisuals/articles/index.html): find some additional articles about how to create and publish a library or create your documentation.
-5. [Legacy](/ConsoleAppVisuals/legacy/index.html): find the old documentation of the library for the versions 2.x.x and below.
+2. [References](/ConsoleAppVisuals/references/index.html): find all methods, properties and classes with their description and all arguments available.
+3. [Articles](/ConsoleAppVisuals/articles/index.html): find some additional articles about how to create and publish a library or create your documentation.
+4. [Legacy](/ConsoleAppVisuals/legacy/index.html): find the old documentation of the library for the versions 2.x.x and below.
-Finally, an commented [example project](https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/Program.cs) to see how to use the library in a real project. If you have any questions, feel free to ask them in the [discussions](https://github.com/MorganKryze/ConsoleAppVisuals/discussions) section.
+Finally, an commented [example project](https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/) to see how to use the library in a real project. If you have any questions, feel free to ask them in the [discussions](https://github.com/MorganKryze/ConsoleAppVisuals/discussions) section.
## Supported .NET versions
diff --git a/docs/introduction/first_app.md b/docs/introduction/first_app.md
index 2ef4d38a..fe65982a 100644
--- a/docs/introduction/first_app.md
+++ b/docs/introduction/first_app.md
@@ -81,6 +81,7 @@ Now, let's add the `ConsoleAppVisuals` package to our project:
```csharp
using System;
using ConsoleAppVisuals;
+using ConsoleAppVisuals.Elements;
namespace MyApp
{
@@ -105,7 +106,7 @@ Window.AddElement(title);
And finally, we can render the `Title` from the `Window`:
```csharp
-Window.RenderOneElement(title);
+Window.Render(title);
```

@@ -158,7 +159,7 @@ Window.ActivateElement(prompt);
Now that we have well displayed the prompt, we can get the user's response by adding the following line of code after the `Window.ActivateElement(prompt)` line:
```csharp
-var response = Window.GetResponse();
+var response = prompt.GetResponse();
```
This will retrieve an response object that has two properties: `State` and `Value`:
@@ -182,11 +183,11 @@ EmbeddedText text = new EmbeddedText(
"You just wrote " + response?.Value + "!",
"And you " + response?.Status + "!"
},
- $"Next {Core.GetSelector.Item1}",
- TextAlignment.Center
+ $"Next {Core.GetSelector.Item1}"
);
Window.AddElement(text);
+
Window.ActivateElement(text);
```
@@ -226,17 +227,17 @@ Window.AddElement(prompt);
Window.ActivateElement(prompt);
-var response = Window.GetResponse();
+var response = prompt.GetResponse();
EmbedText text = new EmbedText(
new List()
{
"You just wrote " + response?.Value + "!",
"And you " + response?.Status + "!"
},
- $"Next {Core.GetSelector.Item1}",
- TextAlignment.Center
+ $"Next {Core.GetSelector.Item1}"
);
Window.AddElement(text);
+
Window.ActivateElement(text);
Window.Close();
diff --git a/docs/introduction/index.md b/docs/introduction/index.md
index 27270975..4815ebe5 100644
--- a/docs/introduction/index.md
+++ b/docs/introduction/index.md
@@ -61,7 +61,7 @@ Window.Render();
Now at each refresh, the `Title` element will appear on screen. To disable it, you may add:
```csharp
-Window.DeactivateElement();
+Window.DeactivateElement(exampleTitle);
```
## Installation
diff --git a/docs/introduction/menus_management.md b/docs/introduction/menus_management.md
index be4f1a0c..66182ae4 100644
--- a/docs/introduction/menus_management.md
+++ b/docs/introduction/menus_management.md
@@ -24,6 +24,8 @@ And your cleaned `Program.cs` file should look like this:
```csharp
using System;
using ConsoleAppVisuals;
+using ConsoleAppVisuals.Elements;
+using ConsoleAppVisuals.Enums;
namespace MyApp
{
@@ -37,6 +39,9 @@ namespace MyApp
}
```
+> ![Note]
+> We added `using ConsoleAppVisuals.Enums;` to the using statements to use the `Placement` and `TextAlignment` enums.
+
## Manage menu status
Now that we can create a menu and collect the output, let's see how to manage the output and act accordingly:
@@ -54,7 +59,7 @@ var menu = new ScrollingMenu(
Window.AddElement(menu);
Window.ActivateElement(menu);
-var response = Window.GetResponse();
+var response = menu.GetResponse();
switch (response?.Status)
{
@@ -71,6 +76,8 @@ switch (response?.Status)
);
Window.AddElement(embedSelected);
Window.ActivateElement(embedSelected);
+
+ Window.RemoveElement(embedSelected);
break;
case Output.Escaped:
var embedEscaped = new EmbedText(
@@ -85,6 +92,8 @@ switch (response?.Status)
);
Window.AddElement(embedEscaped);
Window.ActivateElement(embedEscaped);
+
+ Window.RemoveElement(embedEscaped);
break;
case Output.Deleted:
var embedDeleted = new EmbedText(
@@ -99,6 +108,8 @@ switch (response?.Status)
);
Window.AddElement(embedDeleted);
Window.ActivateElement(embedDeleted);
+
+ Window.RemoveElement(embedDeleted);
break;
}
Window.Close();
@@ -124,6 +135,8 @@ switch (response?.Status)
);
Window.AddElement(embedSelected);
Window.ActivateElement(embedSelected);
+
+ Window.RemoveElement(embedSelected);
break;
case Output.Escaped:
case Output.Deleted:
@@ -148,7 +161,7 @@ var menu = new ScrollingMenu(
Window.AddElement(menu);
Window.ActivateElement(menu);
-var response = Window.GetResponse();
+var response = menu.GetResponse();
switch (response?.Status)
{
case Output.Selected:
@@ -201,7 +214,7 @@ EmbedText play = new(
TextAlignment.Left
);
Window.AddElement(play);
-Window.DeactivateElement(play);
+Window.DeactivateElement(play, false);
EmbedText language = new(
new List() { "Changing language..." },
@@ -209,7 +222,7 @@ EmbedText language = new(
TextAlignment.Left
);
Window.AddElement(language);
-Window.DeactivateElement(language);
+Window.DeactivateElement(language, false);
EmbedText sound = new(
new List() { "Changing volume..." },
@@ -217,7 +230,7 @@ EmbedText sound = new(
TextAlignment.Left
);
Window.AddElement(sound);
-Window.DeactivateElement(sound);
+Window.DeactivateElement(sound, false);
var settingsOptions = new string[] { "Language", "Sound", "Back" };
var settingsMenu = new ScrollingMenu(
@@ -237,7 +250,7 @@ MainMenu:
Window.ActivateElement(menu);
-var response = Window.GetResponse();
+var response = menu.GetResponse();
switch (response?.Status)
{
case Output.Selected:
@@ -268,7 +281,7 @@ SettingsMenu:
Window.ActivateElement(settingsMenu);
-var settingsResponse = Window.GetResponse();
+var settingsResponse = settingsMenu.GetResponse();
switch (settingsResponse?.Status)
{
case Output.Selected:
diff --git a/docs/introduction/new_elements.md b/docs/introduction/new_elements.md
index d713016a..9f5377dd 100644
--- a/docs/introduction/new_elements.md
+++ b/docs/introduction/new_elements.md
@@ -29,6 +29,8 @@ And your cleaned `Program.cs` file should look like this:
```csharp
using System;
using ConsoleAppVisuals;
+using ConsoleAppVisuals.Elements;
+using ConsoleAppVisuals.Enums;
namespace MyApp
{
@@ -42,6 +44,9 @@ namespace MyApp
}
```
+> ![Note]
+> We added `using ConsoleAppVisuals.Enums;` to the using statements to use the `Placement` and `TextAlignment` enums.
+
## Disabling elements
We tackled adding elements to the window. Now, let's see how to do the opposite.
@@ -77,12 +82,12 @@ ElementsDashboard dashboard = new ElementsDashboard();
Window.AddElement(dashboard);
Window.Render();
-Window.StopExecution();
+Window.Freeze();
Window.DeactivateElement(title);
Window.Render();
-Window.StopExecution();
+Window.Freeze();
```

@@ -112,12 +117,12 @@ ElementsDashboard dashboard = new ElementsDashboard();
Window.AddElement(dashboard);
Window.Render();
-Window.StopExecution();
+Window.Freeze();
Window.RemoveElement(title);
Window.Render();
-Window.StopExecution();
+Window.Freeze();
```

@@ -146,7 +151,7 @@ Window.AddElement(students);
Window.Render();
// TableView is a static element, so we need to stop the execution to see the result without exiting the application
-Window.StopExecution();
+Window.Freeze();
```

@@ -183,7 +188,7 @@ TableSelector players =
Window.AddElement(players);
// Contrary to the TableView, the TableSelector is interactive, so we do not have to stop the execution to see it, but to activate it
-Window.ActivateElement>();
+Window.ActivateElement(players);
```

@@ -192,9 +197,8 @@ Now let's collect the user interaction response:
```csharp
// Here a little subtlety, the type is TableSelector and is associated with an int response, string refers to the type of the data displayed in the table
-var response = Window.GetResponse, int>();
-
-Window.AddElement(
+var response = players.GetResponse();
+var playersEmbedResponse =
new EmbedText(
new List()
{
@@ -205,9 +209,9 @@ Window.AddElement(
},
$"Next {Core.GetSelector.Item1}",
TextAlignment.Center
- )
-);
-Window.ActivateElement();
+ );
+Window.AddElement(playersEmbedResponse);
+Window.ActivateElement(playersEmbedResponse);
```

@@ -229,7 +233,8 @@ Matrix matrix = new(data);
Window.AddElement(matrix);
-Window.ActivateElement>();
+Window.Render(matrix);
+Window.Freeze();
```

@@ -251,13 +256,13 @@ var menu = new ScrollingMenu(
);
Window.AddElement(menu);
Window.ActivateElement(menu);
-var response = Window.GetResponse();
+var responseMenu = menu.GetResponse();
var embedResponse = new EmbedText(
new List()
{
- $"The user: {response?.Status}",
- $"Index: {response?.Value}",
- $"Which corresponds to: {options[response?.Value ?? 0]}"
+ $"The user: {responseMenu?.Status}",
+ $"Index: {responseMenu?.Value}",
+ $"Which corresponds to: {options[responseMenu?.Value ?? 0]}"
},
$"Next {Core.GetSelector.Item1}",
TextAlignment.Left
diff --git a/docs/references/index.md b/docs/references/index.md
index 3449c51b..c563fb4e 100644
--- a/docs/references/index.md
+++ b/docs/references/index.md
@@ -1,12 +1,67 @@
# Getting started
-## Introduction
+This section describes all references of the library. you will find all arguments, method signatures, classes, and enums that are available for the user.
-This section describes all complete references of the library. you will find all arguments, method signatures, classes, and enums that are available for the user.
+> [!CAUTION]
+> Adding `using ConsoleAppVisuals;` at the beginning of your C# file is necessary but not sufficient to use the full potential of the library. Refer to the descriptions below to discover which namespaces to add to your project and the Introduction section to see how they are used.
+
+## Namespace descriptions
+
+### `ConsoleAppVisuals`
+
+```csharp
+using ConsoleAppVisuals;
+```
+
+This is the main namespace of the library. It contains the `Core` and `Window` classes. The `Core` class is the core of the library interaction with the console. It contains the methods to interact with the console on a low level basis. The `Window` class is used to manage visual elements. You may use it to add, remove, update and display elements on the console.
+
+### `Elements`
+
+```csharp
+using ConsoleAppVisuals.Elements;
+```
+
+This namespace contains all the visual elements of the library. You may find the static elements as well as the interactive elements. They share common characteristics and methods defined in the `models/Element.cs` and the `models/InteractiveElement.cs` class.
+
+### `Enums`
+
+```csharp
+using ConsoleAppVisuals.Enums;
+```
+
+This namespace contains all the enumerations used in the library. They are used to define the behaviors, position, response of the elements in the console.
+
+### `Models`
+
+```csharp
+using ConsoleAppVisuals.Models;
+```
+
+This namespace contains all the models of the library. They are used to define the characteristics of the elements and the interactions. You may find the `Element`, `InteractiveElement` classes for example.
+
+### `Attributes`
+
+```csharp
+using ConsoleAppVisuals.Attributes;
+```
+
+This namespace contains the `VisualAttribute` class. This attribute is used to ignore the element when calculating coverage since untestable.
+
+### `Errors`
+
+```csharp
+using ConsoleAppVisuals.Errors;
+```
+
+This namespace contains all the custom exceptions of the library. They are used to handle specific errors that may occur during the execution of the library.
+
+### Bonus: `Usings.cs`
+
+This file contains the different usings of the library. It is used to import the different classes of the library and enable them globally in the library. I recommend you to do the same in your projects. [See file](https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/src/ConsoleAppVisuals/Usings.cs)
## Structure
-Here is the file structure of the library:
+Here is the detailed file structure of the library:
```bash
ConsoleAppVisuals
@@ -18,18 +73,19 @@ ConsoleAppVisuals
│ │ ├───Prompt.cs
│ │ ├───ScrollingMenu.cs
│ │ └───TableSelector.cs
-│ ├───inspectors
-│ │ ├───ElementList.cs
-│ │ ├───InteractiveList.cs
-│ │ └───ElementsDashboard.cs
-│ ├───FakeLoadingBar.cs
-│ ├───LoadingBar.cs
-│ ├───Matrix.cs
-│ ├───TableView.cs
-│ ├───Banner.cs
-│ ├───Header.cs
-│ ├───Footer.cs
-│ └───Title.cs
+│ └───static
+│ ├───inspectors
+│ │ ├───ElementList.cs
+│ │ ├───InteractiveList.cs
+│ │ └───ElementsDashboard.cs
+│ ├───FakeLoadingBar.cs
+│ ├───LoadingBar.cs
+│ ├───Matrix.cs
+│ ├───TableView.cs
+│ ├───Banner.cs
+│ ├───Header.cs
+│ ├───Footer.cs
+│ └───Title.cs
├───attributes
│ └───VisualAttribute.cs
├───enums
@@ -46,47 +102,9 @@ ConsoleAppVisuals
│ ├───InteractiveElement.cs
│ ├───InteractionEventArgs.cs
│ ├───Position.cs
+│ ├───TextStyler.cs
│ └───FontYamlFile.cs
├───Core.cs
├───Window.cs
-├───TextStyler.cs
└───Usings.cs
```
-
-## Small descriptions
-
-### `Usings.cs`
-
-This file contains the different usings of the library. It is used to import the different classes of the library and enable them globally in the library.
-
-### `Core.cs`
-
-This class is the core of the library interaction with the console. It contains the methods to interact with the console on a low level basis.
-
-### `Window.cs`
-
-This class is used to manage visual elements. You may use it to add, remove, update and display elements on the console.
-
-### `TextStyler.cs`
-
-This class is used to style text according to a specified font. It contains the methods to apply a specific style to a text. Often used for the title.
-
-### `elements`
-
-This folder contains all the visual elements of the library. You may find the static elements as well as the interactive elements. They share common characteristics and methods defined in the `models/Element.cs` and the `models/InteractiveElement.cs` class.
-
-### `attributes`
-
-This folder contains the `VisualAttribute` class. this attribute basically indicate to ignore the element when calculating coverage since untestable.
-
-### `enums`
-
-This folder contains all the enums used in the library. They are used to define the behaviors, position, response of the elements in the console.
-
-### `errors`
-
-This folder contains all the custom exceptions of the library. They are used to handle specific errors that may occur during the execution of the library.
-
-### `models`
-
-This folder contains all the models of the library to format interactions.
diff --git a/docs/toc.yml b/docs/toc.yml
index 22250181..c4284f6b 100644
--- a/docs/toc.yml
+++ b/docs/toc.yml
@@ -2,9 +2,6 @@ items:
- name: Introduction
href: introduction/
homepage: introduction/index.md
- - name: Elements
- href: elements/
- homepage: elements/index.md
- name: References
href: references/
homepage: references/index.md
diff --git a/example/InteractDemo.cs b/example/InteractDemo.cs
index f4a32ecd..5035c574 100644
--- a/example/InteractDemo.cs
+++ b/example/InteractDemo.cs
@@ -1,5 +1,7 @@
using System.Text;
using ConsoleAppVisuals;
+using ConsoleAppVisuals.Enums;
+using ConsoleAppVisuals.Models;
namespace example
{
diff --git a/example/Program.cs b/example/Program.cs
index 56896d3c..5cae4f13 100644
--- a/example/Program.cs
+++ b/example/Program.cs
@@ -1,4 +1,7 @@
using ConsoleAppVisuals;
+using ConsoleAppVisuals.Elements;
+using ConsoleAppVisuals.Enums;
+using ConsoleAppVisuals.Models;
namespace example
{
@@ -6,68 +9,85 @@ public static class Program
{
private static void Main()
{
- Debugging(); // Empty, do not mind, just for debugging purposes
-
- Window.AddElement(new Title("Example project")); // Define the default elements to display
- Window.AddElement(new Header());
- Window.AddElement(new Footer());
- Window.AddElement(new FakeLoadingBar("[ Loading ...]"));
- Window.Render(); // Render the window to display the elements above, they have only been added to the window
-
- Window.AddElement( // Add the scrolling menu to the window
- new ScrollingMenu(
- "What will be your next action?",
- 0,
- Placement.TopCenter,
- null,
- "Change Console color",
- "Write on the console",
- "Display paragraph",
- "Display styled text",
- "Display matrix",
- "Answer some prompt",
- "Select number",
- "Display table",
- "Interact with table",
- "Display loading bar",
- "Display elements space",
- "Custom window element",
- "Custom interactive element",
- "Display dashboard",
- "Quit the app"
- )
+ // Empty, do not mind, just for debugging purposes
+ Debugging();
+
+ // Create the title element
+ var title = new Title("Example project");
+ // Add the title to the window
+ Window.AddElement(title);
+
+ var header = new Header();
+ Window.AddElement(header);
+ var footer = new Footer();
+ Window.AddElement(footer);
+
+ var fakeLoadingBar = new FakeLoadingBar("[ Loading ...]");
+ Window.AddElement(fakeLoadingBar);
+
+ // Render the window to display the elements above
+ Window.Render();
+
+ // Create the main menu element
+ var mainMenu = new ScrollingMenu(
+ "What will be your next action?",
+ 0,
+ Placement.TopCenter,
+ "Change Console color",
+ "Write on the console",
+ "Display styled text",
+ "Display paragraph",
+ "Answer some prompt",
+ "Select number",
+ "Display matrix",
+ "Display table",
+ "Interact with table",
+ "Display loading bar",
+ "Custom window element",
+ "Custom interactive element",
+ "Display elements space",
+ "Display dashboard",
+ "Quit the app"
);
+ // Add the main menu to the window
+ Window.AddElement(mainMenu);
+ // This is a label, it is used to go back to the main menu after the selection
Menu:
- Window.ActivateElement(); // Only this line will make the menu appear on the console
- var response = Window.GetResponse(); // Get the response from the user. It is very important to Get the response for an Interactive element, or to Deactivate it (done by default by the GetResponse method)
+ // Only this line will make the menu appear on the console
+ Window.ActivateElement(mainMenu);
+ // Get the response from the user
+ var response = mainMenu.GetResponse();
- switch (response?.Status) // Check the response state (escape, enter or backspace) see the Output enum for more details
+ // Check the response state (escape, enter or backspace)
+ // see the Output enum for more details
+ switch (response?.Status)
{
case Output.Selected:
- switch (response.Value) // Check the response info (the index of the selected item). Here the Info for a ScrollingMenu is an int
+ // Check the response info (the index of the selected item).
+ // Here the Info for a ScrollingMenu is an int
+ switch (response.Value)
{
case 0:
- Window.OnResize(); // Render the window if the console has been resized
-
- Window.AddElement(
- new ScrollingMenu(
- "What color do you want to change?",
- 0,
- Placement.TopCenter,
- null,
- "White",
- "Red",
- "Green",
- "Blue",
- "Yellow",
- "Magenta",
- "Cyan"
- )
+ var colorMenu = new ScrollingMenu(
+ "What color do you want to change?",
+ 0,
+ Placement.TopCenter,
+ "White",
+ "Red",
+ "Green",
+ "Blue",
+ "Yellow",
+ "Magenta",
+ "Cyan"
);
- Window.ActivateElement(5); // Activate the element at the index 5 (the ScrollingMenu)
- var responseColor = Window.GetResponse();
+ Window.AddElement(colorMenu);
+
+ // Activate the element at the index 5 (the ScrollingMenu)
+ Window.ActivateElement(5);
+ var responseColor = colorMenu.GetResponse();
+
switch (responseColor?.Value)
{
case 0:
@@ -94,17 +114,19 @@ private static void Main()
default:
break;
}
+ // This will refresh the window to apply the new color
+ Window.Render();
Window.RemoveElement(5);
- Window.OnResize();
goto Menu;
- case 1: // These following functions are at the core of the library, they should not be used directly
- Window.OnResize();
-
+ case 1:
+ int startLine = Window.GetLineAvailable(Placement.TopCenter);
+ // These following functions are at the core of the library,
+ // they should not be used directly but can be useful
Core.WriteContinuousString(
"Have a look on the console to see all the text!",
- Window.GetLineAvailable(Placement.TopCenter),
+ startLine,
true,
1500,
100,
@@ -116,195 +138,191 @@ private static void Main()
"Bonjour le monde !",
TextAlignment.Left,
false,
- Window.GetLineAvailable(Placement.TopLeft) + 1,
+ startLine + 1,
true
);
Core.WritePositionedString(
"Hola Mundo !",
TextAlignment.Right,
false,
- Window.GetLineAvailable(Placement.TopRight) + 2,
+ startLine + 2,
true
);
Core.WritePositionedString(
"Hallo Welt !",
TextAlignment.Center,
false,
- Window.GetLineAvailable(Placement.TopCenter) + 3,
+ startLine + 3,
true
);
Core.WritePositionedString(
"Ciao mondo !",
TextAlignment.Left,
false,
- Window.GetLineAvailable(Placement.TopLeft) + 4,
+ startLine + 4,
true
);
- Window.StopExecution();
+ Window.Freeze();
- Window.Render();
- Window.OnResize();
+ Window.Clear(default, startLine, 5);
goto Menu;
case 2:
- Window.OnResize();
-
- Window.AddElement( // When you add an element, the info of the constructor are not displayed by default consider looking to the documentation to know what they are or use your IDE to see them
- new EmbedText(
- new List()
- {
- "C# is a general-purpose, multi-paradigm programming language encompassing strong typing,",
- "lexically scoped, imperative, declarative, functional, generic, object-oriented (class-based),",
- "and component-oriented programming disciplines.",
- ""
- },
- "Press [Enter] to continue..."
- )
- );
- Window.ActivateElement(); // Activate the element to display it on the console
-
- Window.RemoveElement(); // Removing the elements from the window after their use is not mandatory but it is recommended to keep the list clean
- Window.OnResize();
- goto Menu;
-
- case 3: // These following functions are at the core of the library, they should not be used directly
- Window.OnResize();
-
+ // These following functions are at the core of the library,
+ // they should not be used directly but can be useful
+ int styledTextStartLine = Window.GetLineAvailable(Placement.TopCenter);
Core.WritePositionedStyledText(
Core.StyleText("Hello World!"),
- Window.GetLineAvailable(Placement.TopCenter)
+ styledTextStartLine
);
- Window.StopExecution();
+ Window.Freeze();
- Window.Render();
+ Window.Clear(default, styledTextStartLine, 6);
+ goto Menu;
- Core.WritePositionedStyledText(
- Core.StyleText("Welcome Aboard!"),
- Window.GetLineAvailable(Placement.TopCenter)
+ case 3:
+ var text = new EmbedText(
+ new List()
+ {
+ "C# is a general-purpose, multi-paradigm programming language encompassing strong typing,",
+ "lexically scoped, imperative, declarative, functional, generic, object-oriented (class-based),",
+ "and component-oriented programming disciplines.",
+ ""
+ },
+ "Press [Enter] to continue..."
);
- Window.StopExecution();
+ Window.AddElement(text);
- Window.Render();
- Window.OnResize();
+ // Activate the element to display it on the console
+ Window.ActivateElement(text);
+
+ // Removing the elements from the window after their use is not mandatory
+ // but it is recommended to keep the list clean
+ Window.RemoveElement(text);
goto Menu;
case 4:
- Window.OnResize();
-
- List firstRow = new() { 1, null, 2, 7, 9, 3 }; // We first create the data to display
- List secondRow = new() { 4, 5, 6, 8, null, 2 };
- List thirdRow = new() { 7, 8, null, 3, 4, 5 };
- List fourthRow = new() { null, 2, 3, 4, 5, 6 };
- List> data =
- new() { firstRow, secondRow, thirdRow, fourthRow };
- Matrix matrix = new(data);
- matrix.SetRoundedCorners(false);
- Window.AddElement(matrix); // Then we add the element to the window, you may update the matrix after adding it, the modification will be taken in account
+ var prompt = new Prompt("What is your name?", "Theo");
+ Window.AddElement(prompt);
- Window.ActivateElement>(); // As this is only a display element and not interactive, we have to stop the execution to see it
- Window.StopExecution();
- Window.DeactivateElement>();
+ Window.ActivateElement(prompt);
- matrix.RemoveItem(new Position(0, 0)); // You can indeed update the matrix after adding it
- matrix.RemoveItem(new Position(3, 5));
- Window.ActivateElement>();
- Window.StopExecution();
- Window.DeactivateElement>();
+ var responsePrompt = prompt.GetResponse();
- matrix.UpdateItem(new Position(0, 0), 1);
- matrix.UpdateItem(new Position(3, 5), 6);
- Window.ActivateElement>();
- Window.StopExecution();
- Window.DeactivateElement>();
+ // We create an EmbedText to display the response
+ var embedResponsePrompt = new EmbedText(
+ new List()
+ {
+ "You just wrote " + responsePrompt?.Value + "!"
+ },
+ $"Next {Core.GetSelector.Item1}",
+ TextAlignment.Center
+ );
+ Window.AddElement(embedResponsePrompt);
+ Window.ActivateElement(embedResponsePrompt);
- Window.RemoveElement>();
- Window.Render();
- Window.OnResize();
+ Window.RemoveElement(prompt);
+ Window.RemoveElement(embedResponsePrompt);
goto Menu;
case 5:
- Window.OnResize();
+ // A FloatSelector is also available depending on your needs
+ var intSelector = new IntSelector("Select a number", 10, 100, 25, 5);
+ Window.AddElement(intSelector);
- Window.AddElement(new Prompt("What is your name?", "Theo")); // For more information about the Prompt element, see the documentation
+ Window.ActivateElement(intSelector);
+ var responseNumber = intSelector.GetResponse();
- Window.ActivateElement();
- var responsePrompt = Window.GetResponse(); // We saw Interactive elements before, here we get the response from the user as a string, an error will if you do not associate Prompt with a string
- Window.AddElement(
- new EmbedText(
- new List()
- {
- "You just wrote " + responsePrompt?.Value + "!"
- },
- $"Next {Core.GetSelector.Item1}",
- TextAlignment.Center
- )
+ var embedResponseNumber = new EmbedText(
+ new List()
+ {
+ "Status: " + responseNumber?.Status.ToString(),
+ "Selected the number " + (responseNumber?.Value) + "!"
+ }
);
- Window.ActivateElement();
+ Window.AddElement(embedResponseNumber);
+ Window.ActivateElement(embedResponseNumber);
- Window.RemoveElement();
- Window.RemoveElement();
+ Window.RemoveElement(intSelector);
+ Window.RemoveElement(embedResponseNumber);
goto Menu;
+
case 6:
- Window.OnResize();
+ // We first create the data to display
+ List firstRow = new() { 1, null, 2, 7, 9, 3 };
+ List secondRow = new() { 4, 5, 6, 8, null, 2 };
+ List thirdRow = new() { 7, 8, null, 3, 4, 5 };
+ List fourthRow = new() { null, 2, 3, 4, 5, 6 };
+ List> data =
+ new() { firstRow, secondRow, thirdRow, fourthRow };
- Window.AddElement(new IntSelector("Select a number", 10, 100, 25, 5)); // A FloatSelector is also available depending on your needs
+ var matrix = new Matrix(data);
- Window.ActivateElement();
- var responseNumber = Window.GetResponse();
- Window.AddElement(
- new EmbedText(
- new List()
- {
- "You chose to " + responseNumber?.Status.ToString(),
- "the number " + (responseNumber?.Value) + "!"
- },
- $"Next {Core.GetSelector.Item1}",
- TextAlignment.Center
- )
- );
- Window.ActivateElement();
+ // Then we add the element to the window,
+ // You may update the matrix after adding it,
+ // the modification will be taken in account
+ Window.AddElement(matrix);
+ Window.Render(matrix);
+
+ // As this is only a display element and not interactive,
+ // we have to stop the execution to see it
+ Window.Freeze();
+
+ // You can update the matrix after adding it
+ matrix.RemoveItem(new Position(0, 0));
+ matrix.RemoveItem(new Position(3, 5));
+ Window.Render(matrix);
+
+ Window.Freeze();
+
+ // Restore the data
+ matrix.UpdateItem(new Position(0, 0), 1);
+ matrix.UpdateItem(new Position(3, 5), 6);
+ Window.Render(matrix);
+
+ Window.Freeze();
- Window.OnResize();
- Window.RemoveElement();
- Window.RemoveElement();
+ Window.DeactivateElement(matrix);
+ Window.RemoveElement(matrix);
goto Menu;
case 7:
- Window.OnResize();
-
+ // We first create the data to display,
+ // pay attention to the order of the data and their length
+ // (the length of the headers and the data must be the same)
List studentsHeaders =
- new() { "id", "name", "major", "grades" }; // We first create the data to display, pay attention to the order of the data and their length (the length of the headers and the data must be the same)
+ new() { "id", "name", "major", "grades" };
List student1 = new() { "01", "Theo", "Technology", "97" };
List student2 = new() { "02", "Paul", "Mathematics", "86" };
List student3 = new() { "03", "Maxime", "Physics", "92" };
List student4 =
- new() { "04", "Charles", "Computer Science", "100" };
+ new() { "04", "Charles", "Computer Science", "89" };
TableView students =
new(
"Students grades",
studentsHeaders,
new() { student1, student2, student3, student4 }
);
- students.SetRoundedCorners(false);
Window.AddElement(students);
- Window.ActivateElement>(); // As this is only a display element and not interactive, we have to stop the execution to see it
- Window.StopExecution();
- Window.DeactivateElement>();
+ Window.ActivateElement(students);
+ // As this is only a display element and not interactive,
+ // we have to stop the execution to see it
+ Window.Freeze();
+ Window.DeactivateElement(students);
- students.UpdateLine(0, new() { "01", "Theo", "Biology", "100" }); // Similarly to the matrix, you can update the table after adding it
+ // Similarly to the matrix, you can update the table after adding it
+ students.UpdateLine(0, new() { "01", "Theo", "Biology", "100" });
students.RemoveLine(3);
- Window.ActivateElement>();
- Window.StopExecution();
- Window.DeactivateElement>();
- Window.OnResize();
- Window.RemoveElement>();
+ Window.ActivateElement(students);
+ Window.Freeze();
+ Window.DeactivateElement(students);
+
+ Window.RemoveElement(students);
goto Menu;
case 8:
- Window.OnResize();
-
List playersHeaders =
new() { "id", "first name", "last name", "nationality", "slams" };
List player1 =
@@ -330,151 +348,151 @@ private static void Main()
player6,
player7
};
+
TableSelector players =
new("Great tennis players", playersHeaders, playersData);
- players.SetRoundedCorners(false);
Window.AddElement(players);
- Window.ActivateElement>(); // Contrary to the matrix and the table, the TableSelector is interactive, so we do not have to stop the execution to see it
- var responseTable = Window.GetResponse, int>(); // Here a little subtlety, the type is TableSelector and is associated with an int response, string refers to the type of the data displayed in the table
- Window.AddElement(
- new EmbedText(
- new List()
- {
- "You chose to " + responseTable?.Status.ToString(),
- "the player "
- + playersData[responseTable?.Value ?? 0][2]
- + "!"
- },
- $"Next {Core.GetSelector.Item1}",
- TextAlignment.Center
- )
+ Window.ActivateElement(players);
+ var responseTable = players.GetResponse();
+ var embedResponseTable = new EmbedText(
+ new List()
+ {
+ "Status: " + responseTable?.Status.ToString(),
+ "Selected the player "
+ + playersData[responseTable?.Value ?? 0][2]
+ + "!"
+ }
);
- Window.ActivateElement();
+ Window.AddElement(embedResponseTable);
+ Window.ActivateElement(embedResponseTable);
- Window.OnResize();
- Window.RemoveElement>();
- Window.RemoveElement();
+ Window.RemoveElement(players);
+ Window.RemoveElement(embedResponseTable);
goto Menu;
case 9:
- Window.OnResize();
-
- float progress = 0f; // Contrary to the FakeLoadingBar, the LoadingBar is corresponds to a real loading defined by a variable, here progress
- Window.AddElement(
- new LoadingBar(
- "[ Loading ...]",
- ref progress, // The variable must be passed by reference so the updates on the variable are taken in account
- Placement.TopCenter,
- default,
- 2000
- )
+ // Contrary to the FakeLoadingBar, the LoadingBar
+ // corresponds to a real loading defined by a variable (here progress)
+ float progress = 0f;
+ var loadingBar = new LoadingBar(
+ "[ Loading ...]",
+ // The variable must be passed by reference
+ // so the updates on the variable are taken in account
+ ref progress,
+ Placement.TopCenter,
+ 2000
);
- Thread thread = // We create a thread to simulate a process that will update the progress variable while we display the loading bar in the main thread
+ Window.AddElement(loadingBar);
+
+ // We create a thread to simulate a process
+ // that will update the progress variable while
+ // we display the loading bar in the main thread
+ Thread thread =
new(() =>
{
for (progress = 0f; progress <= 100f; progress++)
{
- Window
- .GetElement()
- ?.UpdateProgress(progress / 100);
+ loadingBar.UpdateProgress(progress / 100);
Thread.Sleep(30);
}
- Window.GetElement()?.UpdateProgress(1f); // Here is an example of how to access method from an object in the window
+ loadingBar.UpdateProgress(1f);
});
+ // Start the process
thread.Start();
- Window.ActivateElement(); // Start the loading bar
- thread.Join(); // Wait for the thread to finish
+ // Start the loading bar
+ Window.ActivateElement(loadingBar);
+ // Wait for the thread to finish
+ thread.Join();
- Window.RemoveElement();
+ Window.RemoveElement(loadingBar);
goto Menu;
- case 10: // These following functions are for debugging purposes, they should not be used in a production state of a software
- Window.OnResize();
-
- Window.AddElement(
- new EmbedText(
- new List()
- {
- "The colors represented the space taken by the elements. Press [Enter] to continue..."
- },
- $"Next {Core.GetSelector.Item1}",
- TextAlignment.Left
- )
+ case 10:
+ // Custom element, see the StaticDemo class
+ // in this project for more information
+ var customStaticElement = new StaticDemo(
+ "This element has been created in this project",
+ "Its interest is for demonstration only",
+ "The model in on the StaticDemo.cs file",
+ 3,
+ 2,
+ Placement.TopCenterFullWidth
);
- Window.ActivateElement(false);
+ Window.AddElement(customStaticElement);
+ Window.Render(customStaticElement);
+ Window.Freeze();
- Window.RenderAllElementsSpace(); // This method will display all the spaces taken by the element in teh window
- Window.StopExecution();
-
- Window.Render(); // Render the window to display the elements above
-
- Window.OnResize();
- Window.RemoveElement();
+ Window.RemoveElement(customStaticElement);
goto Menu;
case 11:
- Window.OnResize();
-
- Window.AddElement(
- new StaticDemo( // Custom element, see the StaticDemo class for more information
- new List()
- {
- "This element has been created in this project",
- "Its interest is for demonstration only",
- "The model in on the StaticDemo.cs file"
- },
- TextAlignment.Center
- )
+ var customInteractiveElement = new InteractDemo(
+ "This element is also custom for demo purposes, you may type something:"
);
- Window.ActivateElement();
+ Window.AddElement(customInteractiveElement);
+
+ Window.ActivateElement(customInteractiveElement);
- Window.RemoveElement();
- Window.OnResize();
+ Window.RemoveElement(customInteractiveElement);
goto Menu;
case 12:
- Window.OnResize();
-
- Window.AddElement(
- new InteractDemo(
- "This element is also custom for demo purposes, you may type something:"
- )
+ // These following elements are for debugging purposes,
+ // they should not be used in a production state of a project
+ var embedInfo = new EmbedText(
+ new List()
+ {
+ "The colors represented the space taken by the elements. Press [Enter] to continue..."
+ }
);
- Window.ActivateElement();
+ Window.AddElement(embedInfo);
+ Window.ActivateElement(embedInfo);
- Window.DeactivateElement();
+ // This method will display all the spaces taken by the element in the window
+ Window.RenderElementsSpace();
+ Window.Freeze();
- Window.RemoveElement();
- Window.OnResize();
+ // Render the window to display the elements above
+ Window.Render();
+
+ Window.RemoveElement(embedInfo);
goto Menu;
- case 13: // These following functions are for debugging purposes, they should not be used in a production state of a software
- Window.AddElement(new ElementsDashboard()); // See all the elements in the window
+ case 13:
+ // These following functions are for debugging purposes,
+ // they should not be used in a production state of a software
- Window.Render();
- Window.StopExecution();
+ // See all the elements in the window
+ var dashboard = new ElementsDashboard();
+ Window.AddElement(dashboard);
- Window.Clear();
- Window.RemoveElement(); // This will remove the items from the window
+ Window.Render(dashboard);
+ Window.Freeze();
- Window.AddElement(new ElementList());
+ Window.DeactivateElement(dashboard);
+ Window.RemoveElement();
- Window.Render();
- Window.StopExecution();
+ // See all the element types available
+ var elementList = new ElementList();
+ Window.AddElement(elementList);
+
+ Window.Render(elementList);
+ Window.Freeze();
- Window.Clear();
+ Window.DeactivateElement(elementList);
Window.RemoveElement();
- Window.AddElement(new InteractiveList());
+ // See all the interactive element types available
+ var interactiveList = new InteractiveList();
+ Window.AddElement(interactiveList);
- Window.Render();
+ Window.Render(interactiveList);
+ Window.Freeze();
- Window.StopExecution();
- Window.DeactivateElement();
-
- Window.OnResize();
+ Window.DeactivateElement(interactiveList);
+ Window.RemoveElement();
goto Menu;
default:
@@ -484,40 +502,36 @@ private static void Main()
break;
case Output.Escaped:
- Window.OnResize();
-
- Window.AddElement(
- new EmbedText(
- new List()
- {
- "You have selected to quit the app. Press [Enter] to continue..."
- },
- $"Next {Core.GetSelector.Item1}",
- TextAlignment.Left
- )
+ var exitText = new EmbedText(
+ new List()
+ {
+ "You have selected to quit the app. Press [Enter] to continue..."
+ },
+ $"Next {Core.GetSelector.Item1}",
+ TextAlignment.Left
);
- Window.ActivateElement();
+ Window.AddElement(exitText);
+ Window.ActivateElement(exitText);
+
+ Window.RemoveElement(exitText);
- Window.RemoveElement();
- Window.Close(); // Close the window and exits the app
+ // Close the window and exits the app
+ Window.Close();
break;
case Output.Deleted:
- Window.OnResize();
-
- Window.AddElement(
- new EmbedText(
- new List()
- {
- "You have selected the backspace tile. Press [Enter] to continue..."
- },
- $"Next {Core.GetSelector.Item1}",
- TextAlignment.Left
- )
+ var backspaceText = new EmbedText(
+ new List()
+ {
+ "You have selected the backspace tile.",
+ "You will be redirected to the main menu.",
+ "Press [Enter] to continue..."
+ }
);
- Window.ActivateElement();
+ Window.AddElement(backspaceText);
+ Window.ActivateElement(backspaceText);
- Window.RemoveElement();
+ Window.RemoveElement(backspaceText);
goto Menu;
default:
diff --git a/example/StaticDemo.cs b/example/StaticDemo.cs
index 96476373..7f072be1 100644
--- a/example/StaticDemo.cs
+++ b/example/StaticDemo.cs
@@ -1,146 +1,198 @@
using ConsoleAppVisuals;
+using ConsoleAppVisuals.Enums;
+using ConsoleAppVisuals.Models;
namespace example
{
- // This object is a slight modification of the EmbedText object for the demo (here not interactive).
+ // This object is a slight modification of the Banner object for the demo (here not interactive).
public class StaticDemo : Element
{
- #region Fields
- private readonly List _text; // Your attributes should be private.
- private readonly TextAlignment _align;
- private readonly Placement _placement;
- private readonly int _line;
- private List? _textToDisplay;
+ #region Fields
+ // Your attributes should be private.
+ private (string, string, string) _text;
+ private int _upperMargin;
+ private int _lowerMargin;
+ private Placement _placement;
#endregion
#region Properties
+ // You can limit the number of this element in the window.
+ // Do not forget that the default value is 1.
+ public override int MaxNumberOfThisElement => 10;
+
///
- /// The position of the StaticDemo element in the console. for more information.
+ /// The placement of the banner.
///
public override Placement Placement => _placement;
///
- /// The Line of the StaticDemo element.
+ /// The height of the banner.
+ ///
+ public override int Height => UpperMargin + 1 + LowerMargin;
+
+ ///
+ /// The width of the banner.
///
- public override int Line => _line;
+ public override int Width => Console.WindowWidth;
///
- /// The height of the StaticDemo element.
+ /// The text of the banner.
///
- public override int Height => _textToDisplay!.Count; // Find the maximum of the height or width of the element to avoid conflict with other elements.
+ public (string, string, string) Text => _text;
///
- /// The width of the StaticDemo element.
+ /// The upper margin of the banner.
///
- public override int Width => _textToDisplay!.Max((string s) => s.Length);
+ public int UpperMargin => _upperMargin;
- public override int MaxNumberOfThisElement => 10; // You can limit the number of this element in the window. Do not forget that the default value is 1.
+ ///
+ /// The lower margin of the banner.
+ ///
+ public int LowerMargin => _lowerMargin;
#endregion
#region Constructor
///
- /// The natural constructor of the StaticDemo element.
+ /// The natural constructor of the banner.
///
- /// The text to display.
- /// The alignment of the StaticDemo element.
- /// The placement of the StaticDemo element.
- /// The line of the StaticDemo element.
+ /// The text on the left of the banner.
+ /// The text in the center of the banner.
+ /// The text on the right of the banner.
+ /// The upper margin of the banner.
+ /// The lower margin of the banner.
+ /// The placement of the banner.
public StaticDemo(
- List text,
- TextAlignment align = TextAlignment.Left,
- Placement placement = Placement.TopCenter,
- int? line = null
+ string leftText = "Banner Left",
+ string centerText = "Banner Center",
+ string rightText = "Banner Right",
+ int upperMargin = 0,
+ int lowerMargin = 0,
+ Placement placement = Placement.TopCenterFullWidth
)
{
- _text = text;
- _align = align;
- _placement = placement;
- _line = Window.CheckLine(line) ?? Window.GetLineAvailable(placement); // We consider this line mandatory to keep the code safe.
- BuildText();
+ _text.Item1 = leftText;
+ _text.Item2 = centerText;
+ _text.Item3 = rightText;
+ _upperMargin = upperMargin;
+ _lowerMargin = lowerMargin;
+ _placement = CheckPlacement(placement);
+ }
+
+ private static Placement CheckPlacement(Placement placement)
+ {
+ if (placement is not (Placement.BottomCenterFullWidth or Placement.TopCenterFullWidth))
+ {
+ throw new ArgumentException(
+ "The placement of the banner must be TopCenterFullWidth or BottomCenterFullWidth."
+ );
+ }
+ return placement;
}
#endregion
#region Methods
///
- /// Adds a line to the StaticDemo element.
+ /// This method is used to update the text on the left of the banner.
///
- /// The line to add.
- public void AddLine(string line) // Feel free to add your own methods to manipulate your element after adding it to the window.
+ /// The new text on the left of the banner.
+ public void UpdateLeftText(string leftText) // Feel free to add your own methods to manipulate your element after adding it to the window.
{
- _text.Add(line);
+ _text.Item1 = leftText;
}
///
- /// Inserts a line to the StaticDemo element.
+ /// This method is used to update the text in the center of the banner.
///
- /// The line to insert.
- /// The index where to insert the line.
- public void InsertLine(string line, int index)
+ /// The new text in the center of the banner.
+ public void UpdateCenterText(string centerText)
{
- _text.Insert(index, line);
+ _text.Item2 = centerText;
}
///
- /// Removes a line from the StaticDemo element.
+ /// This method is used to update the text on the right of the banner.
///
- /// The line to remove.
- public void RemoveLine(string line)
+ /// The new text on the right of the banner.
+ public void UpdateRightText(string rightText)
{
- _text.Remove(line);
+ _text.Item3 = rightText;
}
///
- /// Removes a line from the StaticDemo element.
+ /// This method is used to update the placement of the banner.
///
- /// The index of the line to remove.
- public void RemoveLine(int index)
+ /// The new placement of the banner.
+ public void UpdatePlacement(Placement placement)
{
- _text.RemoveAt(index);
+ _placement = CheckPlacement(placement);
}
///
- /// Renders the StaticDemo element.
+ /// This method is used to update the upper margin of the banner.
///
- protected override void RenderElementActions() // This method is mandatory to render correctly your element. If not, an error will be thrown.
+ /// The new upper margin of the banner.
+ /// The upper margin of the banner must be between 0 and the height of the console window.
+ public void UpdateUpperMargin(int upperMargin)
{
- BuildText();
- Core.WriteMultiplePositionedLines(
- false,
- _placement.ToTextAlignment(),
- false,
- _line,
- _textToDisplay!.ToArray()
- );
- Window.StopExecution();
- Window.DeactivateElement();
+ if (upperMargin < 0 || upperMargin > Console.WindowHeight - 1)
+ {
+ throw new ArgumentOutOfRangeException(
+ nameof(upperMargin),
+ "The upper margin of the banner must be between 0 and the height of the console window."
+ );
+ }
+ _upperMargin = upperMargin;
+ }
+
+ ///
+ /// This method is used to update the lower margin of the banner.
+ ///
+ /// The new lower margin of the banner.
+ /// The lower margin of the banner must be between 0 and the height of the console window.
+ public void UpdateLowerMargin(int lowerMargin)
+ {
+ if (lowerMargin < 0 || lowerMargin > Console.WindowHeight - 1)
+ {
+ throw new ArgumentOutOfRangeException(
+ nameof(lowerMargin),
+ "The lower margin of the banner must be between 0 and the height of the console window."
+ );
+ }
+ _lowerMargin = lowerMargin;
}
- private void BuildText()
+ ///
+ /// This method is used to render the banner on the console.
+ ///
+ protected override void RenderElementActions() // This method is mandatory to render correctly your element. If not, an error will be thrown.
{
- var maxLength = _text.Max((string s) => s.Length);
- _textToDisplay = new List();
- foreach (var line in _text)
+ for (int i = 0; i < UpperMargin; i++)
+ {
+ Core.WritePositionedString(
+ string.Empty,
+ TextAlignment.Center,
+ true,
+ Line + i,
+ false
+ );
+ }
+ Core.WritePositionedString(
+ Text.BannerToString(),
+ TextAlignment.Center,
+ true,
+ Line,
+ false
+ );
+ for (int i = 0; i < LowerMargin; i++)
{
- var lineToDisplay = "│ ";
- switch (_align)
- {
- case TextAlignment.Center:
- int totalPadding = maxLength - line.Length;
- int padLeft = totalPadding / 2;
- lineToDisplay += line.PadLeft(line.Length + padLeft).PadRight(maxLength);
- break;
- case TextAlignment.Left:
- lineToDisplay += line.PadRight(maxLength);
- break;
- case TextAlignment.Right:
- lineToDisplay += line.PadLeft(maxLength);
- break;
- }
- lineToDisplay += " │";
- _textToDisplay.Add(lineToDisplay);
+ Core.WritePositionedString(
+ string.Empty,
+ TextAlignment.Center,
+ true,
+ Line + Height - 1 - i,
+ false
+ );
}
- _textToDisplay.Insert(0, "┌" + new string('─', maxLength + 2) + "┐");
- _textToDisplay.Add("└" + new string('─', maxLength + 2) + "┘");
}
#endregion
}
diff --git a/example/bin/Release/net8.0/ConsoleAppVisuals.dll b/example/bin/Release/net8.0/ConsoleAppVisuals.dll
index 2a1f289b..1d714dcf 100644
Binary files a/example/bin/Release/net8.0/ConsoleAppVisuals.dll and b/example/bin/Release/net8.0/ConsoleAppVisuals.dll differ
diff --git a/example/bin/Release/net8.0/ConsoleAppVisuals.pdb b/example/bin/Release/net8.0/ConsoleAppVisuals.pdb
index 56daa159..a3c88bec 100644
Binary files a/example/bin/Release/net8.0/ConsoleAppVisuals.pdb and b/example/bin/Release/net8.0/ConsoleAppVisuals.pdb differ
diff --git a/example/bin/Release/net8.0/ConsoleAppVisuals.xml b/example/bin/Release/net8.0/ConsoleAppVisuals.xml
index 54a26243..27be0cf4 100644
--- a/example/bin/Release/net8.0/ConsoleAppVisuals.xml
+++ b/example/bin/Release/net8.0/ConsoleAppVisuals.xml
@@ -4,48 +4,48 @@
ConsoleAppVisuals
-
+
- The class is used to mark a class, struct, enum, constructor, method, property, field, event, interface, or delegate as a visual and so interact with the console.
+ The class is used to mark a class, struct, enum, constructor, method, property, field, event, interface, or delegate as a visual and so interact with the console.
[ WARNING ] This element cannot be tested.
-
+
- Initializes a new instance of the class.
+ Initializes a new instance of the class.
-
+
- Initializes a new instance of the class with a specified workaround message.
+ Initializes a new instance of the class with a specified workaround message.
The text string that describes alternative workarounds.
-
+
- Initializes a new instance of the class with a workaround message and a Boolean value indicating whether the obsolete element usage is considered an error.
+ Initializes a new instance of the class with a workaround message and a Boolean value indicating whether the obsolete element usage is considered an error.
The text string that describes alternative workarounds.
True if the obsolete element usage generates a compiler error; false if it generates a compiler warning.
-
+
Gets or sets the ID that the compiler will use when reporting a use of the API.
-
+
Gets a value that indicates whether the compiler will treat usage of the obsolete program element as an error.
True if the obsolete element usage is considered an error; otherwise, false. The default is false.
-
+
Gets the workaround message.
The workaround text string.
-
+
Gets or sets the URL for corresponding documentation. The API accepts a format string instead of an actual URL, creating a generic URL that includes the diagnostic ID.
@@ -53,7 +53,7 @@
- The class contains visual elements for a console app.
+ The class contains all the interactions between the application and the console.
@@ -70,20 +70,24 @@
This property is used to get the colors of the console.
- A tuple containing the font color and the background color.
This property is used to get the initial colors of the console.
- A tuple containing the initial font color and the initial background color.
-
+
- This property is used to check if the screen has been updated.
+ This method is used to check if the screen has been updated.
True if the screen has been updated, false otherwise.
- The screen is updated if the window size has changed or if the color panel has changed.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
@@ -95,7 +99,7 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
@@ -108,7 +112,7 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
@@ -121,7 +125,7 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
@@ -133,7 +137,7 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
@@ -145,7 +149,7 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
@@ -157,7 +161,7 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
@@ -169,7 +173,7 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
@@ -182,7 +186,7 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
@@ -196,7 +200,7 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
@@ -209,7 +213,7 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
@@ -221,7 +225,7 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
@@ -235,11 +239,11 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
This method is used to write a string positioned in the console.
@@ -252,11 +256,11 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
This method is used to write a string continuously in the console.
The string is written letter by letter on the console.
@@ -273,11 +277,11 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
This method is used to write a styled string in the console.
@@ -291,11 +295,11 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
This method prints a paragraph in the console.
@@ -308,11 +312,11 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
This method builds a string with a specific size and a specific placement.
@@ -325,11 +329,11 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
Insert a specified string into another string, at a specified position.
@@ -341,7 +345,7 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
@@ -355,7 +359,7 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
@@ -369,11 +373,11 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
This method is used to convert a Placement into a TextAlignment.
@@ -384,11 +388,11 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
This method is used to convert a TextAlignment into a Placement.
@@ -399,1322 +403,1799 @@
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- Defines the banner of the console window.
+ Defines the basic properties of an Embed text.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- The placement of the banner.
+ The position of the Embed text.
-
+
- The line of the banner in the console.
+ The height of the Embed text.
- We add 2 because so the banner does not overlap with the title.
-
+
- The height of the banner.
+ The width of the Embed text.
-
+
- The width of the banner.
+ The text of the Embed text.
-
+
- Getter and setter of the text of the banner.
+ The text of the button.
-
+
- Getter and setter of the upper margin of the banner.
+ The text to display.
-
+
- Getter and setter of the lower margin of the banner.
+ Wether the corners are rounded or not.
-
+
- The natural constructor of the banner.
+ The natural constructor of the Embed text.
- The text on the left of the banner.
- The text in the center of the banner.
- The text on the right of the banner.
- The upper margin of the banner.
- The lower margin of the banner.
- The placement of the banner.
- The line of the banner in the console.
+ The text to display.
+ The text of the button.
+ The alignment of the Embed text.
+ The placement of the Embed text element.
+ Wether the corners are rounded or not.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- This method is used to update the text on the left of the banner.
+ This method updates the text of the button.
- The new text on the left of the banner.
+ The new text of the button.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- This method is used to update the text in the center of the banner.
+ This method updates the text of the Embed text.
- The new text in the center of the banner.
+ The new text of the Embed text.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- This method is used to update the text on the right of the banner.
+ This method updates the placement of the Embed text.
- The new text on the right of the banner.
+ The new placement of the Embed text.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
-
- This method is used to render the banner on the console.
-
-
-
+
- Defines the loading bar of the console window.
+ This method updates the alignment of the Embed text.
+ The new alignment of the Embed text.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
-
- The line of the loading bar in the console.
-
- We add 2 because so the loading bar does not overlap with the title.
-
-
-
- The height of the loading bar.
-
- One line for the text,one line for the space between and one line for the progress.
-
-
+
- The width of the loading bar.
-
-
-
-
- Getter and setter of the text of the loading bar.
-
-
-
-
- Getter of the placement of the loading bar.
+ This method updates the rounded corners of the Embed text.
+ Wether the corners are rounded or not.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- Getter of the duration of the loading bar.
+ Adds a line to the Embed text.
+ The line to add.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- Getter of the additional duration of the loading bar at the end.
+ Inserts a line to the Embed text.
+ The line to insert.
+ The index where to insert the line.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- The natural constructor of the loading bar.
+ Removes a line from the Embed text.
- The text of the loading bar.
- The placement of the loading bar.
- The line of the loading bar.
- The duration of the loading bar.
- The additional duration of the loading bar at the end.
+ The line to remove.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- This method is used to update the text of the loading bar.
+ Removes a line from the Embed text.
- The new text of the loading bar.
+ The index of the line to remove.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- This method is used to draw the loading bar on the console.
+ Renders the Embed text.
-
+
- Defines the footer of the console window.
+ Defines the number selector of the console window.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- The placement of the footer.
+ The placement of the selector on the console.
-
+
- The line of the footer in the console.
+ The height of the selector.
-
+
- The height of the footer.
+ The width of the selector.
-
+
- The width of the footer.
+ The question to ask the user.
-
+
- The text of the footer.
+ The minimum value of the selector.
-
+
- The natural constructor of the footer.
+ The maximum value of the selector.
- The text on the left of the footer.
- The text in the center of the footer.
- The text on the right of the footer.
-
- For more information, refer to the following resources:
-
- - Documentation
- - Example Project
-
-
-
+
- This method is used to update the text on the left of the footer.
+ The start value of the selector.
- The new text on the left of the footer.
+
+
+
+ The step of the selector.
+
+
+
+
+ Whether the corners of the selector are rounded.
+
+
+
+
+ The constructor of the FloatSelector class.
+
+ The question to ask the user.
+ The minimum value of the selector.
+ The maximum value of the selector.
+ The start value of the selector.
+ The step of the selector.
+ The placement of the selector on the console.
+ Whether the corners of the selector are rounded.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- This method is used to update the text in the center of the footer.
+ This method is used to update the question of the selector.
- The new text in the center of the footer.
+ The question to ask the user.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- This method is used to update the text on the right of the footer.
+ This method is used to update the minimum value of the selector.
- The new text on the right of the footer.
+ The minimum value of the selector.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
-
- This method is used to render the footer on the console.
-
-
-
+
- Defines the header of the console window.
+ This method is used to update the maximum value of the selector.
+ The maximum value of the selector.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
-
- The placement of the header.
-
-
-
-
- The line of the header in the console.
-
-
-
-
- The height of the header.
-
-
-
+
- The width of the header.
-
-
-
-
- The getter of the text of the header.
-
-
-
-
- The getter and setter of the margin of the header.
-
-
-
-
- The natural constructor of the header.
+ This method is used to update the start value of the selector.
- The text on the left of the header.
- The text in the center of the header.
- The text on the right of the header.
- The margin of the header.
+ The start value of the selector.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- This method is used to update the text on the left of the header.
+ This method is used to update the step of the selector.
- The new text on the left of the header.
+ The step of the selector.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- This method is used to update the text in the center of the header.
+ This method is used to update the placement of the selector.
- The new text in the center of the header.
+ The placement of the selector on the console.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- This method is used to update the text on the right of the header.
+ This method is used to update the rounded corners of the selector.
- The new text on the right of the header.
+ Whether the corners of the selector are rounded.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- This method is used to update the margin of the header.
+ This method is used to draw the selector on the console.
+
+
+
+
+ Defines the number selector of the console window.
- The new margin of the header.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- This method is used to render the header on the console.
-
-
-
-
- This class is used to display a ElementList of all the elements in the window.
+ The placement of the selector on the console.
-
+
- This property wether the corners of the ElementList are rounded.
+ The height of the selector.
-
+
- This property returns the headers of the ElementList.
+ The width of the selector.
-
+
- This property returns the lines of the ElementList.
+ The question to ask the user.
-
+
- This property returns the title of the ElementList.
+ The minimum value of the selector.
-
+
- This property returns the line to display the ElementList on.
+ The maximum value of the selector.
-
+
- This property returns the height of the ElementList.
+ The start value of the selector.
-
+
- This property returns the width of the ElementList.
+ The step of the selector.
-
+
- This property returns the number of lines in the ElementList.
+ Whether the corners of the selector are rounded.
-
+
- This constructor creates a new instance of the WindowElementsElementList class.
+ The constructor of the intSelector class.
- The placement of the ElementList.
- If true, the corners of the ElementList will be rounded.
- The line to display the ElementList on.
+ The question to ask the user.
+ The minimum value of the selector.
+ The maximum value of the selector.
+ The start value of the selector.
+ The step of the selector.
+ The placement of the selector on the console.
+ Whether the corners of the selector are rounded.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- Toggles the rounded corners of the element.
+ This method is used to update the question of the selector.
- Refer to the example project to understand how to implement it available at https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/Program.cs
+ The question to ask the user.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- This method displays the ElementList.
+ This method is used to update the minimum value of the selector.
+ The minimum value of the selector.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- This class is used to display a dashboard of all the elements in the window.
+ This method is used to update the maximum value of the selector.
+ The maximum value of the selector.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- This property wether the corners of the dashboard are rounded.
-
-
-
-
- This property returns the headers of the dashboard.
-
-
-
-
- This property returns the lines of the dashboard.
-
-
-
-
- This property returns the title of the dashboard.
-
-
-
-
- This property returns the line to display the dashboard on.
-
-
-
-
- This property returns the height of the dashboard.
+ This method is used to update the start value of the selector.
+ The start value of the selector.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- This property returns the width of the dashboard.
+ This method is used to update the step of the selector.
+ The step of the selector.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- This property returns the number of lines in the dashboard.
+ This method is used to update the placement of the selector.
+ The placement of the selector on the console.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- This constructor creates a new instance of the WindowElementsDashboard class.
+ This method is used to update the rounded corners of the selector.
- The placement of the dashboard.
- If true, the corners of the dashboard will be rounded.
- The line to display the dashboard on.
+ Whether the corners of the selector are rounded.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- Toggles the rounded corners of the element.
+ This method is used to draw the selector on the console.
- Refer to the example project to understand how to implement it available at https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/Program.cs
-
+
- This method displays the dashboard.
+ Defines the prompt element of the console window.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- This class is used to display a InteractiveList of all the elements in the window.
+ The placement of the prompt element.
-
+
- This property wether the corners of the InteractiveList are rounded.
+ The height of the prompt element.
-
+
- This property returns the headers of the InteractiveList.
+ The width of the prompt element.
-
+
- This property returns the lines of the InteractiveList.
+ The question of the prompt element.
-
+
- This property returns the title of the InteractiveList.
+ The default value of the response.
-
+
- This property returns the line to display the InteractiveList on.
+ The maximum length of the response.
-
+
- This property returns the height of the InteractiveList.
+ The natural constructor of the prompt element.
+ The text on the left of the prompt element.
+ The text in the center of the prompt element.
+ The placement of the prompt element.
+ The maximum length of the response.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- This property returns the width of the InteractiveList.
+ This method is used to update the question of the prompt element.
+ The new question of the prompt element.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- This property returns the number of lines in the InteractiveList.
+ This method is used to update the default value of the prompt element.
+ The new default value of the prompt element.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- This constructor creates a new instance of the WindowElementsInteractiveList class.
+ This method is used to update the placement of the prompt element.
- The placement of the InteractiveList.
- If true, the corners of the InteractiveList will be rounded.
- The line to display the InteractiveList on.
+ The new placement of the prompt element.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- Toggles the rounded corners of the element.
+ This method is used to update the maximum length of the response.
- Refer to the example project to understand how to implement it available at https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/Program.cs
+ The new maximum length of the response.
+ The maximum length of the response must be greater than 0 and less than the width of the console window.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- This method displays the InteractiveList.
+ This method is used to render the prompt element on the console.
-
+
- Defines the basic properties of an Embed text.
+ Defines the scrolling menu the console window.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
-
- The position of the Embed text.
-
-
-
+
- The Line of the Embed text.
+ The placement of the menu on the console.
-
+
- The height of the Embed text.
+ The height of the menu.
-
+
- The width of the Embed text.
+ The width of the menu.
-
+
- The text of the Embed text.
+ The question to ask the user.
-
+
- The text of the button.
+ The different choices of the menu.
-
+
- The text to display.
+ The index of the default choice(initially 0).
-
+
- The natural constructor of the Embed text.
+ The constructor of the ScrollingMenu class.
- The text to display.
- The text of the button.
- The alignment of the Embed text.
- The placement of the Embed text element.
- The line of the Embed text.
+ The question to ask the user.
+ The index of the default choice(initially 0).
+ The placement of the menu on the console.
+ The different choices of the menu.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- Adds a line to the Embed text.
+ This method is used to update the question of the menu.
- The line to add.
+ The new question of the menu.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- Inserts a line to the Embed text.
+ This method is used to update the choices of the menu.
- The line to insert.
- The index where to insert the line.
+ The new choices of the menu.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- Removes a line from the Embed text.
+ This method is used to update the default index of the menu.
- The line to remove.
+ The new default index of the menu.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- Removes a line from the Embed text.
+ This method is used to update the placement of the menu.
- The index of the line to remove.
+ The new placement of the menu.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- Renders the Embed text.
+ This method is used to draw the menu on the console.
-
+
- Defines the number selector of the console window.
+ The class that contains the methods to create a table and display it.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- The placement of the selector on the console.
+ This property returns the title of the table.
-
+
- The line where the selector will be displayed.
+ This property returns the height of the table.
-
+
- The height of the selector.
+ This property returns the width of the table.
-
+
- The width of the selector.
+ This property returns the title of the table.
-
+
- The question to ask the user.
+ This property returns if the header is excluded.
-
+
- The minimum value of the selector.
+ This property returns if the footer is excluded.
-
+
- The maximum value of the selector.
+ This property returns the text of the footer.
-
+
- The start value of the selector.
+ This property returns if the corners are rounded.
-
+
- The step of the selector.
+ This property returns the corners of the table.
-
+
- Whether the corners of the selector are rounded.
+ This property returns the headers of the table.
-
+
- The constructor of the FloatSelector class.
+ This property returns the lines of the table.
- The question to ask the user.
- The minimum value of the selector.
- The maximum value of the selector.
- The start value of the selector.
- The step of the selector.
- The placement of the selector on the console.
- The line where the selector will be displayed.
- Whether the corners of the selector are rounded.
-
- For more information, refer to the following resources:
-
- - Documentation
- - Example Project
-
-
-
+
- This method is used to draw the selector on the console.
+ This property returns the number of lines in the table.
-
+
- Defines the number selector of the console window.
+ This property returns the display array of the table.
+
+
+
+
+ The natural constructor.
+ The title of the table.
+ The lines of the table.
+ The headers of the table.
+ Whether to exclude the header from selectable elements.
+ Whether to exclude the footer from selectable elements.
+ The text to display in the footer.
+ The placement of the table.
+ Is thrown when the number of columns in the table is not consistent with itself or with the headers.
+ Is thrown when no body lines were provided.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
-
- The placement of the selector on the console.
-
-
-
-
- The line where the selector will be displayed.
-
-
-
-
- The height of the selector.
-
-
-
-
- The width of the selector.
-
-
-
-
- The question to ask the user.
-
-
-
-
- The minimum value of the selector.
-
-
-
+
- The maximum value of the selector.
-
-
-
-
- The start value of the selector.
-
-
-
-
- The step of the selector.
+ This method updates the placement of the table.
+ The placement of the table.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- Whether the corners of the selector are rounded.
+ This method updates the text of the footer.
+
-
+
- The constructor of the intSelector class.
+ This method sets the table to exclude the header.
- The question to ask the user.
- The minimum value of the selector.
- The maximum value of the selector.
- The start value of the selector.
- The step of the selector.
- The placement of the selector on the console.
- The line where the selector will be displayed.
- Whether the corners of the selector are rounded.
+ Whether to exclude the header or not.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
-
- This method is used to draw the selector on the console.
-
-
-
+
- Defines the prompt element of the console window.
+ This method sets the table to exclude the footer.
+ Whether to exclude the footer or not.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- The placement of the prompt element.
+ This method adds headers to the table.
+ The headers to add.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
-
- The line of the prompt element in the console.
-
- We add 2 because so the prompt element does not overlap with the title.
-
-
-
- The height of the prompt element.
-
-
-
-
- The width of the prompt element.
-
- We add a margin of 2 to be sur to take in account odd question lengths.
-
-
+
- The natural constructor of the prompt element.
+ This method updates the headers of the table.
- The text on the left of the prompt element.
- The text in the center of the prompt element.
- The placement of the prompt element.
- The line of the prompt element in the console.
+ The headers to update.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- This method is used to render the prompt element on the console.
+ This method adds a title to the table.
+ The title to add.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- Defines the scrolling menu the console window.
+ This method updates the title of the table.
+ The title to update.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- The placement of the menu on the console.
+ Toggles the rounded corners of the table.
+ Whether to round the corners or not.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- The line where the menu will be displayed.
+ This property returns the specified line in the table.
+ The index of the line to return.
+ The line at the specified index.
+ Is thrown when the index is out of range.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- The height of the menu.
+ This method is used to get all the elements from a column given its index.
+ The index of the column.
+ The elements of the column.
+ Is thrown when the index is out of range.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- The width of the menu.
+ This method is used to get all the elements from a column given its header.
+ The header of the column.
+ The elements of the column.
+ Is thrown when the header is invalid.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- The question to ask the user.
+ This method adds a line to the table.
+ The line to add.
+ Is thrown when the number of columns in the table is not consistent with itself or with the headers.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- The different choices of the menu.
+ This method removes a line from the table.
+ The index of the line to remove.
+ Is thrown when the index is out of range.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- The index of the default choice(initially 0).
+ This method updates a line in the table.
+ The index of the line to update.
+ The new line.
+ Is thrown when the index is out of range.
+ Is thrown when the number of columns in the table is not consistent with itself or with the headers.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- The constructor of the ScrollingMenu class.
+ This method clears the headers of the table.
- The question to ask the user.
- The index of the default choice(initially 0).
- The placement of the menu on the console.
- The line where the menu will be displayed.
- The different choices of the menu.
For more information, refer to the following resources:
- Documentation
- - Example Project
+ - Example Project
-
+
- This method is used to draw the menu on the console.
+ This method clears the lines of the table.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
-
- The class that contains the methods to create a table and display it.
-
-
-
-
+
- This property returns the title of the table.
+ This method clears the table.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- This property returns the line to display the table on.
+ This method displays the table without interaction.
-
+
- This property returns the height of the table.
+ Defines the banner of the console window.
+
+ For more information, refer to the following resources:
+
+ - Documentation
+ - Example Project
+
+
-
+
- This property returns the width of the table.
+ The placement of the banner.
-
+
- This property returns the title of the table.
+ The height of the banner.
-
+
- This property returns if the header is excluded.
+ The width of the banner.
-
+
- This property returns if the footer is excluded.
+ The text of the banner.
-
+
- This property returns the text of the footer.
+ The upper margin of the banner.
-
+
- This property returns if the corners are rounded.
+ The lower margin of the banner.
-
+
- This property returns the corners of the table.
+ The natural constructor of the banner.
+ The text on the left of the banner.
+ The text in the center of the banner.
+ The text on the right of the banner.
+ The upper margin of the banner.
+ The lower margin of the banner.
+ The placement of the banner.
+
+ For more information, refer to the following resources:
+
+