protected override void onFinished(ConversationListRequest request, ConversationListResponse response) { MarsEventArgs args = new MarsEventArgs(); if (response == null) { args.Code = EventConst.FAIL; } else { args.Code = EventConst.SUCCESS; ObservableCollection <LocalConversation> resultList = new ObservableCollection <LocalConversation>(); if (response.ListList != null) { foreach (Conversation con in response.ListList) { LocalConversation localCon = new LocalConversation(); localCon.ConId = con.Topic; localCon.ConName = con.Name; localCon.ConNotice = con.Notice; resultList.Add(localCon); } } args.Data = resultList; } MarsPushMgr.onPush(getCmdID(), args); }
protected override void onFailed(ConversationListRequest request, ConversationListResponse response) { MarsEventArgs args = new MarsEventArgs(); args.Code = EventConst.FAIL; MarsPushMgr.onPush(getCmdID(), args); }
public void onPush(int cmdID, MarsEventArgs args) { if (cmdID == (int)CgiCmdID.CgiCmdID_PushMsg && args != null && args.Code == EventConst.SUCCESS) { ChatMsg msg = (ChatMsg)args.Data; if (msg != null) { addMsg(msg); } } }
public void onPush(int cmdID, MarsEventArgs args) { if (cmdID == (int)CgiCmdID.CgiCmdID_ConvList && args != null && args.Code == EventConst.SUCCESS) { //成功 hideLoading(false); ObservableCollection <LocalConversation> resultList = (ObservableCollection <LocalConversation>)args.Data; DataCore.getInstance().setConversationList(resultList); } else { //失败 hideLoading(true); DataCore.getInstance().clearConversationList(); } }
public void OnPush(int cmdid, byte[] msgpayload) { MessagePush msgPush = MessagePush.ParseFrom(msgpayload); ChatMsg localMsg = new ChatMsg(); localMsg.ConversationId = msgPush.Topic; localMsg.From = msgPush.From; localMsg.IsComMeg = true; localMsg.Message = msgPush.Content; localMsg.Date = DateTime.Now.ToString(); MarsEventArgs args = new MarsEventArgs(); args.Code = EventConst.SUCCESS; args.Data = localMsg; MarsPushMgr.onPush(cmdid, args); return; }
public static void onPush(int cmdID, MarsEventArgs args) { lock (sLocker) { if (sObserverList.ContainsKey(cmdID)) { List <IMarsPushObserver> list = sObserverList[cmdID]; foreach (IMarsPushObserver obc in list) { Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { if (obc != null) { obc.onPush(cmdID, args); } }); } } } }