Game Development Reference
In-Depth Information
public event AsyncDownloadCompleteHandler DownloadComplete;
public event AsyncDownloadProgressHandler ProgressUpdate;
private Uri address = null;
public Uri Address
get { return address; }
set { address = value; }
public void Initiate()
Thread thread = new Thread(new ThreadStart(InitiateThread));
private void InitiateThread()
if (DownloadComplete != null && address != null)
AsyncFileDownloadSystem system = new AsyncFileDownloadSystem();
byte[] data = system.DownloadFile(address, ProgressUpdate);
Maintaining Data State
The asynchronous mechanism provided by the HttpWebRequest object relies on a
chain of successively executed methods that process data in chunks. In order to
associate the data with the asynchronous mechanism, we need to build a simple
state object that will be used to store information and data related to state. The
asynchronous mechanism allows us to pass an arbitrary object between methods,
so the following class will be used as a container to pass within the asynchronous
internal class AsyncFileDownloadState
public AsyncDownloadProgressHandler ProgressUpdate;
Search Nedrilad ::

Custom Search