Monday, December 3, 2012

Silverlight Form is freezing

Silverlight Form is freezing

i am calling ~250 Javascript synchronous webservices in a loop in silverlight. This needs about 3 minutes to complete. in this time, my form is freezing and the user cant do any input and my progressbar dont update the value. This part is in the loop. the function "Unshare" do the webservice request

 object ret = HtmlPage.Window.Invoke("Unshare", acc.ToString(), SelectedUser.ToString());              if (ret != null)             {                 bool tmpBool;                 if (Boolean.TryParse(ret.ToString(), out tmpBool))                 {                     if (tmpBool)                     {                         IncreaseProgress(false);                     }                 }             } 

_

private void IncreaseProgress(bool isError)     {              FinishedAccounts++;             label_total.Content = string.Format("Total: {0} / {1}", FinishedAccounts, Accounts.Count);             progressBar1.Value += this.ProgressStep;             if (isError)             {                 Errors++;                 label_error.Content = string.Format("Error: {0}", Errors);             }     } 

how can i update the gui after each request? at the moment the gui freezes and after the ~250 webservice requests the gui is updated.

Thanks

Answers & Comments...




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog