Mpdreamz / shellprogressbar

ShellProgressBar - display progress in your console application
MIT License
1.43k stars 134 forks source link

Fixed children not drawing other children #75

Closed Bozhidar-A closed 3 years ago

Bozhidar-A commented 3 years ago

This pull request is in response to issue #71

In ProgressBar.cs the DrawChildren() function was called only if ProgressBarOnBottom was set to false.

if (child.Options.ProgressBarOnBottom)
    {
     ProgressBarBottomHalf(percentage, child.StartDate, child.EndTime, child.Message, childIndentation,
      child.Options.ProgressBarOnBottom, child.Options.ShowEstimatedDuration,
      child.EstimatedDuration);
     Console.SetCursorPosition(0, ++cursorTop);
     TopHalf();
    }
else
    {
     TopHalf();
     Console.SetCursorPosition(0, ++cursorTop);
     ProgressBarBottomHalf(percentage, child.StartDate, child.EndTime, child.Message, childIndentation,
      child.Options.ProgressBarOnBottom, child.Options.ShowEstimatedDuration,
      child.EstimatedDuration);

     DrawChildren(child.Children, childIndentation, ref cursorTop);
    }

This made children unable to draw children VsDebugConsole_2020-12-24_02-43-32

I moved the DrawChildren() call after the if(). This fixed the issue. VsDebugConsole_2020-12-24_02-43-20