Пример #1
0
        // -------------------------------------------------------------------------

        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary>
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj, List <string> tags)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();

            req_pb.request_type = CollabrifyRequestType_PB.LIST_SESSIONS_REQUEST;

            Request_ListSessions_PB cs_pb = new Request_ListSessions_PB();

            cs_pb.account_gmail = c.getAccountGmail();
            cs_pb.access_token  = c.getAccessToken();
            foreach (string s in tags)
            {
                cs_pb.session_tag.Add(s);
            }
            cs_pb.limit_query_to_organization_account = true;
            cs_pb.use_subset_query = true;
            cs_pb.account_gmail    = c.getAccountGmail();
            cs_pb.access_token     = c.getAccessToken();
            foreach (string s in tags)
            {
                cs_pb.session_tag.Add(s);
            }

            HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb);

            try
            {
                request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
            }
            catch (WebException e)
            {
                System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
            }
        } // make_request
        // -------------------------------------------------------------------------
        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary> 
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();
              req_pb.request_type = CollabrifyRequestType_PB.REMOVE_PARTICIPANT_REQUEST;

              Request_RemoveParticipant_PB cs_pb = new Request_RemoveParticipant_PB();
              cs_pb.account_gmail = c.getAccountGmail();
              cs_pb.access_token = c.getAccessToken();
              cs_pb.session_id = c.currentSessionID();

              if (c.getSession().getIsPasswordProtected())
              {
            cs_pb.session_password = "";
              }

              cs_pb.accessing_participant_id = c.participant.getId();
              cs_pb.to_be_removed_participant_id = c.participant.getId();

              HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb);

              try
              {
            request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
              }
              catch (WebException e)
              {
            System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
              }
        }
Пример #3
0
        // -------------------------------------------------------------------------

        /// <summary>
        /// makes a request to the server
        /// </summary>
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj, long id, string password)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();

            req_pb.request_type = CollabrifyRequestType_PB.ADD_PARTICIPANT_REQUEST;

            Request_AddParticipant_PB cs_pb = new Request_AddParticipant_PB();

            cs_pb.account_gmail                 = c.getAccountGmail();
            cs_pb.access_token                  = c.getAccessToken();
            cs_pb.participant_display_name      = c.participant.getDisplayName();
            cs_pb.participant_user_id           = c.participant.getUserID();
            cs_pb.participant_notification_id   = c.participant.getId().ToString();
            cs_pb.participant_notification_type = NotificationMediumType_PB.COLLABRIFY_CLOUD_CHANNEL;

            cs_pb.session_id       = id;
            cs_pb.session_password = password;

            HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb);

            try
            {
                request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
            }
            catch (WebException e)
            {
                System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
            }
        } // make_request
Пример #4
0
        // -------------------------------------------------------------------------

        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary>
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj)
        {
            /* if user isnt owner of session, dont delete the session */
            if (c.currentSessionOwner().getId() != c.participant.getId())
            {
                return;
            }

            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();

            req_pb.request_type = CollabrifyRequestType_PB.DELETE_SESSION_REQUEST;

            Request_DeleteSession_PB cs_pb = new Request_DeleteSession_PB();

            cs_pb.account_gmail  = c.getAccountGmail();
            cs_pb.access_token   = c.getAccessToken();
            cs_pb.participant_id = c.participant.getId();
            cs_pb.session_id     = c.currentSessionID();

            CollabrifyParticipant owner   = c.currentSessionOwner();
            HttpWebRequest        request = obj.BuildRequest(req_pb, cs_pb);

            try
            {
                request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
            }
            catch (WebException e)
            {
                System.Diagnostics.Debug.WriteLine("BeginGetRequestStream FAILED:\n" + e.Message);
            }
        } // make_request
        // -------------------------------------------------------------------------
        /// <summary>
        /// makes a request to the server
        /// </summary> 
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj, long id, string password)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();
              req_pb.request_type = CollabrifyRequestType_PB.ADD_PARTICIPANT_REQUEST;

              Request_AddParticipant_PB cs_pb = new Request_AddParticipant_PB();
              cs_pb.account_gmail = c.getAccountGmail();
              cs_pb.access_token = c.getAccessToken();
              cs_pb.participant_display_name = c.participant.getDisplayName();
              cs_pb.participant_user_id = c.participant.getUserID();
              cs_pb.participant_notification_id = c.participant.getId().ToString();
              cs_pb.participant_notification_type = NotificationMediumType_PB.COLLABRIFY_CLOUD_CHANNEL;

              cs_pb.session_id = id;
              cs_pb.session_password = password;

              HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb);

              try
              {
            request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
              }
              catch (WebException e)
              {
            System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
              }
        }
        // -------------------------------------------------------------------------
        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary> 
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj)
        {
            /* if user isnt owner of session, dont delete the session */
              if (c.currentSessionOwner().getId() != c.participant.getId())
              {
            return;
              }

              CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();
              req_pb.request_type = CollabrifyRequestType_PB.DELETE_SESSION_REQUEST;

              Request_DeleteSession_PB cs_pb = new Request_DeleteSession_PB();
              cs_pb.account_gmail = c.getAccountGmail();
              cs_pb.access_token = c.getAccessToken();
              cs_pb.participant_id = c.participant.getId();
              cs_pb.session_id = c.currentSessionID();

              CollabrifyParticipant owner = c.currentSessionOwner();
              HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb);

              try
              {
            request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
              }
              catch (WebException e)
              {
            System.Diagnostics.Debug.WriteLine("BeginGetRequestStream FAILED:\n" + e.Message);
              }
        }
        // -------------------------------------------------------------------------

        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary>
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();

            req_pb.request_type = CollabrifyRequestType_PB.GET_EVENT_REQUEST;

            HttpWebRequest request = obj.BuildRequest(req_pb);

            Request_GetEvent_PB cs_pb = new Request_GetEvent_PB();

            cs_pb.access_token   = c.getAccessToken();
            cs_pb.account_gmail  = c.getAccountGmail();
            cs_pb.participant_id = c.participant.getId();
            cs_pb.session_id     = c.getSession().getId();
            cs_pb.order_id       = c.getSession().getCurrentOrderId();

            try
            {
                request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
            }
            catch (WebException e)
            {
                System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
            }
        } // make_request
