diff --git a/PromptPlus.sln b/PromptPlus.sln
index 63e1905b..c34f02b0 100644
--- a/PromptPlus.sln
+++ b/PromptPlus.sln
@@ -98,7 +98,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SliderSwitchSamples", "Samp
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChartSamples", "Samples\ChartSamples\ChartSamples.csproj", "{A0697CC0-24A0-48D4-BB7D-57A7DE3DBFAB}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CalendarSamples", "Samples\CalendarSamples\CalendarSamples.csproj", "{248BA41C-17EF-42E3-A9B4-17FF7FA1311B}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CalendarSamples", "Samples\CalendarSamples\CalendarSamples.csproj", "{248BA41C-17EF-42E3-A9B4-17FF7FA1311B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PipelineSamples", "Samples\PipelineSamples\PipelineSamples.csproj", "{184F90B1-EBF2-4D34-88B3-9D7A252CB2B4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -341,6 +343,12 @@ Global
{248BA41C-17EF-42E3-A9B4-17FF7FA1311B}.local|Any CPU.Build.0 = Debug|Any CPU
{248BA41C-17EF-42E3-A9B4-17FF7FA1311B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{248BA41C-17EF-42E3-A9B4-17FF7FA1311B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {184F90B1-EBF2-4D34-88B3-9D7A252CB2B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {184F90B1-EBF2-4D34-88B3-9D7A252CB2B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {184F90B1-EBF2-4D34-88B3-9D7A252CB2B4}.local|Any CPU.ActiveCfg = Debug|Any CPU
+ {184F90B1-EBF2-4D34-88B3-9D7A252CB2B4}.local|Any CPU.Build.0 = Debug|Any CPU
+ {184F90B1-EBF2-4D34-88B3-9D7A252CB2B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {184F90B1-EBF2-4D34-88B3-9D7A252CB2B4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -383,6 +391,7 @@ Global
{3702034B-7D26-4BC3-AB1E-864C2EE2D785} = {F85DFC6B-0BBA-4B8D-BBF7-8FE175FE165C}
{A0697CC0-24A0-48D4-BB7D-57A7DE3DBFAB} = {F85DFC6B-0BBA-4B8D-BBF7-8FE175FE165C}
{248BA41C-17EF-42E3-A9B4-17FF7FA1311B} = {F85DFC6B-0BBA-4B8D-BBF7-8FE175FE165C}
+ {184F90B1-EBF2-4D34-88B3-9D7A252CB2B4} = {F85DFC6B-0BBA-4B8D-BBF7-8FE175FE165C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2E883401-DEB0-496F-A6BC-8AA0F44BC5B9}
diff --git a/README.md b/README.md
index d2ff36d3..56b1a6d1 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,16 @@
- [License](#license)
- [API Reference](https://fracerqueira.github.io/PromptPlus/apis/apis.html)
-## What's News in V.4.0
+## What news in V4.0.2
+- New Control Pipeline
+ - PromptPlus.Pipeline(T startvalue)
+- Changed WaitControl to take context value in tasks and return context in result
+ - There are small break-chages
+- Add Answer key check equals "Yes"/"No" using config values
+ - IsYesResponseKey(this ConsoleKeyInfo keyinfo)
+ - IsNoResponseKey(this ConsoleKeyInfo keyinfo)
+
+## What's News in V4.0.1
### Newest controls and color improvement and layout
@@ -132,6 +141,13 @@ dotnet run --project [name of sample]
For each snapshot, the title is **name of projet** sample in folder **samples**
+### Pipeline
+
+[**Top**](#table-of-contents) | [PipelineSamples](https://github.com/FRACerqueira/PromptPlus/tree/main/Samples/PipelineSamples)
+
+**Not have snapshot**
+
+
### Input
[**Top**](#table-of-contents) | [InputBasicSamples](https://github.com/FRACerqueira/PromptPlus/tree/main/Samples/InputBasicSamples)
diff --git a/Samples/ConsoleFeaturesSamples/Program.cs b/Samples/ConsoleFeaturesSamples/Program.cs
index 4843d5eb..5c73c3e8 100644
--- a/Samples/ConsoleFeaturesSamples/Program.cs
+++ b/Samples/ConsoleFeaturesSamples/Program.cs
@@ -4,207 +4,210 @@
using PPlus;
using PPlus.Controls;
-Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
-
-PromptPlus.Clear();
-
-Console.WriteLine("\U0001F4BD");
-
-PromptPlus.WriteLine("[RGB(255,0,0) ON WHITE]Test[YELLOW] COLOR [/] BACK COLOR [/] other text");
-PromptPlus.WriteLine("[#ff0000 ON WHITE]Test [YELLOW] COLOR [/] BACK COLOR [/] other text");
-PromptPlus.WriteLine("[RED ON WHITE]Test[YELLOW] COLOR [/] BACK COLOR [/] other text");
-
-PromptPlus.WriteLine("Test", new Style(Color.White, Color.Red, Overflow.None));
-PromptPlus.WriteLine("Test", new Style(new Color(255, 255, 255), Color.Red, Overflow.None));
-PromptPlus.WriteLine("Test", new Style(Color.FromConsoleColor(ConsoleColor.White), Color.Red, Overflow.None));
-PromptPlus.WriteLine("Test", new Style(Color.FromInt32(255), Color.Red, Overflow.None));
-PromptPlus.WriteLine("Test", new Style(Color.FromHtml("#ffffff"), Color.Red, Overflow.None));
+namespace ConsoleFeaturesSamples
+{
+ internal class Program
+ {
+ static void Main()
+ {
+ PromptPlus.WriteLine("[RGB(255,0,0) ON WHITE]Test[YELLOW] COLOR [/] BACK COLOR [/] other text");
+ PromptPlus.WriteLine("[#ff0000 ON WHITE]Test [YELLOW] COLOR [/] BACK COLOR [/] other text");
+ PromptPlus.WriteLine("[RED ON WHITE]Test[YELLOW] COLOR [/] BACK COLOR [/] other text");
-PromptPlus.DoubleDash($"PromptPlus Style.OverflowEllipsis");
-PromptPlus.WriteLine("[RED ON WHITE]TESTE[YELLOW] COLOR [/] BACK COLOR [/]" + "asdajsdkldksdkasasdadasdadjashkjdahsdashdjkashdkashdkashdkashdakshdkashdkashdaskhdaskdhaskdhaskdhaskdhaskdhsakdhaskdhaskjdj", style: Style.OverflowEllipsis);
+ PromptPlus.WriteLine("Test", new Style(Color.White, Color.Red, Overflow.None));
+ PromptPlus.WriteLine("Test", new Style(new Color(255, 255, 255), Color.Red, Overflow.None));
+ PromptPlus.WriteLine("Test", new Style(Color.FromConsoleColor(ConsoleColor.White), Color.Red, Overflow.None));
+ PromptPlus.WriteLine("Test", new Style(Color.FromInt32(255), Color.Red, Overflow.None));
+ PromptPlus.WriteLine("Test", new Style(Color.FromHtml("#ffffff"), Color.Red, Overflow.None));
-PromptPlus.DoubleDash($"PromptPlus Style.OverflowCrop");
-PromptPlus.WriteLine("[RED ON WHITE]TESTE[YELLOW] COLOR [/] BACK COLOR [/]" + "asdajsdkldksdkasasdadasdadjashkjdahsdashdjkashdkashdkashdkashdakshdkashdkashdaskhdaskdhaskdhaskdhaskdhaskdhsakdhaskdhaskjdj", style: Style.OverflowCrop);
+ PromptPlus.DoubleDash($"PromptPlus Style.OverflowEllipsis");
+ PromptPlus.WriteLine("[RED ON WHITE]TESTE[YELLOW] COLOR [/] BACK COLOR [/]" + "asdajsdkldksdkasasdadasdadjashkjdahsdashdjkashdkashdkashdkashdakshdkashdkashdaskhdaskdhaskdhaskdhaskdhaskdhsakdhaskdhaskjdj", style: Style.OverflowEllipsis);
-PromptPlus.DoubleDash($"PromptPlus default");
-PromptPlus.WriteLine("[RED ON WHITE]TESTE[YELLOW] COLOR [/] BACK COLOR [/]" + "asdajsdkldksdkasasdadasdadjashkjdahsdashdjkashdkashdkashdkashdakshdkashdkashdaskhdaskdhaskdhaskdhaskdhaskdhsakdhaskdhaskjdj");
+ PromptPlus.DoubleDash($"PromptPlus Style.OverflowCrop");
+ PromptPlus.WriteLine("[RED ON WHITE]TESTE[YELLOW] COLOR [/] BACK COLOR [/]" + "asdajsdkldksdkasasdadasdadjashkjdahsdashdjkashdkashdkashdkashdakshdkashdkashdaskhdaskdhaskdhaskdhaskdhaskdhsakdhaskdhaskjdj", style: Style.OverflowCrop);
-PromptPlus
- .KeyPress()
- .Config(cfg => cfg.HideAfterFinish(true))
- .Spinner(SpinnersType.DotsScrolling)
- .Run();
+ PromptPlus.DoubleDash($"PromptPlus default");
+ PromptPlus.WriteLine("[RED ON WHITE]TESTE[YELLOW] COLOR [/] BACK COLOR [/]" + "asdajsdkldksdkasasdadasdadjashkjdahsdashdjkashdkashdkashdkashdakshdkashdkashdaskhdaskdhaskdhaskdhaskdhaskdhsakdhaskdhaskjdj");
-PromptPlus.Setup((cfg) =>
-{
- cfg.PadLeft = 2;
- cfg.PadRight = 2;
- cfg.BackgroundColor = ConsoleColor.Blue;
- cfg.Culture = new CultureInfo("en-us");
-});
-
-PromptPlus.SingleDash($"[yellow]Console Information[/]", DashOptions.DoubleBorder, 1 /*extra lines*/);
-PromptPlus.WriteLine($"IsTerminal: {PromptPlus.IsTerminal}");
-PromptPlus.WriteLine($"IsUnicodeSupported: {PromptPlus.IsUnicodeSupported}");
-PromptPlus.WriteLine($"OutputEncoding: {PromptPlus.OutputEncoding.EncodingName}");
-PromptPlus.WriteLine($"ColorDepth: {PromptPlus.ColorDepth}");
-PromptPlus.WriteLine($"BackgroundColor: {PromptPlus.BackgroundColor}");
-PromptPlus.WriteLine($"ForegroundColor: {PromptPlus.ForegroundColor}");
-PromptPlus.WriteLine($"SupportsAnsi: {PromptPlus.SupportsAnsi}");
-PromptPlus.WriteLine($"Buffers(Width/Height): {PromptPlus.BufferWidth}/{PromptPlus.BufferHeight}");
-PromptPlus.WriteLine($"PadScreen(Left/Right): {PromptPlus.PadLeft}/{PromptPlus.PadRight}\n");
-
-PromptPlus
- .KeyPress()
- .Config(cfg =>
- {
- cfg.HideAfterFinish(true)
- .ShowTooltip(false)
- .ApplyStyle(StyleControls.Tooltips,Style.Plain.Foreground(Color.Grey100));
- })
- .Spinner(SpinnersType.Balloon)
- .Run();
+ PromptPlus
+ .KeyPress()
+ .Config(cfg => cfg.HideAfterFinish(true))
+ .Spinner(SpinnersType.DotsScrolling)
+ .Run();
-PromptPlus.Clear();
-
-
-PromptPlus.DoubleDash($"[yellow]Sample Colors capacities [/]", DashOptions.HeavyBorder, 1);
-PromptPlus.Write("|");
-for (var i = 0; i < 8; i++)
-{
- var backgroundColor = Color.FromInt32(i);
- var foregroundColor = backgroundColor.GetInvertedColor();
- PromptPlus.Write(string.Format(" {0,-9}", i), new Style(foregroundColor, backgroundColor));
- if ((i + 1) % 8 == 0)
- {
- PromptPlus.WriteLine("|");
- }
-}
+ PromptPlus.Setup((cfg) =>
+ {
+ cfg.PadLeft = 2;
+ cfg.PadRight = 2;
+ cfg.BackgroundColor = ConsoleColor.Blue;
+ cfg.Culture = new CultureInfo("en-us");
+ });
+
+ PromptPlus.SingleDash($"[yellow]Console Information[/]", DashOptions.DoubleBorder, 1 /*extra lines*/);
+ PromptPlus.WriteLine($"IsTerminal: {PromptPlus.IsTerminal}");
+ PromptPlus.WriteLine($"IsUnicodeSupported: {PromptPlus.IsUnicodeSupported}");
+ PromptPlus.WriteLine($"OutputEncoding: {PromptPlus.OutputEncoding.EncodingName}");
+ PromptPlus.WriteLine($"ColorDepth: {PromptPlus.ColorDepth}");
+ PromptPlus.WriteLine($"BackgroundColor: {PromptPlus.BackgroundColor}");
+ PromptPlus.WriteLine($"ForegroundColor: {PromptPlus.ForegroundColor}");
+ PromptPlus.WriteLine($"SupportsAnsi: {PromptPlus.SupportsAnsi}");
+ PromptPlus.WriteLine($"Buffers(Width/Height): {PromptPlus.BufferWidth}/{PromptPlus.BufferHeight}");
+ PromptPlus.WriteLine($"PadScreen(Left/Right): {PromptPlus.PadLeft}/{PromptPlus.PadRight}\n");
+
+ PromptPlus
+ .KeyPress()
+ .Config(cfg =>
+ {
+ cfg.HideAfterFinish(true)
+ .ShowTooltip(false)
+ .ApplyStyle(StyleControls.Tooltips, Style.Plain.Foreground(Color.Grey100));
+ })
+ .Spinner(SpinnersType.Balloon)
+ .Run();
+
+ PromptPlus.Clear();
+
+
+ PromptPlus.DoubleDash($"[yellow]Sample Colors capacities [/]", DashOptions.HeavyBorder, 1);
+ PromptPlus.Write("|");
+ for (var i = 0; i < 8; i++)
+ {
+ var backgroundColor = Color.FromInt32(i);
+ var foregroundColor = backgroundColor.GetInvertedColor();
+ PromptPlus.Write(string.Format(" {0,-9}", i), new Style(foregroundColor, backgroundColor));
+ if ((i + 1) % 8 == 0)
+ {
+ PromptPlus.WriteLine("|");
+ }
+ }
-if (PromptPlus.ColorDepth >= ColorSystem.Standard)
-{
- PromptPlus.WriteLine();
- PromptPlus.DoubleDash($"[yellow]Sample Colors capacities Standard[/]", DashOptions.HeavyBorder, 1);
- PromptPlus.Write("|");
- for (var i = 0; i < 16; i++)
- {
- var backgroundColor = Color.FromInt32(i);
- var foregroundColor = backgroundColor.GetInvertedColor();
- PromptPlus.Write(string.Format(" {0,-9}", i), new Style(foregroundColor, backgroundColor));
- if ((i + 1) % 8 == 0)
- {
- PromptPlus.WriteLine("|");
- if ((i + 1) % 16 != 0)
+ if (PromptPlus.ColorDepth >= ColorSystem.Standard)
{
+ PromptPlus.WriteLine();
+ PromptPlus.DoubleDash($"[yellow]Sample Colors capacities Standard[/]", DashOptions.HeavyBorder, 1);
PromptPlus.Write("|");
+ for (var i = 0; i < 16; i++)
+ {
+ var backgroundColor = Color.FromInt32(i);
+ var foregroundColor = backgroundColor.GetInvertedColor();
+ PromptPlus.Write(string.Format(" {0,-9}", i), new Style(foregroundColor, backgroundColor));
+ if ((i + 1) % 8 == 0)
+ {
+ PromptPlus.WriteLine("|");
+ if ((i + 1) % 16 != 0)
+ {
+ PromptPlus.Write("|");
+ }
+ }
+ }
}
- }
- }
-}
-if (PromptPlus.ColorDepth >= ColorSystem.EightBit)
-{
- PromptPlus.WriteLine();
- PromptPlus.DoubleDash($"[yellow]Sample Colors capacities EightBit[/]", DashOptions.HeavyBorder, 1);
- for (var i = 0; i < 16; i++)
- {
- PromptPlus.Write("|");
- for (var j = 0; j < 16; j++)
- {
- var number = i * 16 + j;
- var backgroundColor = Color.FromInt32(number);
- var foregroundColor = backgroundColor.GetInvertedColor();
- PromptPlus.Write(string.Format(" {0,-4}", number), new Style(foregroundColor, backgroundColor));
- }
- PromptPlus.WriteLine("|");
- }
-}
-if (PromptPlus.ColorDepth >= ColorSystem.TrueColor)
-{
- PromptPlus.WriteLine();
- PromptPlus.DoubleDash($"[yellow]Sample Colors capacities TrueColor[/]", DashOptions.HeavyBorder, 1);
- for (var y = 0; y < 15; y++)
- {
- PromptPlus.Write("|");
- for (var x = 0; x < 90; x++)
- {
- var l = 0.1f + ((y / (float)15) * 0.7f);
- var h = x / (float)80;
- var (r1, g1, b1) = ColorFromHSL(h, l, 1.0f);
- var (r2, g2, b2) = ColorFromHSL(h, l + (0.7f / 10), 1.0f);
- var background = new Color((byte)(r1 * 255), (byte)(g1 * 255), (byte)(b1 * 255));
- var foreground = new Color((byte)(r2 * 255), (byte)(g2 * 255), (byte)(b2 * 255));
- PromptPlus.Write("▄", new Style(foreground, background));
- }
- PromptPlus.WriteLine("|");
- }
-}
-PromptPlus.WriteLines(2);
-PromptPlus.KeyPress("End Sample!, Press any key", cfg =>
- {
- cfg.ShowTooltip(false);
- cfg.ApplyStyle(StyleControls.Tooltips, Style.Plain.Foreground(Style.Plain.Background.GetInvertedColor()));
- })
- .Run();
-
-
-static (float, float, float) ColorFromHSL(double h, double l, double s)
-{
- double r = 0, g = 0, b = 0;
- if (l != 0)
- {
- if (s == 0)
- {
- r = g = b = l;
- }
- else
- {
- double temp2;
- if (l < 0.5)
+ if (PromptPlus.ColorDepth >= ColorSystem.EightBit)
{
- temp2 = l * (1.0 + s);
+ PromptPlus.WriteLine();
+ PromptPlus.DoubleDash($"[yellow]Sample Colors capacities EightBit[/]", DashOptions.HeavyBorder, 1);
+ for (var i = 0; i < 16; i++)
+ {
+ PromptPlus.Write("|");
+ for (var j = 0; j < 16; j++)
+ {
+ var number = i * 16 + j;
+ var backgroundColor = Color.FromInt32(number);
+ var foregroundColor = backgroundColor.GetInvertedColor();
+ PromptPlus.Write(string.Format(" {0,-4}", number), new Style(foregroundColor, backgroundColor));
+ }
+ PromptPlus.WriteLine("|");
+ }
}
- else
+ if (PromptPlus.ColorDepth >= ColorSystem.TrueColor)
{
- temp2 = l + s - (l * s);
+ PromptPlus.WriteLine();
+ PromptPlus.DoubleDash($"[yellow]Sample Colors capacities TrueColor[/]", DashOptions.HeavyBorder, 1);
+ for (var y = 0; y < 15; y++)
+ {
+ PromptPlus.Write("|");
+ for (var x = 0; x < 90; x++)
+ {
+ var l = 0.1f + ((y / (float)15) * 0.7f);
+ var h = x / (float)80;
+ var (r1, g1, b1) = ColorFromHSL(h, l, 1.0f);
+ var (r2, g2, b2) = ColorFromHSL(h, l + (0.7f / 10), 1.0f);
+ var background = new Color((byte)(r1 * 255), (byte)(g1 * 255), (byte)(b1 * 255));
+ var foreground = new Color((byte)(r2 * 255), (byte)(g2 * 255), (byte)(b2 * 255));
+ PromptPlus.Write("▄", new Style(foreground, background));
+ }
+ PromptPlus.WriteLine("|");
+ }
}
+ PromptPlus.WriteLines(2);
+ PromptPlus.KeyPress("End Sample!, Press any key", cfg =>
+ {
+ cfg.ShowTooltip(false);
+ cfg.ApplyStyle(StyleControls.Tooltips, Style.Plain.Foreground(Style.Plain.Background.GetInvertedColor()));
+ })
+ .Run();
- var temp1 = 2.0 * l - temp2;
-
- r = GetColorComponent(temp1, temp2, h + 1.0 / 3.0);
- g = GetColorComponent(temp1, temp2, h);
- b = GetColorComponent(temp1, temp2, h - 1.0 / 3.0);
- }
- }
-
- return ((float)r, (float)g, (float)b);
-}
-static double GetColorComponent(double temp1, double temp2, double temp3)
-{
- if (temp3 < 0.0)
- {
- temp3 += 1.0;
- }
- else if (temp3 > 1.0)
- {
- temp3 -= 1.0;
- }
+ static (float, float, float) ColorFromHSL(double h, double l, double s)
+ {
+ double r = 0, g = 0, b = 0;
+ if (l != 0)
+ {
+ if (s == 0)
+ {
+ r = g = b = l;
+ }
+ else
+ {
+ double temp2;
+ if (l < 0.5)
+ {
+ temp2 = l * (1.0 + s);
+ }
+ else
+ {
+ temp2 = l + s - (l * s);
+ }
+
+ var temp1 = 2.0 * l - temp2;
+
+ r = GetColorComponent(temp1, temp2, h + 1.0 / 3.0);
+ g = GetColorComponent(temp1, temp2, h);
+ b = GetColorComponent(temp1, temp2, h - 1.0 / 3.0);
+ }
+ }
+
+ return ((float)r, (float)g, (float)b);
- if (temp3 < 1.0 / 6.0)
- {
- return temp1 + (temp2 - temp1) * 6.0 * temp3;
- }
- else if (temp3 < 0.5)
- {
- return temp2;
- }
- else if (temp3 < 2.0 / 3.0)
- {
- return temp1 + ((temp2 - temp1) * ((2.0 / 3.0) - temp3) * 6.0);
- }
- else
- {
- return temp1;
+ }
+ static double GetColorComponent(double temp1, double temp2, double temp3)
+ {
+ if (temp3 < 0.0)
+ {
+ temp3 += 1.0;
+ }
+ else if (temp3 > 1.0)
+ {
+ temp3 -= 1.0;
+ }
+
+ if (temp3 < 1.0 / 6.0)
+ {
+ return temp1 + (temp2 - temp1) * 6.0 * temp3;
+ }
+ else if (temp3 < 0.5)
+ {
+ return temp2;
+ }
+ else if (temp3 < 2.0 / 3.0)
+ {
+ return temp1 + ((temp2 - temp1) * ((2.0 / 3.0) - temp3) * 6.0);
+ }
+ else
+ {
+ return temp1;
+ }
+ }
+ }
}
}
diff --git a/Samples/MultiSelectBasicSamples/Properties/launchSettings.json b/Samples/MultiSelectBasicSamples/Properties/launchSettings.json
new file mode 100644
index 00000000..33504c94
--- /dev/null
+++ b/Samples/MultiSelectBasicSamples/Properties/launchSettings.json
@@ -0,0 +1,8 @@
+{
+ "profiles": {
+ "WSL": {
+ "commandName": "WSL2",
+ "distributionName": ""
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/PipelineSamples/PipelineSamples.csproj b/Samples/PipelineSamples/PipelineSamples.csproj
new file mode 100644
index 00000000..001b416c
--- /dev/null
+++ b/Samples/PipelineSamples/PipelineSamples.csproj
@@ -0,0 +1,14 @@
+
+
+
+ Exe
+ net7.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/Samples/PipelineSamples/Program.cs b/Samples/PipelineSamples/Program.cs
new file mode 100644
index 00000000..c2cbda26
--- /dev/null
+++ b/Samples/PipelineSamples/Program.cs
@@ -0,0 +1,196 @@
+using System.Globalization;
+using PPlus;
+
+namespace PipelineSamples
+{
+ internal class Program
+ {
+ private enum Mypipes
+ {
+ FirstName,
+ LastName,
+ Confirm
+ }
+
+ private class MyClassPipeline
+ {
+ public string FirtName { get; set; } = string.Empty;
+ public string LastName { get; set; } = string.Empty;
+ }
+
+ static void Main(string[] args)
+ {
+ Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
+
+ PromptPlus.Clear();
+
+ PromptPlus.DoubleDash("Control Pipeline");
+
+ var pl = PromptPlus.Pipeline(new MyClassPipeline())
+ .AddPipe("First Name",
+ (eventpipe, stoptoken) =>
+ {
+ var result = PromptPlus.Input(eventpipe.CurrentPipe,"If first name is empty not get lastname and not confim inputs")
+ .Default(eventpipe.Input.FirtName ?? string.Empty)
+ .Run();
+ if (result.IsAborted)
+ {
+ eventpipe.AbortPipeline();
+ }
+ else
+ {
+ eventpipe.Input.FirtName = result.Value;
+ }
+ })
+ .AddPipe("Last Name",
+ (eventpipe, stoptoken) =>
+ {
+ var result = PromptPlus.Input(eventpipe.CurrentPipe)
+ .Default(eventpipe.Input.LastName ?? string.Empty)
+ .Run();
+ if (result.IsAborted)
+ {
+ eventpipe.AbortPipeline();
+ }
+ else
+ {
+ eventpipe.Input.LastName = result.Value;
+ }
+ },
+ (eventpipe, stoptoken) =>
+ {
+ if (eventpipe.Input.FirtName?.Length > 0)
+ {
+ return true;
+ }
+ return false;
+ })
+ .AddPipe("Confirm",
+ (eventpipe, stoptoken) =>
+ {
+ var result = PromptPlus.Confirm(eventpipe.CurrentPipe)
+ .Run();
+ if (result.IsAborted)
+ {
+ eventpipe.AbortPipeline();
+ }
+ else
+ {
+ if (!result.Value.IsYesResponseKey())
+ {
+ eventpipe.NextPipe("First Name");
+ }
+ }
+ })
+ .Run();
+
+
+ if (!pl.IsAborted)
+ {
+ if ((pl.Value.Context.FirtName!.Trim() + pl.Value.Context.LastName!.Trim()).Length > 0)
+ {
+ var last = pl.Value.Context.LastName!.Trim();
+ if (last.Length > 0)
+ {
+ last = $", {last}";
+ }
+ PromptPlus.WriteLine($"You input is {pl.Value.Context.FirtName!}{last}");
+ }
+ else
+ {
+ PromptPlus.WriteLine($"You input is empty");
+ }
+ }
+
+ PromptPlus.DoubleDash("Control Pipeline by enum");
+
+ var pl1 = PromptPlus.Pipeline(new MyClassPipeline())
+ .AddPipe(Mypipes.FirstName,
+ (eventpipe, stoptoken) =>
+ {
+ var result = PromptPlus.Input("Your First Name", "If first name is empty not get lastname and not confim inputs")
+ .Default(eventpipe.Input.FirtName ?? string.Empty)
+ .Run();
+ if (result.IsAborted)
+ {
+ eventpipe.AbortPipeline();
+ }
+ else
+ {
+ eventpipe.Input.FirtName = result.Value;
+ }
+ })
+ .AddPipe(Mypipes.LastName,
+ (eventpipe, stoptoken) =>
+ {
+ var result = PromptPlus.Input("Your Last Name")
+ .Default(eventpipe.Input.LastName ?? string.Empty)
+ .Run();
+ if (result.IsAborted)
+ {
+ eventpipe.AbortPipeline();
+ }
+ else
+ {
+ eventpipe.Input.LastName = result.Value;
+ }
+ },
+ (eventpipe, stoptoken) =>
+ {
+ if (eventpipe.Input.FirtName?.Length > 0)
+ {
+ return true;
+ }
+ return false;
+ })
+ .AddPipe(Mypipes.Confirm,
+ (eventpipe, stoptoken) =>
+ {
+ var result = PromptPlus.Confirm("Confirm all inputs")
+ .Run();
+ if (result.IsAborted)
+ {
+ eventpipe.AbortPipeline();
+ }
+ else
+ {
+ if (!result.Value.IsYesResponseKey())
+ {
+ eventpipe.NextPipe(Mypipes.FirstName);
+ }
+ }
+ },
+ (eventpipe, stoptoken) =>
+ {
+ if (eventpipe.Input.FirtName?.Length > 0)
+ {
+ return true;
+ }
+ return false;
+ })
+ .Run();
+
+ if (!pl1.IsAborted)
+ {
+ if ((pl1.Value.Context.FirtName!.Trim() + pl1.Value.Context.LastName!.Trim()).Length > 0)
+ {
+ var last = pl1.Value.Context.LastName!.Trim();
+ if (last.Length > 0)
+ {
+ last = $", {last}";
+ }
+ PromptPlus.WriteLine($"You input is {pl1.Value.Context.FirtName!}{last}");
+ }
+ else
+ {
+ PromptPlus.WriteLine($"You input is empty");
+ }
+ }
+
+ PromptPlus.WriteLines(2);
+ PromptPlus.KeyPress("End Sample!, Press any key", cfg => cfg.ShowTooltip(false))
+ .Run();
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/WaitTasksSamples/Program.cs b/Samples/WaitTasksSamples/Program.cs
index 0c55bef7..7c6619a9 100644
--- a/Samples/WaitTasksSamples/Program.cs
+++ b/Samples/WaitTasksSamples/Program.cs
@@ -23,23 +23,23 @@ static void Main(string[] args)
.Run();
PromptPlus.DoubleDash($"Control:WaitProcess - normal usage sequencial mode");
- var wt1 = PromptPlus.WaitProcess("wait process", "main desc")
+ var wt1 = PromptPlus.WaitProcess