void client_onStatus(HStatus status) { Debug.WriteLine(">>>client_onStatus: " + status.ToString()); Debug.WriteLine("--> fulljid : " + client.FullJid); Debug.WriteLine("--> resource : " + client.Resource); if (!status.GetErrorCode().Equals("NO_ERROR")) Update_TextBlock_UI(errorScreen, status.GetErrorMsg()); Update_TextBlock_UI(statusScreen, status.ToString()); }
void socketIO_Message(object sender, MessageEventArgs e) { if ("hStatus".Equals(e.Message.Event, StringComparison.OrdinalIgnoreCase)) { if (e.Message.Json.Args != null) { JObject data = (JObject)e.Message.Json.Args[0]; try { HStatus status = new HStatus(data); if (connTimeoutTimer != null) { connTimeoutTimer.Cancel(); connTimeoutTimer = null; } if (status.GetStatus().Value == ConnectionStatus.CONNECTED) { if (isFullJidSet) updateStatus((ConnectionStatus)status.GetStatus(), (ConnectionErrors)status.GetErrorCode(), status.GetErrorMsg()); } else updateStatus((ConnectionStatus)status.GetStatus(), (ConnectionErrors)status.GetErrorCode(), status.GetErrorMsg()); } catch (Exception ex) { Debug.WriteLine("{0} : {0} exception caught.", ex); if (connTimeoutTimer != null) { connTimeoutTimer.Cancel(); connTimeoutTimer = null; } socketIO.Close(); updateStatus(ConnectionStatus.DISCONNECTED, ConnectionErrors.TECH_ERROR, ex.Message); } } } else if("hMessage".Equals(e.Message.Event, StringComparison.OrdinalIgnoreCase)) { if (e.Message.Json.Args != null) { JObject data = (JObject)e.Message.Json.Args[0]; try { if (connTimeoutTimer != null) { connTimeoutTimer.Cancel(); connTimeoutTimer = null; } onData(e.Message.Json.Name, data); } catch (Exception ex) { Debug.WriteLine("{0} : {0} exception caught.", ex); if (connTimeoutTimer != null) { connTimeoutTimer.Cancel(); connTimeoutTimer = null; } } } } else if ("attrs".Equals(e.Message.Event, StringComparison.OrdinalIgnoreCase)) { if (e.Message.Json.Args != null) { JObject data = (JObject)e.Message.Json.Args[0]; try { options.FullUrn = data["publisher"].ToString(); isFullJidSet = true; if (connStatus != ConnectionStatus.CONNECTED) updateStatus(ConnectionStatus.CONNECTED, ConnectionErrors.NO_ERROR, null); } catch (Exception ex) { Debug.WriteLine("{0} : {0} exception caught.", ex); } } } }