Beispiel #1
0
        // audio interaction methods
        private void Clear_Pins(object sender, RecEvent e)
        {
            var pushpins = pinLayer.Children.OfType <Pushpin>();

            foreach (Pushpin p in pushpins.ToList <Pushpin>())
            {
                pinLayer.Children.Remove(p);
            }
        }
Beispiel #2
0
        private void Remove_Last_Pin(object sender, RecEvent e)
        {
            var pushpin = pinLayer.Children.OfType <Pushpin>();

            if (pushpin.Any())
            {
                pinLayer.Children.Remove(pushpin.Last <Pushpin>());
            }
        }
Beispiel #3
0
        /// <summary>
        /// Called when a partial response is received.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="PartialSpeechResponseEventArgs"/> instance containing the event data.</param>
        private void OnPartialResponseReceivedHandler(object sender, PartialSpeechResponseEventArgs e)
        {
            Dispatcher.Invoke(
                (Action)(() =>
            {
                this.speechSniplets = e.PartialResult;
                RecEvent q = this.ParseRecEvent(e.PartialResult);
                if (q != null && (q.Kind == RecEventType.Stop || q.Kind == RecEventType.Reset))
                {
                    // we got the final result, so it we can end the mic reco.  No need to do this
                    // for dataReco, since we already called endAudio() on it as soon as we were done
                    // sending all the data.

                    this.micClient.EndMicAndRecognition();
                    dispatchEvent(q);
                }
            }));
        }
Beispiel #4
0
        private void Center_Pin(object sender, RecEvent e)
        {
            string label = "";

            if (e != null)
            {
                label = e.Label;
            }
            if (label.Equals(""))
            {
                label = Labels[pushPinNo].ToString();
                pushPinNo++;
            }
            Location pos = mainMap.Center;
            double   lat = pos.Latitude;
            double   lon = pos.Longitude;

            AddPushpinToMap(lat, lon, label, pinLayer);
        }
Beispiel #5
0
        // continue writing location
        private void Get_Location(object sender, RecEvent e)
        {
            string eTest    = "Berlin";
            string rawQuery = "";

            if (e == null)
            {
                rawQuery = eTest;
            }
            else
            {
                rawQuery = e.StreetA;
            }
            if (rawQuery.Equals(""))
            {
                return;
            }
            string      locationQuery  = rawQuery.Replace(" ", "%20").Replace(",", "");
            XmlDocument searchResponse = Geocode(locationQuery);

            //Find and display points of interest near the specified location
            FindandDisplayNearbyPOI(searchResponse, locationQuery, pinLayer);
        }
Beispiel #6
0
        private void Remove_Label_Pin(object sender, RecEvent e)
        {
            string rl = "";

            if (e == null)
            {
                // return;
            }

            // rl = e.Label;
            rl = "A";
            var pushpins = pinLayer.Children.OfType <Pushpin>();

            foreach (Pushpin p in pushpins.ToList <Pushpin>())
            {
                if (p.Content.Equals(rl))
                {
                    pinLayer.Children.Remove(p);
                    Console.WriteLine("Removed " + rl);
                    break;
                }
            }
        }
Beispiel #7
0
        /// <summary>
        /// Writes the response result.
        /// </summary>
        /// <param name="e">The <see cref="SpeechResponseEventArgs"/> instance containing the event data.</param>
        private void WriteResponseResult(SpeechResponseEventArgs e)
        {
            if (e.PhraseResponse.Results.Length == 0)
            {
                return;
            }

            for (int i = 0; i < e.PhraseResponse.Results.Length; i++)
            {
                RecEvent q = this.ParseRecEvent(e.PhraseResponse.Results[i].DisplayText);
                if (q != null)
                {
                    if (q.Kind == RecEventType.SetPin && e.PhraseResponse.Results[i].Confidence != Confidence.High)
                    {
                        continue;
                    }
                    dispatchEvent(q);
                    if (q.Kind != RecEventType.DeletePin)
                    {
                        break;
                    }
                }
            }
        }
Beispiel #8
0
 public SpeechEventArgs(RecEvent e)
 {
     TheEvent = e;
 }
Beispiel #9
0
 private void dispatchEvent(RecEvent e)
 {
     OnParsedEvent(new object(), new SpeechEventArgs(e));
 }