private static void closeDispatcherTimer() { Log.i("UploadVoiceService", "all ready, close dispatcher timer. "); mTimerObject.stop(); //mTimerObject.Stop(); //mTimerObject.Close(); //mTimerObject.Dispose(); mTimerObject = null; }
private static void closeDispatcherTimer() { if (mTimerObject != null) { mTimerObject.stop(); mTimerObject = null; Log.d("UploadVideoService", "all ready, close dispatcher timer. null "); } Log.d("UploadVideoService", "all ready, close dispatcher timer. count " + UploadVideoContextMgr.getInstance().getCount()); }
public static void onVoiceContextDispatcher(object sender, EventArgs e) { DownloadVoiceContextMgr.getInstance().clearnFinishedContext(); //if (DownloadVoiceContextMgr.getInstance().getCount() <= 0) //{ // DownloadVoiceStorage.loadDownloadVoiceContextList(); //} if (DownloadVoiceContextMgr.getInstance().getCount() <= 0) { Log.i("DownloadVoiceService", "all ready, close dispatcher timer. "); if (isFirstSync) { ServiceCenter.sceneNewSync.unsetRecvMsgStatus(RecvMsgStatus.isRecvVoice); //EventCenter.postEvent(EventConst.ON_NETSCENE_DOWNLOADVOICE_SERVICE_FINISH, null, null); isFirstSync = false; } //if (isAppActive) //{ // ServiceCenter.sceneNewSync.unsetRecvMsgStatus(RecvMsgStatus.isRecvVoice); // EventCenter.postEvent(EventConst.ON_NETSCENE_DOWNLOADVOICE_SERVICE_FINISH, null, null); // isAppActive = false; //} if (mTimerObject != null) { mTimerObject.stop(); mTimerObject = null; } } else { int num = DownloadVoiceContextMgr.getInstance().countRunningContext(); int num2 = (int)getDownloadPackNum(); if (num >= num2) { Log.i("DownloadVoiceService", "return request, because reach MaxRunningNum = " + num2); } else { for (int i = 0; i < (num2 - num); i++) { DownloadVoiceContext voiceContext = DownloadVoiceContextMgr.getInstance().getFirstContextNeedHandle(); if (voiceContext == null) { return; } Log.i("DownloadVoiceService", "new task startup, mMsgSvrID = " + voiceContext.mMsgSvrID); NetSceneDownloadVoice voice = new NetSceneDownloadVoice(); voice.mOnSceneFinished += new onSceneDownloadFinishedDelegate(DownloadVoiceService.onSceneFinished); voice.doScene(voiceContext); } } } }
public void onVideoDownContextDispatcher(object sender, EventArgs e) { DownloadVideoContextMgr.getInstance().clearnFinishedContext(); if (DownloadVideoContextMgr.getInstance().getCount() <= 0) { Log.d("DownloadVideoService", "all ready, close dispatcher timer. "); mTimerObject.stop(); mTimerObject = null; } else if (DownloadVideoContextMgr.getInstance().countRunningContext() < MAX_RUNNING) { DownloadVideoContext context = DownloadVideoContextMgr.getInstance().getFirstContextNeedHandle(); if (context != null) { Log.i("DownloadVideoService", "new task startup, msgid = " + context.mVideoInfo.nMsgSvrID); context.startScene(); } } }
//private void onAccountLoginProc(EventWatcher watcher, BaseEventArgs evtArgs) //{ // List<ChatMsg> msgList = StorageMgr.chatMsg.searhCacheMsg(3, 0, 1); // List<ChatMsg> list2 = StorageMgr.chatMsg.searhCacheMsg(0x27, 0, 1); // if ((list2 != null) && (list2.Count > 0)) // { // if (msgList == null) // { // msgList = new List<ChatMsg>(); // } // foreach (ChatMsg msg in list2) // { // msgList.Add(msg); // } // } // if ((msgList != null) && (msgList.Count > 0)) // { // foreach (ChatMsg msg2 in msgList) // { // msg2.nStatus = 1; // } // //StorageMgr.chatMsg.updateMsgList(msgList); // } //} private void onImageContextDispatcher(object sender, EventArgs e) { UpLoadImgContextMgr.getInstance().clearnFinishedContext(); if (UpLoadImgContextMgr.getInstance().countRunningContext() < MAX_RUNNING) { UpLoadImgContext imgContext = UpLoadImgContextMgr.getInstance().getFirstContextNeedHandle(); if (imgContext == null) { Log.i("UploadImgService", "No more image need send. "); if (UpLoadImgContextMgr.getInstance().countRunningContext() == 0) { //List<ChatMsg> msgList = StorageMgr.chatMsg.searhCacheMsg(3, 0, 1); //if ((msgList != null) && (msgList.Count > 0)) //{ // foreach (ChatMsg msg in msgList) // { // msg.nStatus = 1; // } // // StorageMgr.chatMsg.updateMsgList(msgList); //} Log.i("UploadImgService", "all ready, close dispatcher timer. "); //this.mTimerObject.stop(); mTimerObject.stop(); //mTimerObject.Close(); //mTimerObject.Dispose(); this.mTimerObject = null; } } else if (((imgContext.imgInfo == null) && (imgContext.imgBUf != null)) && !imgContext.fillContextWithOrigStream()) { Log.e("UploadImgService", "fillContext fail!"); imgContext.mStatus = 5; } else { (imgContext.senceHandle as NetSceneUploadImage).doScene(imgContext); } } }
public static void onImageDownContextDispatcher(object sender, EventArgs e) { DownloadImgContextMgr.getInstance().clearnFinishedContext(); if (DownloadImgContextMgr.getInstance().countRunningContext() < MAX_RUNNING) { DownloadImgContext context = DownloadImgContextMgr.getInstance().getFirstContextNeedHandle(); if (context == null) { if (DownloadImgContextMgr.getInstance().countRunningContext() == 0) { mTimerObject.stop(); //mTimerObject.Stop(); //mTimerObject.Close(); //mTimerObject.Dispose(); mTimerObject = null; } } else { Log.i("DownloadImgService", "new imagedown task startup, msgid = " + context.mImgInfo.nMsgSvrID); context.startScene(); } } }