public class ConsoleProgressBar : IDisposable,
IProgress<double>
Public Class ConsoleProgressBar
Implements IDisposable, IProgress(Of Double)
Dim instance As ConsoleProgressBar
public ref class ConsoleProgressBar : IDisposable,
IProgress<double>
type ConsoleProgressBar =
class
interface IDisposable
interface IProgress<float>
end
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.
Public Module Module1
Public Sub Main()
Console.CursorVisible = False
Console.Write("Performing some task... ")
Using progress As New ConsoleProgressBar(blockCount:=20) With {
.Animation = "||//--\\".ToCharArray(),
.AnimationSpeed = TimeSpan.FromMilliseconds(125),
.AnimationBackColor = Console.BackgroundColor,
.AnimationForeColor = ConsoleColor.Yellow,
.BlockActiveChar = "█"c,
.BlockInactiveChar = "·"c,
.BlockActiveBackColor = Console.BackgroundColor,
.BlockActiveForeColor = ConsoleColor.Green,
.BlockInactiveBackColor = Console.BackgroundColor,
.BlockInactiveForeColor = ConsoleColor.DarkGray,
.BorderBackColor = Console.BackgroundColor,
.BorderForeColor = ConsoleColor.White,
.ProgressTextFormat = "{1} of {2} ({0}%)",
.ProgressTextBackColor = Console.BackgroundColor,
.ProgressTextForeColor = ConsoleColor.Gray
}
For i As Integer = 0 To 100
progress.Report(i / 100)
Thread.Sleep(100)
Next i
End Using
Console.WriteLine()
Console.WriteLine("Done.")
Console.ReadKey()
End Sub
End Module
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.
ConsoleProgressBar | Initializes a new instance of the ConsoleProgressBar class. |
Animation | Gets or sets the characters used to draw the animation secuence at the very end of the progress bar. Default value is: {"|"c, "|"c, "/"c, "/"c, "-"c, "-"c, "\"c, "\"c} ( that is: "||//--\\" ) |
AnimationBackColor | Gets or sets the ConsoleColor used to paint the background of the animation secuence. |
AnimationForeColor | Gets or sets the ConsoleColor used to paint the foreground of the borders of the animation secuence. |
AnimationSpeed | Gets or sets the speed (framerate) of the animation secuence defined in Animation. Default value is: 125 milliseconds. |
AnimationVisible | Gets or sets a value indicating whether the animation secuence is visible in the progress bar. |
BlockActiveBackColor | Gets or sets the ConsoleColor used to paint the background of an active progress bar block. |
BlockActiveChar | Gets the character used to draw an active progress bar block. Default value is: "#" |
BlockActiveForeColor | Gets or sets the ConsoleColor used to paint the foreground of an active progress bar block. |
BlockCount | Gets the amount of blocks to display in the progress bar. Default value is: 20 |
BlockInactiveBackColor | Gets or sets the ConsoleColor used to paint the background of a inactive progress bar block. |
BlockInactiveChar | Gets the character used to draw an inactive progress bar block. Default value is: "·" |
BlockInactiveForeColor | Gets or sets the ConsoleColor used to paint the foreground of a inactive progress bar block. |
BorderBackColor | Gets or sets the ConsoleColor used to paint the background of the borders of the progress bar. |
BorderForeColor | Gets or sets the ConsoleColor used to paint the foreground of the borders of the progress bar. |
CurrentProgress | Gets the current progress value. From 0.0 to 1.0 |
ProgressTextBackColor | Gets or sets the ConsoleColor used to paint the background of the progress text. |
ProgressTextForeColor | Gets or sets the ConsoleColor used to paint the foreground of the borders of the progress text. |
ProgressTextFormat | Gets or sets the format of the progress text, where: {0} = Percentage Value {1} = Current Value {2} = Maximum Value Default value is: "{0}%" |
Dispose | Releases all the resources used by this instance. |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
GetHashCode | Serves as the default hash function. (Inherited from Object) |
GetType | Gets the Type of the current instance. (Inherited from Object) |
Report | Reports a progress update. |
ToString | Returns a string that represents the current object. (Inherited from Object) |
CanConvertTo |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
CanConvertToT |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, an exception is thrown.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, returns the specified default value.
(Defined by ObjectExtensions) |
IsDisposable |
Determines whether the specified object is a disposable type
(i.e., it implements IDisposable interface).
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
ThrowIfNullTException |
Throws the specified exception if the source object is null.
(Defined by ObjectExtensions) |