Hello,
I have the code in the snippet that takes a long time to display and image. Whats the best way, I can optimize the response speed?
private void _GetImage(string text)
{
try
{
string html;
using (WebClient wc = new WebClient())
{
//Set the game's title ID page as the page's source that we're looking at
html = wc.DownloadString("http://marketplace.xbox.com/en-US/games/media/66acd000-77fe-1000-9115-d802" + text);
}
object[] oPageText = { html };
HTMLDocument doc = new HTMLDocumentClass();
IHTMLDocument2 doc2 = (IHTMLDocument2)doc;
doc2.write(oPageText);
foreach (IHTMLElement div in doc.getElementsByTagName("div"))
{
if (div.className == "ImageArea")
{
string imagePath = div.innerHTML.Remove(0, 27);
pictureBox1.ImageLocation = imagePath.Remove(imagePath.Length - 2, 2);
break;
}
}
}
catch
{
MessageBox.Show("An error has occured","Error");
}
}