TypeWritterWriteColorLineTask(CancellationToken, String, ConsoleColor, ConsoleColor, Int32, Int32) Method
Asynchronously writes colored text simulating a typewritter effect, and adds an empty line at the end.
Namespace: DevCase.Core.Application.ConsoleAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
Public Shared Function WriteColorLineTask (
cancellationToken As CancellationToken,
text As String,
foreColor As ConsoleColor,
backColor As ConsoleColor,
Optional typeSpeed As Integer = 75,
Optional pauseDuration As Integer = 400
) As Task
Dim cancellationToken As CancellationToken
Dim text As String
Dim foreColor As ConsoleColor
Dim backColor As ConsoleColor
Dim typeSpeed As Integer
Dim pauseDuration As Integer
Dim returnValue As Task
returnValue = TypeWritter.WriteColorLineTask(cancellationToken,
text, foreColor, backColor, typeSpeed,
pauseDuration)
static member WriteColorLineTask :
cancellationToken : CancellationToken *
text : string *
foreColor : ConsoleColor *
backColor : ConsoleColor *
?typeSpeed : int *
?pauseDuration : int
(* Defaults:
let _typeSpeed = defaultArg typeSpeed 75
let _pauseDuration = defaultArg pauseDuration 400
*)
-> Task
No code example is currently available or this language may not be supported.
- cancellationToken CancellationToken
-
A CancellationToken that you must use to cancel this Task.
- text String
-
The text to write.
- foreColor ConsoleColor
-
The text color.
- backColor ConsoleColor
-
The background color.
- typeSpeed Int32 (Optional)
-
The typying speed, in ms.
- pauseDuration Int32 (Optional)
-
The pause duration of the punctuation characters, in ms.
Task
A
Task object to asynchronously write colored text simulating a typewritter effect.
This is a code example.
No code example is currently available or this language may not be supported.
Dim typeCancellation As New CancellationTokenSource
Dim typeTask As Task = TypeWritter.WriteColorLineAsync(typeCancellation.Token, "*F10*Hello *F14*World!*-F*", {"*"c}, typeSpeed:=150)
typeTask.Start()
' Do some work while typewritting...
For x As Integer = 0 To 10
Thread.Sleep(100)
Debug.WriteLine(x)
Next
'' Work is done, and here you can cancel the task as you like...
' typeCancellation.Cancel()
' typeTask.Wait()
' Console.Write(" Finished.")
Console.ReadKey()
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.