Exemplo n.º 1
0
 private void OnDownloadAgentFailure(DownloadAgent sender, string errorMessage)
 {
     if (m_DownloadFailureEventHandler != null)
     {
         DownloadFailureEventArgs downloadFailureEventArgs = DownloadFailureEventArgs.Create(sender.Task.SerialId, sender.Task.DownloadPath, sender.Task.DownloadUri, errorMessage, sender.Task.UserData);
         m_DownloadFailureEventHandler(this, downloadFailureEventArgs);
         ReferencePool.Release(downloadFailureEventArgs);
     }
 }
Exemplo n.º 2
0
 private void OnDownloadAgentSuccess(DownloadAgent sender, int lastDownloadedLength)
 {
     if (m_DownloadSuccessEventHandler != null)
     {
         DownloadSuccessEventArgs downloadSuccessEventArgs = DownloadSuccessEventArgs.Create(sender.Task.SerialId, sender.Task.DownloadPath, sender.Task.DownloadUri, sender.CurrentLength, sender.Task.UserData);
         m_DownloadSuccessEventHandler(this, downloadSuccessEventArgs);
         ReferencePool.Release(downloadSuccessEventArgs);
     }
 }
Exemplo n.º 3
0
 private void OnDownloadAgentProgressChanged(DownloadAgent sender, float progress)
 {
     if (m_DownloadProcessChangedEventHandler != null)
     {
         DownloadProgressEventArgs downloadProgressEventArgs = DownloadProgressEventArgs.Create(sender.Task.SerialId, sender.Task.DownloadPath, sender.Task.DownloadUri, progress, sender.Task.UserData);
         m_DownloadProcessChangedEventHandler(this, downloadProgressEventArgs);
         ReferencePool.Release(downloadProgressEventArgs);
     }
 }
Exemplo n.º 4
0
 private void OnDownloadAgentUpdate(DownloadAgent sender, int lastDownloadedLength)
 {
     //m_DownloadCounter.RecordDownloadedLength(lastDownloadedLength);
     if (m_DownloadUpdateEventHandler != null)
     {
         DownloadUpdateEventArgs downloadUpdateEventArgs = DownloadUpdateEventArgs.Create(sender.Task.SerialId, sender.Task.DownloadPath, sender.Task.DownloadUri, sender.CurrentLength, sender.Task.UserData);
         m_DownloadUpdateEventHandler(this, downloadUpdateEventArgs);
         ReferencePool.Release(downloadUpdateEventArgs);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// 增加下载代理辅助器。
        /// </summary>
        /// <param name="downloadAgentHelper">要增加的下载代理辅助器。</param>
        public void AddDownloadAgentHelper(IDownloadAgentHelper downloadAgentHelper)
        {
            DownloadAgent agent = new DownloadAgent(downloadAgentHelper);

            agent.DownloadAgentStart    += OnDownloadAgentStart;
            agent.DownloadAgentUpdate   += OnDownloadAgentUpdate;
            agent.DownloadAgentSuccess  += OnDownloadAgentSuccess;
            agent.DownloadAgentFailure  += OnDownloadAgentFailure;
            agent.DownloadAgentProgress += OnDownloadAgentProgressChanged;
            m_TaskPool.AddAgent(agent);
        }