Example #1
0
 private void OnDownloadAgentStart(DownloadAgent sender)
 {
     if (m_DownloadStartEventHandler != null)
     {
         DownloadStartEventArgs downloadStartEventArgs = DownloadStartEventArgs.Create(sender.Task.SerialId, sender.Task.DownloadPath, sender.Task.DownloadUri, sender.CurrentLength, sender.Task.UserData);
         m_DownloadStartEventHandler(this, downloadStartEventArgs);
         ReferencePool.Release(downloadStartEventArgs);
     }
 }
        /// <summary>
        /// 创建下载开始事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>创建的下载开始事件。</returns>
        public static OuterDownloadStartEventArgs Create(DownloadStartEventArgs e)
        {
            OuterDownloadStartEventArgs downloadStartEventArgs = ReferencePool.Acquire <OuterDownloadStartEventArgs>();

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