示例#1
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);
     }
 }
示例#2
0
        /// <summary>
        /// 创建下载更新事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>创建的下载更新事件。</returns>
        public static OuterDownloadUpdateEventArgs Create(DownloadUpdateEventArgs e)
        {
            OuterDownloadUpdateEventArgs downloadUpdateEventArgs = ReferencePool.Acquire <OuterDownloadUpdateEventArgs>();

            downloadUpdateEventArgs.SerialId      = e.SerialId;
            downloadUpdateEventArgs.DownloadPath  = e.DownloadPath;
            downloadUpdateEventArgs.DownloadUri   = e.DownloadUri;
            downloadUpdateEventArgs.CurrentLength = e.CurrentLength;
            downloadUpdateEventArgs.UserData      = e.UserData;
            return(downloadUpdateEventArgs);
        }