Пример #1
0
 //回调
 void OnSyncEvent(NotiData data)
 {
     if (this.func != null)
     {
         this.func(data);
     }
 }
Пример #2
0
        void OnExtractFile(List <object> evParams)
        {
            NotiData data = new NotiData(NotiConst.UPDATE_EXTRACT, null);

            if (m_SyncEvent != null)
            {
                m_SyncEvent(data);
            }
        }
Пример #3
0
        /// <summary>
        /// 下载成功.缓存下载的资源名称.继续开启下一步下载任务
        /// </summary>
        /// <param name="data"></param>
        void OnThreadCompleted(NotiData data)
        {
            switch (data.evName)
            {
            case NotiConst.UPDATE_EXTRACT:
                break;

            case NotiConst.UPDATE_DOWNLOAD:
                if (!downLoadFiles.Contains(data.evParam.ToString()))
                {
                    downLoadFiles.Add(data.evParam.ToString());
                }
                break;
            }
        }
Пример #4
0
        void ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            string   value = string.Format("{0}kb/s", (e.BytesReceived / 1024d / sw.Elapsed.TotalSeconds).ToString("0.00"));
            NotiData data  = new NotiData(NotiConst.UPDATE_PROGRESS, value);

            //下载成功回调
            if (m_SyncEvent != null)
            {
                m_SyncEvent(data);
            }

            if (e.ProgressPercentage == 100 && e.BytesReceived == e.TotalBytesToReceive)
            {
                sw.Reset();
                data = new NotiData(NotiConst.UPDATE_DOWNLOAD, currDownFile);
                //防止下载完成并不会执行回调
                FrameworkMain.Instance.HotMgr.downLoadFiles.Add(data.evParam.ToString());
                if (m_SyncEvent != null)
                {
                    m_SyncEvent(data);
                }
            }
        }