//回调 void OnSyncEvent(NotiData data) { if (this.func != null) { this.func(data); } }
void OnExtractFile(List <object> evParams) { NotiData data = new NotiData(NotiConst.UPDATE_EXTRACT, null); if (m_SyncEvent != null) { m_SyncEvent(data); } }
/// <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; } }
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); } } }