void dlItem_DownloadCompleted(object sender, AsyncCompletedEventArgs e) { IGameFileDownloadable dlItem = sender as IGameFileDownloadable; if (DownloadView != null && dlItem != null) { DownloadView.UpdateDownload(sender, string.Format("{0} ({1})", dlItem.FileName, e.Cancelled ? "Cancelled" : "Complete")); m_currentDownloads.Remove(dlItem); } }
void dlItem_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e) { IGameFileDownloadable dlItem = sender as IGameFileDownloadable; if (DownloadView != null && dlItem != null && (e.ProgressPercentage == 100 || DateTime.Now.Subtract(m_dtLastDowanloadUpdate).TotalMilliseconds > 400)) { m_dtLastDowanloadUpdate = DateTime.Now; DownloadView.UpdateDownload(sender, e.ProgressPercentage); DownloadView.UpdateDownload(sender, string.Format("{0} - {1}/{2}MB", dlItem.FileName, Math.Round(e.BytesReceived / 1024.0 / 1024.0, 1), Math.Round(e.TotalBytesToReceive / 1024.0 / 1024.0, 1))); } }