Class LoadingBar
- Namespace
- ConsoleAppVisuals.AnimatedElements
- Assembly
- ConsoleAppVisuals.dll
The LoadingBar is a passive element that displays a loading bar using a reference to a progress variable.
public class LoadingBar : AnimatedElement
- Inheritance
-
LoadingBar
- Inherited Members
Remarks
For more information, consider visiting the documentation available here.
Constructors
LoadingBar(string, ref float, Placement, int)
The LoadingBar is a passive element that displays a loading bar using a reference to a progress variable.
public LoadingBar(string text, ref float progress, Placement placement = Placement.TopCenter, int additionalDuration = 1000)
Parameters
text
stringThe text of the loading bar.
progress
floatThe reference of the progress of the loading bar (that means that you should put a reference to a variable that will contain the percentage of progress of your process).
placement
PlacementThe placement of the loading bar.
additionalDuration
intThe duration of the loading bar after the process.
Remarks
For more information, consider visiting the documentation available here.
Properties
AdditionalDuration
Gets the additional duration of the loading bar at the end.
public int AdditionalDuration { get; }
Property Value
Height
Gets the height of the loading bar.
public override int Height { get; }
Property Value
Remarks
One line for the text,one line for the space between and one line for the progress.
Placement
Gets the placement of the loading bar.
public override Placement Placement { get; }
Property Value
Progress
Gets the progress of the loading bar.
public float Progress { get; }
Property Value
Text
Gets the text of the loading bar.
public string Text { get; }
Property Value
Width
Gets the width of the loading bar.
public override int Width { get; }
Property Value
Methods
RenderElementActions()
Defines the actions to perform when the element is called to be rendered on the console.
[Visual]
protected override void RenderElementActions()
UpdateAdditionalDuration(int)
Updates the additional duration of the loading bar.
public void UpdateAdditionalDuration(int additionalDuration)
Parameters
additionalDuration
intThe new additional duration of the loading bar.
Remarks
For more information, consider visiting the documentation available here.
Exceptions
- ArgumentException
The additional duration of the loading bar cannot be negative.
UpdatePlacement(Placement)
Updates the placement of the loading bar.
public void UpdatePlacement(Placement placement)
Parameters
placement
PlacementThe new placement of the loading bar.
Remarks
For more information, consider visiting the documentation available here.
UpdateProgress(float)
Updates the progress of the loading bar.
public void UpdateProgress(float progress)
Parameters
progress
floatThe new progress of the loading bar.
Remarks
For more information, consider visiting the documentation available here.
UpdateText(string)
Updates the text of the loading bar.
public void UpdateText(string text)
Parameters
text
stringThe new text of the loading bar.
Remarks
For more information, consider visiting the documentation available here.