Пример #8
0
        // -------------------------------------------------------------------------

        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary>
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();

            req_pb.request_type = CollabrifyRequestType_PB.REMOVE_PARTICIPANT_REQUEST;

            Request_RemoveParticipant_PB cs_pb = new Request_RemoveParticipant_PB();

            cs_pb.account_gmail = c.getAccountGmail();
            cs_pb.access_token  = c.getAccessToken();
            cs_pb.session_id    = c.currentSessionID();

            if (c.getSession().getIsPasswordProtected())
            {
                cs_pb.session_password = "";
            }

            cs_pb.accessing_participant_id     = c.participant.getId();
            cs_pb.to_be_removed_participant_id = c.participant.getId();

            HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb);

            try
            {
                request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
            }
            catch (WebException e)
            {
                System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
            }
        } // make_request
        // -------------------------------------------------------------------------
        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary> 
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj, List<string> tags)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();
              req_pb.request_type = CollabrifyRequestType_PB.LIST_SESSIONS_REQUEST;

              Request_ListSessions_PB cs_pb = new Request_ListSessions_PB();
              cs_pb.account_gmail = c.getAccountGmail();
              cs_pb.access_token = c.getAccessToken();
              foreach (string s in tags) cs_pb.session_tag.Add(s);
              cs_pb.limit_query_to_organization_account = true;
              cs_pb.use_subset_query = true;
              cs_pb.account_gmail = c.getAccountGmail();
              cs_pb.access_token = c.getAccessToken();
              foreach (string s in tags)
              {
            cs_pb.session_tag.Add(s);
              }

              HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb);

              try
              {
            request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
              }
              catch (WebException e)
              {
            System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
              }
        }
        // -------------------------------------------------------------------------
        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary> 
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();
              req_pb.request_type = CollabrifyRequestType_PB.GET_EVENT_BATCH_REQUEST;

              HttpWebRequest request = obj.BuildRequest(req_pb);

              try
              {
            request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
              }
              catch (WebException e)
              {
            System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
              }
        }
        // -------------------------------------------------------------------------

        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary>
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();

            req_pb.request_type = CollabrifyRequestType_PB.GET_EVENT_BATCH_REQUEST;

            HttpWebRequest request = obj.BuildRequest(req_pb);

            try
            {
                request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
            }
            catch (WebException e)
            {
                System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
            }
        } // make_request
Пример #12
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;
        }
