private void Assets_OnImageReceived(ImageDownload image, AssetTexture asset)
{
int requestNbr;
bool found;
lock (syncObject)
found = currentRequests.TryGetValue(image.ID, out requestNbr);
if (asset != null && found)
{
Logger.DebugLog(String.Format("Worker {0} Downloaded texture {1}", requestNbr, image.ID));
// Free up this slot in the ThreadPool
lock (syncObject)
currentRequests.Remove(image.ID);
resetEvents[requestNbr].Set();
if (image.Success)
{
// Add to the completed texture dictionary
lock (syncObject)
completedDownloads[image.ID] = image;
}
else
{
Logger.Log(String.Format("Download of texture {0} failed. NotFound={1}", image.ID, image.NotFound),
Helpers.LogLevel.Warning);
}
// Let any subscribers know about it
if (OnDownloadFinished != null)
OnDownloadFinished(image.ID, image.Success);
}
}