예제 #1
0
 private void OnDownloadAgentError(DownloadAgentBase downloadAgent, string errorMessage)
 {
     if (DownloadFailureEvent != null)
     {
         DownloadFailureEvent(downloadAgent.Task.SerialId, downloadAgent.Task.DownloadPath, downloadAgent.Task.DownloadUri, errorMessage, downloadAgent.Task.UserData);
     }
 }
예제 #2
0
 private void OnDownloadAgentStart(DownloadAgentBase downloadAgent)
 {
     if (DownloadStartEvent != null)
     {
         DownloadStartEvent(downloadAgent.Task.SerialId, downloadAgent.Task.DownloadPath, downloadAgent.Task.DownloadUri, downloadAgent.CurrentLength, downloadAgent.Task.UserData);
     }
 }
예제 #3
0
 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);
     }
 }
예제 #4
0
        /// <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);
        }