コード例 #1
0
        }// getParticipants

        // ---------------------------------------------------------------------------

        protected CollabrifyParticipant removeParticipant(long participantId_)
        {
            // TODO left out printMethodName(TAG)
            CollabrifyParticipant p = participants.FirstOrDefault(x => x.Key == participantId_).Value;

            participants.Remove(participantId_);
            participantCount = participants.Count();
            return(p);
        }
コード例 #2
0
        // CONSTRUCTOR
        public CollabrifyClient(string _gmail, string _displayName, string _accountGmail, string _access_token, bool _get_latest)
        {
            participant = new CollabrifyParticipant(0, _displayName, _gmail, 0);
            http_object = new HttpRequest__Object();
            channelAPI  = new ChannelAPI(this);

            accountGmail = _accountGmail;
            accessToken  = _access_token;
            getLatest    = _get_latest;

            http_object.HttpRequestDone += new CollabrifyEventListener(httpReturned);
            channelAPI.channelEvent     += new ChannelEventListener(channelNotification);
            //channelAPI.neg1error += new ChannelEventListener(channelNeg1Error);

            HttpRequest_Warmup.make_request(this, http_object);

            eventsPaused = false;
        } // CONSTRUCTOR
コード例 #3
0
        // CONSTRUCTOR
        public CollabrifyClient(string _gmail, string _displayName, string _accountGmail, string _access_token, bool _get_latest)
        {
            participant = new CollabrifyParticipant(0, _displayName, _gmail, 0);
              http_object = new HttpRequest__Object();
              channelAPI = new ChannelAPI(this);

              accountGmail = _accountGmail;
              accessToken = _access_token;
              getLatest = _get_latest;

              http_object.HttpRequestDone += new CollabrifyEventListener(httpReturned);
              channelAPI.channelEvent += new ChannelEventListener(channelNotification);
              //channelAPI.neg1error += new ChannelEventListener(channelNeg1Error);

              HttpRequest_Warmup.make_request(this, http_object);

              eventsPaused = false;
        }
コード例 #4
0
        // ---------------------------------------------------------------------------
        // ---------------------------------------------------------------------------
        public CollabrifySession(Session_PB sessionPB)
        {
            id = sessionPB.session_id;
              name = sessionPB.session_name;
              passwordProtected = sessionPB.password_protected;
              owner = new CollabrifyParticipant(sessionPB.owner);
              hasBaseFile = sessionPB.base_file_complete;
              baseFileSize = hasBaseFile ? sessionPB.base_file_size : 0;
              currentOrderId = sessionPB.current_order_id;
              participantCount = sessionPB.participant_id.Count;
              participantLimit = sessionPB.participant_limit;
              sessionEnded = false;
              sessionTags = new List<string>(sessionPB.session_tag);

              foreach( Participant_PB p in sessionPB.participant )
              {
            participants.Add(p.participant_id, new CollabrifyParticipant(p));
              }
              creationTime = sessionPB.creation_timestamp;
        }
コード例 #5
0
        // ---------------------------------------------------------------------------
        // ---------------------------------------------------------------------------

        public CollabrifySession(Session_PB sessionPB)
        {
            id   = sessionPB.session_id;
            name = sessionPB.session_name;
            passwordProtected = sessionPB.password_protected;
            owner             = new CollabrifyParticipant(sessionPB.owner);
            hasBaseFile       = sessionPB.base_file_complete;
            baseFileSize      = hasBaseFile ? sessionPB.base_file_size : 0;
            currentOrderId    = sessionPB.current_order_id;
            participantCount  = sessionPB.participant_id.Count;
            participantLimit  = sessionPB.participant_limit;
            sessionEnded      = false;
            sessionTags       = new List <string>(sessionPB.session_tag);

            foreach (Participant_PB p in sessionPB.participant)
            {
                participants.Add(p.participant_id, new CollabrifyParticipant(p));
            }
            creationTime = sessionPB.creation_timestamp;
        }// ctor
コード例 #6
0
 // ---------------------------------------------------------------------------
 protected void addParticipant(CollabrifyParticipant p_)
 {
     // TODO left out printMethodName(TAG)
       participants.Add(p_.getId(), p_);
       participantCount = participants.Count();
 }
コード例 #7
0
 public override void onParticipantLeft(CollabrifyParticipant p)
 {
 }
コード例 #8
0
 public override void onParticipantJoined(CollabrifyParticipant p)
 {
 }
コード例 #9
0
        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
コード例 #10
0
        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");
              }
        }
コード例 #11
0
        }// convertToString

        // ---------------------------------------------------------------------------

        protected void addParticipant(CollabrifyParticipant p_)
        {
            // TODO left out printMethodName(TAG)
            participants.Add(p_.getId(), p_);
            participantCount = participants.Count();
        }// addParticipant
コード例 #12
0
 public override void onParticipantLeft(CollabrifyParticipant p)
 {
 }
コード例 #13
0
 public override void onParticipantJoined(CollabrifyParticipant p)
 {
 }