PrimWorkshop: Adds back in download progress indicator

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2720 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
Jim Radford
2009-05-08 21:39:06 +00:00
parent f164ef7e8d
commit f92d76d2b7

View File

@@ -165,6 +165,7 @@ namespace PrimWorkshop
Client.Terrain.OnLandPatch += new TerrainManager.LandPatchCallback(Terrain_OnLandPatch);
Client.Parcels.OnSimParcelsDownloaded += new ParcelManager.SimParcelsDownloaded(Parcels_OnSimParcelsDownloaded);
Client.Assets.OnImageRecieveProgress += new AssetManager.ImageReceiveProgressCallback(Assets_OnImageRecieveProgress);
// Initialize the camera object
InitCamera();
@@ -189,6 +190,7 @@ namespace PrimWorkshop
*/
}
private void InitOpenGL()
{
Gl.glShadeModel(Gl.GL_SMOOTH);
@@ -1486,50 +1488,50 @@ StartRender:
Console.WriteLine(ex);
}
}
private void Assets_OnImageRecieveProgress(UUID imageID, int recieved, int total)
{
lock (DownloadList)
{
GlacialComponents.Controls.GLItem item;
if (DownloadList.TryGetValue(imageID, out item))
{
// Update an existing item
BeginInvoke(
(MethodInvoker)delegate()
{
ProgressBar prog = (ProgressBar)item.SubItems[1].Control;
if (total >= recieved)
prog.Value = (int)Math.Round((((double)recieved / (double)total) * 100.0d));
});
}
else
{
// Progress bar
ProgressBar prog = new ProgressBar();
prog.Minimum = 0;
prog.Maximum = 100;
if (total >= recieved)
prog.Value = (int)Math.Round((((double)recieved / (double)total) * 100.0d));
else
prog.Value = 0;
//private void TextureDownloader_OnDownloadProgress(UUID image, int recieved, int total)
//{
// lock (DownloadList)
// {
// GlacialComponents.Controls.GLItem item;
// if (DownloadList.TryGetValue(image, out item))
// {
// // Update an existing item
// BeginInvoke(
// (MethodInvoker)delegate()
// {
// ProgressBar prog = (ProgressBar)item.SubItems[1].Control;
// if (total >= recieved)
// prog.Value = (int)Math.Round((((double)recieved / (double)total) * 100.0d));
// });
// }
// else
// {
// // Progress bar
// ProgressBar prog = new ProgressBar();
// prog.Minimum = 0;
// prog.Maximum = 100;
// if (total >= recieved)
// prog.Value = (int)Math.Round((((double)recieved / (double)total) * 100.0d));
// else
// prog.Value = 0;
// List item
item = new GlacialComponents.Controls.GLItem();
item.SubItems[0].Text = imageID.ToString();
item.SubItems[1].Control = prog;
// // List item
// item = new GlacialComponents.Controls.GLItem();
// item.SubItems[0].Text = image.ToString();
// item.SubItems[1].Control = prog;
DownloadList[imageID] = item;
// DownloadList[image] = item;
// BeginInvoke(
// (MethodInvoker)delegate()
// {
// lstDownloads.Items.Add(item);
// lstDownloads.Invalidate();
// });
// }
// }
//}
BeginInvoke(
(MethodInvoker)delegate()
{
lstDownloads.Items.Add(item);
lstDownloads.Invalidate();
});
}
}
}
#endregion Texture Downloading