-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fernando Cerqueira
committed
Sep 20, 2023
1 parent
fb0f70c
commit 82856e5
Showing
35 changed files
with
2,107 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using System.Globalization; | ||
using System.IO.Pipes; | ||
using PPlus; | ||
using static System.Net.Mime.MediaTypeNames; | ||
|
||
namespace TableBasicSamples | ||
{ | ||
internal class Program | ||
{ | ||
internal class MyTable | ||
{ | ||
public int Id { get; set; } | ||
public required string MyText { get; set; } | ||
public required DateTime MyDate { get; set; } | ||
} | ||
|
||
|
||
|
||
static void Main(string[] args) | ||
{ | ||
static MyTable[] CreateItem() | ||
{ | ||
return new MyTable[] | ||
{ | ||
new MyTable { Id = 1, MyDate = new DateTime().AddDays(1), MyText = "Test1" }, | ||
new MyTable { Id = 2, MyDate = new DateTime().AddDays(2), MyText = "Test2 very very very very very very very very long" }, | ||
new MyTable { Id = 3, MyDate = new DateTime().AddDays(3), MyText = "Test3" } | ||
}; | ||
} | ||
|
||
//Ensure ValueResult Culture for all controls | ||
PromptPlus.Config.DefaultCulture = new CultureInfo("en-us"); | ||
|
||
PromptPlus.Table<MyTable>() | ||
.AddItems(CreateItem()) | ||
.AddColumn((item) => item.Id, 10, null) | ||
.AddColumn((item) => item.MyDate, 15, null) | ||
.AddColumn((item) => item.MyText, 20, null,format:(arg) => $"Text: {arg}") | ||
.AddFormatType<DateTime>(FmtDate) | ||
.AddFormatType<int>(FmtInt) | ||
.EnabledInteractionUser( | ||
(item, col) => $"Current ID : {item.Id}. [yellow]Current col {col}[/]", | ||
(item, col) => $"[green]Selected ID : {item.Id}. Current col {col}[/]") | ||
.Run(); | ||
|
||
} | ||
|
||
private static string FmtInt(object arg) | ||
{ | ||
var value = (int)arg; | ||
return value.ToString(); | ||
} | ||
|
||
private static string FmtDate(object arg) | ||
{ | ||
var value = (DateTime)arg; | ||
return value.ToString("G"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Src\PromptPlus.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// *************************************************************************************** | ||
// MIT LICENCE | ||
// The maintenance and evolution is maintained by the PromptPlus project under MIT license | ||
// *************************************************************************************** | ||
|
||
namespace PPlus.Controls | ||
{ | ||
/// <summary> | ||
/// Represents the Calendar Layout | ||
/// </summary> | ||
public enum CalendarLayout | ||
{ | ||
/// <summary> | ||
/// single line grid | ||
/// </summary> | ||
SingleGrid, | ||
/// <summary> | ||
/// Double line grid | ||
/// </summary> | ||
DoubleGrid, | ||
/// <summary> | ||
/// Acsii single grid | ||
/// </summary> | ||
AsciiSingleGrid, | ||
/// <summary> | ||
/// Acsii double grid | ||
/// </summary> | ||
AsciiDoubleGrid, | ||
/// <summary> | ||
/// Heavy line grid | ||
/// </summary> | ||
HeavyGrid | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.