Math is not strong, so here is my problem:
I use a progress bar to show progress in the background:
Snippet of my code:
int i = 0; int totalFriends = 0; foreach (dynamic friend in facebookFriends) { totalFriends++; } foreach (dynamic friend in facebookFriends) { i++; var friend = new FacebookFriend { FbId = friend["uid"].ToString() }; AccountFacebookFriendRepository.SaveOrUpdate(accountFriend); }
Now the application does much more than this, and here I am only doing a small piece of work: So, for example, before I got to this section, the progress bar had a value of 7 and after doing the work it should have reached 20, and I want update it by working with the corresponding values ββfrom 7 to 20:
I accept the following:
var intiProgressbarValue = 7; var finalProgressbarvalue = 20; foreach (dynamic friend in facebookFriends) { i++; var friend = new FacebookFriend { FbId = friend["uid"].ToString() }; AccountFacebookFriendRepository.SaveOrUpdate(accountFriend); var calculatedValue = CalculatedValue(initProgressbarValue, finalProgressBarValue,totalFriends, i); UpdateProgressBar( calculatedValue); }
Any help is much appreciated:
source share