pieceofsummer / Hangfire.Console

Job console extension for Hangfire
MIT License
436 stars 80 forks source link

Can not get progress bar to display #55

Closed rparies closed 6 years ago

rparies commented 6 years ago

Hello, i am trying to use the progress bar

I have tried a couple of different ways but can not get the progress bar to every display in hangfire


 public void WriteToConsoleProgress(int val)
        {
            if (context != null)
            {
                System.Diagnostics.Debug.WriteLine("WriteToConsoleProgress=" + val);
                if (iProgressBar == null)
                {
                    iProgressBar = ConsoleExtensions.WriteProgressBar(context, "BankBillPay", (double)val, ConsoleTextColor.Cyan);
                    iProgressBar.SetValue(0);
                }
                iProgressBar.SetValue(val);
            }
        }

and this way

 public void WriteToConsoleProgress(int val)
        {
            if (context != null)
            {
                System.Diagnostics.Debug.WriteLine("WriteToConsoleProgress=" + val);
                if (iProgressBar == null)
                {
                    iProgressBar = context.WriteProgressBar();
                    iProgressBar.SetValue(0);
                }
                iProgressBar.SetValue(val);
            }
        }

I get no exceptions and no display.

thanks for any help

pieceofsummer commented 6 years ago

Are you sure context is not null, and the code actually executes? Also, there's no need to check whether the context is null because WriteProgressBar handles that internally (it would return a dummy object, so you don't need to bother with NREs too).

rparies commented 6 years ago

hello, thanks for responding.

i can watch via debugger and it is for-sure not null (after i initialize the first time). So is it suppose to update the progress bar or create a new one each time? i assume it should just update.

so to use this correctly. i create an context.WriteProgressBar() which returns an iProgressBar and then i keep setting a new value for that iProgressBar correct?

Thanks

pieceofsummer commented 6 years ago

i create an context.WriteProgressBar() which returns an iProgressBar and then i keep setting a new value for that iProgressBar correct?

Yes, that's correct.

If you've previously used Hangfire and just installed Console (or updated from a very old version) try clearing browser cache, in case there's some cached JS/CSS.

rparies commented 6 years ago

Thanks for your help, the css does not make a difference. I even tried a browser that i never use just to make sure.

do i need to be using a particular version of hangfire?

I do see something like this ( just no display). Am i maybe missing a css or other supporting file?

<div class="line pb" data-id="1"><span data-moment-title="1519400663" title="Fri, Feb 23, 2018 8:44 AM" data-container="body" data-original-title="Fri, Feb 23, 2018 8:44 AM">+20.045s</span><div class="pv" style="width:35%" data-value="35"></div></div>

rparies commented 6 years ago

Ok, found this issue. Uninstalled the package and reinstalled and everything is working

pieceofsummer commented 6 years ago

Ok, I’m closing the issue.