public void ImmUpdateThread(Object parameter) { ImmediateUpdateCompletedRoutine icr = parameter as ImmediateUpdateCompletedRoutine; frmUpdates fupdate = new frmUpdates(this); fupdate.Show(); immShown = true; try { while (fupdate.Visible) { Application.DoEvents(); } } catch (Exception e) { //MessageBox.Show("Unexpected exception:" + e.Message + " in " + e.Source); Debug.Print("unhandled exception:" + e.Message + " in " + e.Source); } if (icr != null) { icr(this); } }
//downloads this update; shows a UI as well. public void DownloadUpdate(ImmediateUpdateCompletedRoutine Callback) { UpdateSuccessful = false; ImmediateUpdate = new Thread(ImmUpdateThread); //download the update, ImmediateUpdate.Start(Callback); downloadinprogress = false; while (immShown == false) { Application.DoEvents(); } //return fupdate.ImmediateFilename; }