Wrong e.Percentage shown by "Work" status handler
Vladimir Shaphirov
Posts: 2
Hi,
I hooked Work's Status (the event handler) to a debug procedure that prints the percentage and a status message
work.Status = new StatusEventHandler(DBSyncManager_OnProgress);
After I call work.BuildDifferences ,using the following
work.BuildFromDifferences(differences, Options.Default, true);
I am getting 5 digits percentages displayed in my log :
Calculating work to do : 0
100
200
...
33800
Is it a bug ? If not how can I get Work's percentage calculated in regular 100% format?
Thanks
I hooked Work's Status (the event handler) to a debug procedure that prints the percentage and a status message
work.Status = new StatusEventHandler(DBSyncManager_OnProgress);
After I call work.BuildDifferences ,using the following
work.BuildFromDifferences(differences, Options.Default, true);
I am getting 5 digits percentages displayed in my log :
Calculating work to do : 0
100
200
...
33800
Is it a bug ? If not how can I get Work's percentage calculated in regular 100% format?
Thanks
Comments
Yes, I see what you're talking about from when I run the SQL Compare code snippets. When I compare a larger database (not the example widget databases), I do seem to get a much lower percentage, it only goes up to 275%. I think that the issue is that on smaller databases, the estimation of the work that needs to be done gets way off, because the first time the StatusEventHandler gets called, the e.Percentage is already 100%!
I'll see if I can contact David Connell about this, as he's got a better understanding about the StatusEventHandler delegates in SQL Toolkit.
You need a seperate delegate for the work if you're going to calculate percentage and set your progress bar to the max of the number of work items or do some fancy divide by some number to equal 100 so that you don't blow out your progress bar.
I broke that in so many ways when playing around with this...
Anyway, best way is to do something like this...
Then here is the one for your ProgressBar:
I guess it's 1 point for each difference...I think...Test this and see if it works for you
Actually, I guess this wouldn't work, you'd have to re-calculate the percentage everytime you entered the delegate...that's not a good thing.
Guess it's a bug!!