private void httpReturned(CollabrifyEventArgs e) { /* Handles the response from the server within the CollabrifyClient object */ if (e.response.success_flag) { Debug.WriteLine(LOG_TAG + ": " + e.type.ToString() + " was successful.\n"); List <CollabrifySession> sessionList = new List <CollabrifySession>(); switch (e.type) { case CollabrifyRequestType_PB.ADD_EVENT_REQUEST: break; case CollabrifyRequestType_PB.ADD_PARTICIPANT_REQUEST: this.session = new CollabrifySession((e.specificResponsePB as Response_AddParticipant_PB).session); this.participant = new CollabrifyParticipant((e.specificResponsePB as Response_AddParticipant_PB).participant); this.notificationID = (e.specificResponsePB as Response_AddParticipant_PB).participant.notification_id; channelAPI.connect(notificationID); break; case CollabrifyRequestType_PB.ADD_TO_BASE_FILE_REQUEST: break; case CollabrifyRequestType_PB.CREATE_OR_GET_USER: break; case CollabrifyRequestType_PB.CREATE_SESSION_REQUEST: this.session = new CollabrifySession((e.specificResponsePB as Response_CreateSession_PB).session); this.participant = session.getOwner(); this.notificationID = (e.specificResponsePB as Response_CreateSession_PB).owner.notification_id; channelAPI.connect(this.notificationID); break; case CollabrifyRequestType_PB.CREATE_SESSION_WITH_BASE_FILE_REQUEST: this.session = new CollabrifySession((e.specificResponsePB as Response_CreateSessionWithBaseFile_PB).session); this.participant = session.getOwner(); this.notificationID = (e.specificResponsePB as Response_CreateSessionWithBaseFile_PB).owner.notification_id; try { channelAPI.connect((e.specificResponsePB as Response_CreateSessionWithBaseFile_PB).owner.notification_id); } catch (Exception ex) { Debug.WriteLine(LOG_TAG + ":\n" + ex.Message); } break; case CollabrifyRequestType_PB.DELETE_SESSION_REQUEST: break; case CollabrifyRequestType_PB.DELETE_ALL_SESSIONS_REQUEST: break; case CollabrifyRequestType_PB.DELETE_OLD_SESSIONS_REQUEST: break; case CollabrifyRequestType_PB.DELETE_USER: break; case CollabrifyRequestType_PB.END_SESSION_REQUEST: this.channelAPI.disconnect(); break; case CollabrifyRequestType_PB.GET_BASE_FILE_REQUEST: break; case CollabrifyRequestType_PB.GET_CURRENT_ORDER_ID_REQUEST: break; case CollabrifyRequestType_PB.GET_EVENT_BATCH_REQUEST: break; case CollabrifyRequestType_PB.GET_EVENT_REQUEST: break; case CollabrifyRequestType_PB.GET_FROM_BASE_FILE_REQUEST: break; case CollabrifyRequestType_PB.GET_LAST_EVENT_BY_PARTICIPANT_REQUEST: break; case CollabrifyRequestType_PB.GET_NOTIFICATION_ID_REQUEST: break; case CollabrifyRequestType_PB.GET_PARTICIPANT_REQUEST: break; case CollabrifyRequestType_PB.GET_SESSION_REQUEST: break; case CollabrifyRequestType_PB.LIST_ACCOUNTS_REQUEST: break; case CollabrifyRequestType_PB.LIST_SESSIONS_REQUEST: foreach (Session_PB s in (e.specificResponsePB as Response_ListSessions_PB).session) { sessionList.Add(new CollabrifySession(s)); } break; case CollabrifyRequestType_PB.PREVENT_FURTHER_JOINS_REQUEST: break; case CollabrifyRequestType_PB.REMOVE_PARTICIPANT_REQUEST: channelAPI.disconnect(); break; case CollabrifyRequestType_PB.REQUEST_TYPE_NOT_SET: Debug.WriteLine(LOG_TAG + ":\n\tError:\n\tRequest Type Was Not Set"); break; case CollabrifyRequestType_PB.UPDATE_NOTIFICATION_ID_REQUEST: this.participant = new CollabrifyParticipant((e.specificResponsePB as Response_UpdateNotificationID_PB).participant); this.session = new CollabrifySession((e.specificResponsePB as Response_UpdateNotificationID_PB).session); break; case CollabrifyRequestType_PB.UPDATE_USER: break; case CollabrifyRequestType_PB.WARMUP_REQUEST: //HttpRequest_CreateOrGetUser.make_request(this, http_object); break; } // switch if (mCompletionHandler != null) { Deployment.Current.Dispatcher.BeginInvoke(delegate { mListSessionsCompletionHandler += delegate { mListSessionsCompletionHandler = null; }; mCompletionHandler.Invoke(this); }); } if (mListSessionsCompletionHandler != null) { Deployment.Current.Dispatcher.BeginInvoke(delegate { mListSessionsCompletionHandler += delegate { mListSessionsCompletionHandler = null; }; mListSessionsCompletionHandler.Invoke(sessionList); }); } } // if else { Debug.WriteLine(LOG_TAG + ":\n\t" + e.type.ToString() + " Failed:"); Debug.WriteLine("\tException Type: " + e.response.exception.exception_type.ToString()); Debug.WriteLine("\tException Cause: " + e.response.exception.cause.ToString() + "\n"); } } // httpReturned
private void httpReturned(CollabrifyEventArgs e) { /* Handles the response from the server within the CollabrifyClient object */ if (e.response.success_flag) { Debug.WriteLine(LOG_TAG + ": " + e.type.ToString() + " was successful.\n"); List<CollabrifySession> sessionList = new List<CollabrifySession>(); switch (e.type) { case CollabrifyRequestType_PB.ADD_EVENT_REQUEST: break; case CollabrifyRequestType_PB.ADD_PARTICIPANT_REQUEST: this.session = new CollabrifySession((e.specificResponsePB as Response_AddParticipant_PB).session); this.participant = new CollabrifyParticipant((e.specificResponsePB as Response_AddParticipant_PB).participant); this.notificationID = (e.specificResponsePB as Response_AddParticipant_PB).participant.notification_id; channelAPI.connect( notificationID ); break; case CollabrifyRequestType_PB.ADD_TO_BASE_FILE_REQUEST: break; case CollabrifyRequestType_PB.CREATE_OR_GET_USER: break; case CollabrifyRequestType_PB.CREATE_SESSION_REQUEST: this.session = new CollabrifySession((e.specificResponsePB as Response_CreateSession_PB).session); this.participant = session.getOwner(); this.notificationID = (e.specificResponsePB as Response_CreateSession_PB).owner.notification_id; channelAPI.connect(this.notificationID); break; case CollabrifyRequestType_PB.CREATE_SESSION_WITH_BASE_FILE_REQUEST: this.session = new CollabrifySession((e.specificResponsePB as Response_CreateSessionWithBaseFile_PB).session); this.participant = session.getOwner(); this.notificationID = (e.specificResponsePB as Response_CreateSessionWithBaseFile_PB).owner.notification_id; try { channelAPI.connect((e.specificResponsePB as Response_CreateSessionWithBaseFile_PB).owner.notification_id); } catch (Exception ex) { Debug.WriteLine(LOG_TAG + ":\n" + ex.Message); } break; case CollabrifyRequestType_PB.DELETE_SESSION_REQUEST: break; case CollabrifyRequestType_PB.DELETE_ALL_SESSIONS_REQUEST: break; case CollabrifyRequestType_PB.DELETE_OLD_SESSIONS_REQUEST: break; case CollabrifyRequestType_PB.DELETE_USER: break; case CollabrifyRequestType_PB.END_SESSION_REQUEST: this.channelAPI.disconnect(); break; case CollabrifyRequestType_PB.GET_BASE_FILE_REQUEST: break; case CollabrifyRequestType_PB.GET_CURRENT_ORDER_ID_REQUEST: break; case CollabrifyRequestType_PB.GET_EVENT_BATCH_REQUEST: break; case CollabrifyRequestType_PB.GET_EVENT_REQUEST: break; case CollabrifyRequestType_PB.GET_FROM_BASE_FILE_REQUEST: break; case CollabrifyRequestType_PB.GET_LAST_EVENT_BY_PARTICIPANT_REQUEST: break; case CollabrifyRequestType_PB.GET_NOTIFICATION_ID_REQUEST: break; case CollabrifyRequestType_PB.GET_PARTICIPANT_REQUEST: break; case CollabrifyRequestType_PB.GET_SESSION_REQUEST: break; case CollabrifyRequestType_PB.LIST_ACCOUNTS_REQUEST: break; case CollabrifyRequestType_PB.LIST_SESSIONS_REQUEST: foreach(Session_PB s in (e.specificResponsePB as Response_ListSessions_PB).session) { sessionList.Add( new CollabrifySession(s) ); } break; case CollabrifyRequestType_PB.PREVENT_FURTHER_JOINS_REQUEST: break; case CollabrifyRequestType_PB.REMOVE_PARTICIPANT_REQUEST: channelAPI.disconnect(); break; case CollabrifyRequestType_PB.REQUEST_TYPE_NOT_SET: Debug.WriteLine(LOG_TAG + ":\n\tError:\n\tRequest Type Was Not Set"); break; case CollabrifyRequestType_PB.UPDATE_NOTIFICATION_ID_REQUEST: this.participant = new CollabrifyParticipant((e.specificResponsePB as Response_UpdateNotificationID_PB).participant); this.session = new CollabrifySession((e.specificResponsePB as Response_UpdateNotificationID_PB).session); break; case CollabrifyRequestType_PB.UPDATE_USER: break; case CollabrifyRequestType_PB.WARMUP_REQUEST: //HttpRequest_CreateOrGetUser.make_request(this, http_object); break; } // switch if (mCompletionHandler != null) { Deployment.Current.Dispatcher.BeginInvoke(delegate { mListSessionsCompletionHandler += delegate { mListSessionsCompletionHandler = null; }; mCompletionHandler.Invoke(this); }); } if(mListSessionsCompletionHandler != null) { Deployment.Current.Dispatcher.BeginInvoke(delegate { mListSessionsCompletionHandler += delegate { mListSessionsCompletionHandler = null; }; mListSessionsCompletionHandler.Invoke(sessionList); }); } } // if else { Debug.WriteLine(LOG_TAG + ":\n\t" + e.type.ToString() + " Failed:"); Debug.WriteLine("\tException Type: " + e.response.exception.exception_type.ToString()); Debug.WriteLine("\tException Cause: " + e.response.exception.cause.ToString() + "\n"); } }