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);
        }
Ejemplo n.º 2
0
        public void getLocationsAround()
        {
            Locations location = new Locations(globalPositionSystemForMap.actualLocation.Position.Location.Longitude, globalPositionSystemForMap.actualLocation.Position.Location.Latitude);
            MyPhone myPhone = new MyPhone();

            string locationJson = location.serialize();

            string uri = baseWebServer + "LocationsWebServices/searchLocations?location=" + locationJson + "&radius=2&windowsPhoneId=" + myPhone.serializedDeviceUniqueId() + "&code=wonders";

            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);

            var webRequest = (HttpWebRequest)HttpWebRequest.Create(uri);
            webRequest.BeginGetResponse(new AsyncCallback(requestCallBackLocationsAround), 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);
        }