public void sendCommentAndActualLocationToSave(string description) { Locations location; try { location = new Locations(globalPositionSystemForMap.actualLocation.Position.Location.Longitude, globalPositionSystemForMap.actualLocation.Position.Location.Latitude); } catch (Exception) { return; } string locationJson = location.serialize(); Comments comment = new Comments(description, true); ServicesReference.Comments commentWeb = new ServicesReference.Comments(); commentWeb.description = comment.description; commentWeb.isText = true; ServicesReference.Locations locationWeb = new ServicesReference.Locations(); locationWeb.latitude = location.latitude; locationWeb.longitude = location.longitude; string commentJson = comment.serialize(); string uri = baseWebServer + "CommentsWebServices/addCommentoToLocation?location=" + locationJson + "&comment=" + commentJson + "&code=wonders"; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri); var webRequest = (HttpWebRequest)HttpWebRequest.Create(uri); webRequest.BeginGetResponse(new AsyncCallback(requestCallBackSaveCommentAndLocation), webRequest); }
public void sendCommentAndSoundToActualLocationToSave(string description, MyMicrophone myMicrophone) { Locations location; byte[] soundStream = myMicrophone.streamMicrophone.ToArray(); try { location = new Locations(globalPositionSystemForMap.actualLocation.Position.Location.Longitude, globalPositionSystemForMap.actualLocation.Position.Location.Latitude); } catch (Exception) { return; } string locationJson = location.serialize(); Comments comment = new Comments(description, false); ServicesReference.Comments commentWeb = new ServicesReference.Comments(); commentWeb.description = comment.description; commentWeb.isText = false; commentWeb.typeOfCommentsId = (Application.Current as App).idMessageType; commentWeb.archiveDescription = " "; commentWeb.sound = null; ServicesReference.Locations locationWeb = new ServicesReference.Locations(); locationWeb.latitude = location.latitude; locationWeb.longitude = location.longitude; string commentJson = comment.serialize(); var client = new WebService1SoapClient(new BasicHttpBinding(BasicHttpSecurityMode.None) { MaxReceivedMessageSize = 2147483647, MaxBufferSize = 2147483647 }, new EndpointAddress(Properties.getEndPoint())); client.addComentAndSoundToLocationAsync(locationJson, soundStream, commentWeb, "wonders"); client.addComentAndSoundToLocationCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(webService_addComentAndSoundToLocationCompleted); }