Пример #13
0
        // -------------------------------------------------------------------------

        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary>
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj, string name, List <string> tags, string password, int participantLimit = 0)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();

            req_pb.request_type = CollabrifyRequestType_PB.CREATE_SESSION_WITH_BASE_FILE_REQUEST;

            Random rd = new Random();
            Request_CreateSession_PB cs_pb = new Request_CreateSession_PB();

            cs_pb.owner_display_name = c.participant.getDisplayName();
            cs_pb.session_name       = name;
            if (password != "")
            {
                cs_pb.session_password = password;
            }

            foreach (string s in tags)
            {
                cs_pb.session_tag.Add(s);
            }
            cs_pb.account_gmail      = c.getAccountGmail();
            cs_pb.access_token       = c.getAccessToken();
            cs_pb.owner_display_name = c.participant.getDisplayName();
            cs_pb.owner_user_id      = c.participant.getUserID();

            if (participantLimit > 0)
            {
                cs_pb.participant_limit = participantLimit;
            }

            cs_pb.owner_notification_id   = "0";
            cs_pb.owner_notification_type = NotificationMediumType_PB.COLLABRIFY_CLOUD_CHANNEL;
            byte[]         baseFile = null;
            HttpWebRequest request  = obj.BuildRequest(req_pb, cs_pb, baseFile);

            try
            {
                request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
            }
            catch (WebException e)
            {
                System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
            }
        } // make_request
        // -------------------------------------------------------------------------
        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary> 
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj, string name, List<string> tags, string password, int participantLimit = 0)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();
              req_pb.request_type = CollabrifyRequestType_PB.CREATE_SESSION_WITH_BASE_FILE_REQUEST;

              Random rd = new Random();
              Request_CreateSession_PB cs_pb = new Request_CreateSession_PB();
              cs_pb.owner_display_name = c.participant.getDisplayName();
              cs_pb.session_name = name;
              if (password != "")
              {
            cs_pb.session_password = password;
              }

              foreach (string s in tags)
              {
            cs_pb.session_tag.Add(s);
              }
              cs_pb.account_gmail = c.getAccountGmail();
              cs_pb.access_token = c.getAccessToken();
              cs_pb.owner_display_name = c.participant.getDisplayName();
              cs_pb.owner_user_id = c.participant.getUserID();

              if (participantLimit > 0)
              {
            cs_pb.participant_limit = participantLimit;
              }

              cs_pb.owner_notification_id = "0";
              cs_pb.owner_notification_type = NotificationMediumType_PB.COLLABRIFY_CLOUD_CHANNEL;
              byte[] baseFile = null;
              HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb, baseFile);

              try
              {
            request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
              }
              catch (WebException e)
              {
            System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
              }
        }
        // -------------------------------------------------------------------------
        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary> 
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();
              req_pb.request_type = CollabrifyRequestType_PB.CREATE_OR_GET_USER;

              Request_CreateOrGetUser_PB cs_pb = new Request_CreateOrGetUser_PB();
              cs_pb.create_if_does_not_exist = true;
              cs_pb.user_id = c.participant.getUserID();

              HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb);

              try
              {
            request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
              }
              catch (WebException e)
              {
            System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
              }
        }
        // -------------------------------------------------------------------------
        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary> 
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();
              req_pb.request_type = CollabrifyRequestType_PB.ADD_TO_BASE_FILE_REQUEST;

              Request_AddToBaseFile_PB cs_pb = new Request_AddToBaseFile_PB();
              cs_pb.account_gmail = c.getAccountGmail();
              cs_pb.access_token = c.getAccessToken();

              HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb);

              try
              {
            request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
              }
              catch (WebException e)
              {
            System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
              }
        }
Пример #17
0
        // -------------------------------------------------------------------------

        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary>
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();

            req_pb.request_type = CollabrifyRequestType_PB.ADD_TO_BASE_FILE_REQUEST;

            Request_AddToBaseFile_PB cs_pb = new Request_AddToBaseFile_PB();

            cs_pb.account_gmail = c.getAccountGmail();
            cs_pb.access_token  = c.getAccessToken();

            HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb);

            try
            {
                request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
            }
            catch (WebException e)
            {
                System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
            }
        } // make_request
        // -------------------------------------------------------------------------
        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary> 
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj, long session_id, string session_password)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();
              req_pb.request_type = CollabrifyRequestType_PB.GET_SESSION_REQUEST;

              Request_GetSession_PB cs_pb = new Request_GetSession_PB();
              //cs_pb.account_gmail = c.getAccountGmail();
              //cs_pb.access_token = c.getAccessToken();
              cs_pb.session_id = session_id;
              cs_pb.session_password = session_password;

              HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb);

              try
              {
            request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
              }
              catch (WebException e)
              {
            System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
              }
        }
Пример #19
0
        // -------------------------------------------------------------------------

        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary>
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();

            req_pb.request_type = CollabrifyRequestType_PB.CREATE_OR_GET_USER;

            Request_CreateOrGetUser_PB cs_pb = new Request_CreateOrGetUser_PB();

            cs_pb.create_if_does_not_exist = true;
            cs_pb.user_id = c.participant.getUserID();

            HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb);

            try
            {
                request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
            }
            catch (WebException e)
            {
                System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
            }
        } // make_request
        // -------------------------------------------------------------------------
        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary> 
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();
              req_pb.request_type = CollabrifyRequestType_PB.GET_EVENT_REQUEST;

              HttpWebRequest request = obj.BuildRequest(req_pb);

              Request_GetEvent_PB cs_pb = new Request_GetEvent_PB();
              cs_pb.access_token = c.getAccessToken();
              cs_pb.account_gmail = c.getAccountGmail();
              cs_pb.participant_id = c.participant.getId();
              cs_pb.session_id = c.getSession().getId();
              cs_pb.order_id = c.getSession().getCurrentOrderId();

              try
              {
            request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
              }
              catch (WebException e)
              {
            System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
              }
        }
        // -------------------------------------------------------------------------

        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary>
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj, long session_id, string session_password)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();

            req_pb.request_type = CollabrifyRequestType_PB.GET_SESSION_REQUEST;

            Request_GetSession_PB cs_pb = new Request_GetSession_PB();

            //cs_pb.account_gmail = c.getAccountGmail();
            //cs_pb.access_token = c.getAccessToken();
            cs_pb.session_id       = session_id;
            cs_pb.session_password = session_password;

            HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb);

            try
            {
                request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
            }
            catch (WebException e)
            {
                System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
            }
        } // make_request