private void OnDownloadAgentError(DownloadAgentBase downloadAgent, string errorMessage) { if (DownloadFailureEvent != null) { DownloadFailureEvent(downloadAgent.Task.SerialId, downloadAgent.Task.DownloadPath, downloadAgent.Task.DownloadUri, errorMessage, downloadAgent.Task.UserData); } }
private void OnDownloadAgentStart(DownloadAgentBase downloadAgent) { if (DownloadStartEvent != null) { DownloadStartEvent(downloadAgent.Task.SerialId, downloadAgent.Task.DownloadPath, downloadAgent.Task.DownloadUri, downloadAgent.CurrentLength, downloadAgent.Task.UserData); } }
private void OnDownloadAgentSuccess(DownloadAgentBase downloadAgent, int lastDownloadedLength) { m_DownloadCounter.RecordDownloadedLength(lastDownloadedLength); if (DownloadSuccessEvent != null) { DownloadSuccessEvent(downloadAgent.Task.SerialId, downloadAgent.Task.DownloadPath, downloadAgent.Task.DownloadUri, downloadAgent.CurrentLength, downloadAgent.Task.UserData); } }
/// <summary> /// 增加下载代理辅助器 /// </summary> /// <param name="downloadAgentHelper">要增加的下载代理辅助器</param> public void AddDownloadAgent(DownloadAgentBase downloadAgent) { downloadAgent.DownloadAgentStart += OnDownloadAgentStart; downloadAgent.DownloadAgentUpdate += OnDownloadAgentUpdate; downloadAgent.DownloadAgentSuccess += OnDownloadAgentSuccess; downloadAgent.DownloadAgentError += OnDownloadAgentError; m_TaskPool.AddAgent(downloadAgent); }