Skip to content

Instantly share code, notes, and snippets.

@buchmoyerm
Last active August 29, 2015 14:06
Show Gist options
  • Save buchmoyerm/5db4d4612a18bd2ee219 to your computer and use it in GitHub Desktop.
Save buchmoyerm/5db4d4612a18bd2ee219 to your computer and use it in GitHub Desktop.
class MyForm
{
public void UpdateProgress(int step) {
if (InvokeRequired) {
this.Invoke(new Action<int>(UpdateProgress), step);
} else {
prgOverallProgress.Value = step;
}
}
public void DoBtnClick()
{
Task.Factory.StartNew(() =>
{
var c = new MyClass();
c.GetTeamProjects(UpdateProgress);
});
}
}
class MyClass
{
void GetTeamProjects(Action<int> updateStatus)
{
//do stuff
//on update of the status
updateStatus(x);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment