void Assets_ImageReceiveProgress(object sender, ImageReceiveProgressEventArgs e)
{
if (this.imageID != e.ImageID)
{
return;
}
if (InvokeRequired)
{
if (IsHandleCreated || !instance.MonoRuntime)
BeginInvoke(new MethodInvoker(() => Assets_ImageReceiveProgress(sender, e)));
return;
}
int pct = 0;
if (e.Total> 0)
{
pct = (e.Received * 100) / e.Total;
}
if (pct < 0 || pct > 100)
{
return;
}
lblProgress.Text = String.Format("{0} of {1}KB ({2}%)", (int)e.Received / 1024, (int)e.Total / 1024, pct);
progressBar1.Value = pct;
}