public SendMessage()
 {
     InitializeComponent();
     Thread.Sleep(2000);
     sound.play("confirm");
     this.commentLocation = (Application.Current as App).commentAndLocationShared;
     this.myMicrophone = (Application.Current as App).myMicrophoneShare;
     Thread.Sleep(500);
     LayoutRoot.DoubleTap += DoubleTap;
 }
 public AddRoutePlace()
 {
     InitializeComponent();
     Thread.Sleep(2000);
     sound.play("confirm");
     this.lat = (Application.Current as App).latShared;
     this.lon = (Application.Current as App).lonShared;
     this.myMicrophone = (Application.Current as App).myMicrophoneShare;
     Thread.Sleep(500);
     LayoutRoot.DoubleTap += DoubleTap;
 }
        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);
        }