private void OnStatus(object sender, MESSAGE_TYPE staus, byte[] msg) { string smsg = null; switch (staus) { case MESSAGE_TYPE.MT_CONNECT_READY: push.Subscribe(push.UserTopic); smsg = encoding.GetString(msg); AddInfo("CONNECT_READY:" + String.Format("{0} UserNo:{1}", smsg, push.UserNo)); SetBtnStatus(true); break; case MESSAGE_TYPE.MT_CONNECT_FAIL: smsg = encoding.GetString(msg); AddInfo("CONNECT_FAIL:" + String.Format("{0}", smsg)); break; case MESSAGE_TYPE.MT_DISCONNECTED: smsg = encoding.GetString(msg); AddInfo("DISCONNECTED:" + String.Format("{0}", smsg)); SetBtnStatus(false); break; case MESSAGE_TYPE.MT_SUBSCRIBE: smsg = encoding.GetString(msg); AddInfo("SUBSCRIBE:" + String.Format("{0}", smsg)); break; case MESSAGE_TYPE.MT_UNSUBSCRIBE: smsg = encoding.GetString(msg); AddInfo("UNSUBSCRIBE:" + String.Format("{0}", smsg)); break; case MESSAGE_TYPE.MT_ACK_REQUESTID: long RequestId = BitConverter.ToInt64(msg, 0); AddInfo("Request Id BACK: " + RequestId); break; case MESSAGE_TYPE.MT_RECOVER_DATA: smsg = encoding.GetString(msg, 1, msg.Length - 1); if (msg[0] == 0) { AddInfo(String.Format("Begin Recover Topic:{0}", smsg)); } if (msg[0] == 1) { AddInfo(String.Format("End Recover Topic:{0}", smsg)); } break; case MESSAGE_TYPE.MT_HEART_BEAT: long UTC = ((PushClient)sender).ServerTime(); double totsec = (double)UTC / (double)1000000000; DateTime st = (new DateTime(1970, 1, 1, 0, 0, 0)).AddHours(8).AddSeconds(totsec); AddInfo(String.Format("{0:yyyy/MM/dd hh:mm:ss.fff}", st)); AddInfo(String.Format("{0:yyyy/MM/dd hh:mm:ss.fff}", DateTime.Now)); // TimeSpan toNow = new TimeSpan(UTC * 10); // AddInfo(String.Format("{0:yyyy/MM/dd hh:mm:ss.fff}", gtm.Add(toNow))); break; } }