// ------------------------------------------------------------------------- /// <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); } }
// ------------------------------------------------------------------------- /// <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); } }
// CONSTRUCTOR public ChannelAPI(CollabrifyClient c, LoadCompletedEventHandler del = null) { Debug.WriteLine(LOG_TAG + ": building ChannelAPI."); mChannelClosed = true; client = c; // Builds the browser object try { browser = new WebBrowser(); browser.IsScriptEnabled = true; browser.ScriptNotify += ScriptCallback; browser.LoadCompleted += delegate { }; if(del != null) browser.LoadCompleted += del; } catch( Exception ex) { Debug.WriteLine(LOG_TAG + ": " + ex.Source); Debug.WriteLine("\t" + ex.Message); } string html = null; using (var s = Assembly.GetExecutingAssembly().GetManifestResourceStream("Collabrify_wp8.Resources.home.html")) using (var r = new StreamReader(s)) html = r.ReadToEnd(); browser.NavigateToString(html); }
// ------------------------------------------------------------------------- /// <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); } }
// CONSTRUCTOR public ChannelAPI(CollabrifyClient c, LoadCompletedEventHandler del = null) { Debug.WriteLine(LOG_TAG + ": building ChannelAPI."); mChannelClosed = true; client = c; // Builds the browser object try { browser = new WebBrowser(); browser.IsScriptEnabled = true; browser.ScriptNotify += ScriptCallback; browser.LoadCompleted += delegate { }; if (del != null) { browser.LoadCompleted += del; } } catch (Exception ex) { Debug.WriteLine(LOG_TAG + ": " + ex.Source); Debug.WriteLine("\t" + ex.Message); } string html = null; using (var s = Assembly.GetExecutingAssembly().GetManifestResourceStream("Collabrify_wp8.Resources.home.html")) using (var r = new StreamReader(s)) html = r.ReadToEnd(); browser.NavigateToString(html); } // CONSTRUCTOR
// ------------------------------------------------------------------------- /// <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); } }
// Constructor public MainPage() { this.InitializeComponent(); c = new CollabrifyClient("*****@*****.**", "JACK AND JILL", "*****@*****.**", "82763BDBCA", true); //c = new CollabrifyClient("*****@*****.**", "jacky", "*****@*****.**", "82763BDBCA", true); //c.ReturnInformation += new ChangedEventHander(updateInfo); }
static void Main() { // Display the number of command line arguments: Debug CollabrifyClient c = new CollabrifyClient("*****@*****.**", "JACK AND JILL", "*****@*****.**", "82763BDBCA", true); List<string> l = new List<string>(); l.Add("[none]"); c.listSessions(l); }
// ------------------------------------------------------------------------- /// <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, 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.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); } }
// ------------------------------------------------------------------------- /// <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, 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); } }
// ------------------------------------------------------------------------- /// <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); } }