public void SyncProgress() { for (int i = 0; i < 6; i++) { // Process UI events. // js function is called in UI thread. Application.DoEvents(); Client.showProgressSync(i); System.Threading.Thread.Sleep(1000); } }