示例#1
0
        /// <summary>
        /// Create a MapPolyLine from RootObject and select FirstOrDefault route to show on map control
        /// </summary>
        /// <param name="FuncResp">Convert first or default route to mappolyline to show on map</param>
        /// <returns></returns>
        public static MapPolyline GetDirectionAsRoute(Rootobject FuncResp, Color ResultColor)
        {
            var loclist = new List <BasicGeoposition>();
            var points  = DecodePolylinePoints(FuncResp.routes.FirstOrDefault().overview_polyline.points);

            foreach (var item in points)
            {
                loclist.Add(item);
            }
            //foreach (var leg in FuncResp.routes.FirstOrDefault().legs)
            //{
            //    foreach (var step in leg.steps)
            //    {
            //        loclist.Add(
            //            new BasicGeoposition()
            //            { Latitude = step.start_location.lat, Longitude = step.start_location.lng });
            //        loclist.Add(
            //            new BasicGeoposition()
            //            { Latitude = step.end_location.lat, Longitude = step.end_location.lng });
            //    }
            //}
            MapPolyline line = new MapPolyline()
            {
                StrokeThickness = 5,
                StrokeDashed    = true,
                StrokeColor     = ResultColor,
                Path            = new Geopath(loclist)
            };
            var voice = new VoiceHelper(FuncResp.routes.FirstOrDefault());

            return(line);
        }
示例#2
0
        /// <summary>
        /// Create a MapPolyLine from Route to show on map control
        /// </summary>
        /// <param name="Route">Selected route for converting to mappolyline</param>
        /// <returns></returns>
        public static MapPolyline GetDirectionAsRoute(Route Route, Color ResultColor)
        {
            var loclist = new List <BasicGeoposition>();

            foreach (var leg in Route.legs)
            {
                foreach (var step in leg.steps)
                {
                    loclist.Add(
                        new BasicGeoposition()
                    {
                        Latitude = step.start_location.lat, Longitude = step.start_location.lng
                    });
                    loclist.Add(
                        new BasicGeoposition()
                    {
                        Latitude = step.end_location.lat, Longitude = step.end_location.lng
                    });
                }
            }
            MapPolyline line = new MapPolyline()
            {
                StrokeThickness = 5,
                StrokeColor     = ResultColor,
                Path            = new Geopath(loclist)
            };
            var voice = new VoiceHelper(Route);

            return(line);
        }
示例#3
0
        /// <summary>
        /// Create a MapPolyLine from RootObject and select FirstOrDefault route to show on map control
        /// </summary>
        /// <param name="FuncResp">Convert first or default route to mappolyline to show on map</param>
        /// <returns></returns>
        public static MapPolyline GetDirectionAsRoute(Rootobject FuncResp, Color ResultColor)
        {
            var loclist = new List <BasicGeoposition>();

            foreach (var leg in FuncResp.routes.FirstOrDefault().legs)
            {
                foreach (var step in leg.steps)
                {
                    loclist.Add(
                        new BasicGeoposition()
                    {
                        Latitude = step.start_location.lat, Longitude = step.start_location.lng
                    });
                    loclist.Add(
                        new BasicGeoposition()
                    {
                        Latitude = step.end_location.lat, Longitude = step.end_location.lng
                    });
                }
            }
            MapPolyline line = new MapPolyline()
            {
                StrokeThickness = 5,
                StrokeColor     = Colors.Purple,
                Path            = new Geopath(loclist)
            };
            var voice = new VoiceHelper(FuncResp.routes.FirstOrDefault());

            return(line);
        }
示例#4
0
        /// <summary>
        /// Create Helpers to manage the streams from the Kinect Sensor
        /// </summary>
        public void CreateHelpers()
        {
            LogHelper.logInput("Create Helpers", LogHelper.logType.INFO, "Manager");

            ////
            //   Kinect
            ////
            kinectMgr = QlikMove.Kinect.KinectHelper.Instance;

            ////
            //  Gesture Helper
            ////
            GestureMgr = GestureHelper.Instance;
            //add the callback method when an event is triggered
            GestureMgr.EventRecognised += new EventHandler <QlikMove.StandardHelper.EventArguments.QlikMoveEventArgs>(this.Event_EventRecognised);


            ////
            //  AudioStream
            ////
            VoiceMgr = VoiceHelper.Instance;


            ////
            //  Launch the ActionRecogniser with its method
            ////
            ActionMgr = ActionHelper.Instance;
        }
示例#5
0
 public void OnSelect()
 {
     if (hotkey)
     {
         hotkey.OnSelect();
     }
     if (lr)
     {
         lr.enabled = (true);
     }
     VoiceHelper.GetInstance().PlayPrompt();
 }
示例#6
0
        private async Task GetActionListFromBotService(DirectLineClient client, CallState callState, List <ActionBase> actionList)
        {
            var result = await ReadBotMessagesAsync(client, callState);

            bool   hangup          = false;
            string promptForRecord = null;

            for (int i = 0; i < result.Count; ++i)
            {
                if (result[i] == BotResponses.RootLuisDialog_EndConversation)
                {
                    hangup = true;
                }
                if (i < result.Count - 1 || result[i] == BotResponses.RootLuisDialog_EndConversation)
                {
                    var speech = VoiceHelper.GetPromptForText(result[i]);
                    await SendSTTResultToUser(result[i], callState.Participants);

                    actionList.Add(speech);
                }
                else
                {
                    // This is the last element that we will use for the recording prompt
                    promptForRecord = result[i];
                }
            }

            if (hangup)
            {
                actionList.Add(new Hangup()
                {
                    OperationId = Guid.NewGuid().ToString()
                });
            }
            else
            {
                actionList.Add(await GetRecordingAction(promptForRecord, callState));
            }
            //var record = GetRecordingAction(promptForRecord);

            //actionList.Add(record);
        }
示例#7
0
        public IHttpActionResult TwilioVoice(string phoneNumber)
        {
            var helloXMLUrl     = "http://dogfoodjs.azurewebsites.net/Voice-Hello.xml";
            var withAudioXMLUrl = "http://dogfoodjs.azurewebsites.net/Voice-WithAudio.xml";

            var toPhones = new List <string> {
                "0000000000"
            };

            toPhones.Add(phoneNumber);

            //send message to each phone in list
            foreach (var phone in toPhones)
            {
                VoiceHelper.SendVoiceMessage(phone, helloXMLUrl);
            }

            //API response
            return(Ok("voice messages sent!"));
        }
示例#8
0
        private async Task <Record> GetRecordingAction(string promptText, CallState callState)
        {
            var id = Guid.NewGuid().ToString();

            var prompt = VoiceHelper.GetPromptForText(promptText);

            await SendSTTResultToUser(promptText, callState.Participants);

            var record = new Record
            {
                OperationId                    = id,
                PlayPrompt                     = prompt,
                MaxDurationInSeconds           = 60,
                InitialSilenceTimeoutInSeconds = 5,
                MaxSilenceTimeoutInSeconds     = 4,
                PlayBeep        = true,
                RecordingFormat = RecordingFormat.Wav,
                StopTones       = new List <char> {
                    '#'
                }
            };

            return(record);
        }
示例#9
0
        public async void DirectionFinder()
        {
            if (Destination == null)
            {
                return;
            }
            await VoiceHelper.ReadText("calculating route");

            MapPolyline CurrentDrawed = null;

            try
            {
                foreach (var item in MapView.MapControl.MapElements)
                {
                    if (item.GetType() == typeof(MapPolyline))
                    {
                        CurrentDrawed = (MapPolyline)item;
                    }
                }
            }
            catch { }
            if (Mode == DirectionMode.walking)
            {
                await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async delegate
                {
                    try
                    {
                        if (Origin != null && Destination != null)
                        {
                            DirectionsHelper.Rootobject r = null;
                            if (Waypoints == null)
                            {
                                r = await DirectionsHelper.GetDirections(Origin.Position, Destination.Position, DirectionsHelper.DirectionModes.walking);
                            }
                            else
                            {
                                var lst = new List <BasicGeoposition>();
                                foreach (var item in Waypoints)
                                {
                                    if (item != null)
                                    {
                                        lst.Add(new BasicGeoposition()
                                        {
                                            Latitude = item.Position.Latitude, Longitude = item.Position.Longitude
                                        });
                                    }
                                }
                                if (lst.Count > 0)
                                {
                                    r = await DirectionsHelper.GetDirections(Origin.Position, Destination.Position, DirectionsHelper.DirectionModes.walking, lst);
                                }
                                else
                                {
                                    r = await DirectionsHelper.GetDirections(Origin.Position, Destination.Position, DirectionsHelper.DirectionModes.walking);
                                }
                            }
                            if (r == null || r.routes.Count() == 0)
                            {
                                await new MessageDialog(MultilingualHelpToolkit.GetString("StringNoWayToDestination", "Text")).ShowAsync();
                                return;
                            }
                            if (CurrentDrawed != null)
                            {
                                MapView.MapControl.MapElements.Remove(CurrentDrawed);
                            }
                            var route = DirectionsHelper.GetDirectionAsRoute(r.routes.FirstOrDefault(), (Color)Resources["SystemControlBackgroundAccentBrush"]);
                            MapView.MapControl.MapElements.Add(route);
                            var es = DirectionsHelper.GetTotalEstimatedTime(r.routes.FirstOrDefault());
                            var di = DirectionsHelper.GetDistance(r.routes.FirstOrDefault());
                            await new MessageDialog($"{MultilingualHelpToolkit.GetString("StringDirectionCalculated", "Text")}".Replace("{di}", di).Replace("{es}", es)).ShowAsync();
                            //await new MessageDialog($"we calculate that the route is about {di} and takes about {es}").ShowAsync();
                            await MapView.MapControl.TryZoomToAsync(16);
                            MapView.MapControl.Center       = Origin;
                            MapView.MapControl.DesiredPitch = 45;
                            MapViewVM.ActiveNavigationMode  = true;
                            new DisplayRequest().RequestActive();
                        }
                        else
                        {
                            await new MessageDialog(MultilingualHelpToolkit.GetString("StringSelectBothOriginAndDestination", "Text")).ShowAsync();
                        }
                    }
                    catch (Exception ex)
                    {
                        //await new MessageDialog("error on DirectionFinder in Walking Mode" + Environment.NewLine + ex.Message).ShowAsync();
                    }
                });
            }
            else if (Mode == DirectionMode.driving)
            {
                await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async delegate
                {
                    try
                    {
                        if (Origin != null && Destination != null)
                        {
                            DirectionsHelper.Rootobject r = null;
                            if (Waypoints == null)
                            {
                                r = await DirectionsHelper.GetDirections(Origin.Position, Destination.Position, DirectionsHelper.DirectionModes.driving);
                            }
                            else
                            {
                                var lst = new List <BasicGeoposition>();
                                foreach (var item in Waypoints)
                                {
                                    if (item != null)
                                    {
                                        lst.Add(new BasicGeoposition()
                                        {
                                            Latitude = item.Position.Latitude, Longitude = item.Position.Longitude
                                        });
                                    }
                                }
                                if (lst.Count > 0)
                                {
                                    r = await DirectionsHelper.GetDirections(Origin.Position, Destination.Position, DirectionsHelper.DirectionModes.driving, lst);
                                }
                                else
                                {
                                    r = await DirectionsHelper.GetDirections(Origin.Position, Destination.Position, DirectionsHelper.DirectionModes.driving);
                                }
                            }
                            if (r == null || r.routes.Count() == 0)
                            {
                                await new MessageDialog(MultilingualHelpToolkit.GetString("StringNoWayToDestination", "Text")).ShowAsync();
                                return;
                            }
                            if (CurrentDrawed != null)
                            {
                                MapView.MapControl.MapElements.Remove(CurrentDrawed);
                            }
                            var route = DirectionsHelper.GetDirectionAsRoute(r.routes.FirstOrDefault(), (Color)Resources["SystemControlBackgroundAccentBrush"]);
                            MapView.MapControl.MapElements.Add(route);
                            var es = DirectionsHelper.GetTotalEstimatedTime(r.routes.FirstOrDefault());
                            var di = DirectionsHelper.GetDistance(r.routes.FirstOrDefault());
                            await new MessageDialog($"{MultilingualHelpToolkit.GetString("StringDirectionCalculated", "Text")}".Replace("{di}", di).Replace("{es}", es)).ShowAsync();
                            await MapView.MapControl.TryZoomToAsync(16);
                            MapView.MapControl.Center       = Origin;
                            MapView.MapControl.DesiredPitch = 45;
                            MapViewVM.ActiveNavigationMode  = true;
                            new DisplayRequest().RequestActive();
                        }
                        else
                        {
                            await new MessageDialog(MultilingualHelpToolkit.GetString("StringSelectBothOriginAndDestination", "Text")).ShowAsync();
                        }
                    }
                    catch (Exception ex)
                    {
                        //await new MessageDialog("error on DirectionFinder in Driving Mode" + Environment.NewLine + ex.Message).ShowAsync();
                    }
                });
            }
            else
            {
                await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async delegate
                {
                    try
                    {
                        if (Origin != null && Destination != null)
                        {
                            DirectionsHelper.Rootobject r = null;
                            r = await DirectionsHelper.GetDirections(Origin.Position, Destination.Position, DirectionsHelper.DirectionModes.transit);
                            if (r == null || r.routes.Count() == 0)
                            {
                                await new MessageDialog(MultilingualHelpToolkit.GetString("StringNoWayToDestination", "Text")).ShowAsync();
                                return;
                            }
                            if (CurrentDrawed != null)
                            {
                                MapView.MapControl.MapElements.Remove(CurrentDrawed);
                            }
                            var route = DirectionsHelper.GetDirectionAsRoute(r.routes.FirstOrDefault(), (Color)Resources["SystemControlBackgroundAccentBrush"]);
                            MapView.MapControl.MapElements.Add(route);
                            var es = DirectionsHelper.GetTotalEstimatedTime(r.routes.FirstOrDefault());
                            var di = DirectionsHelper.GetDistance(r.routes.FirstOrDefault());
                            foreach (var item in r.routes.FirstOrDefault().legs)
                            {
                                foreach (var item2 in item.steps)
                                {
                                    if (item2.transit_details != null)
                                    {
                                        var ico = RandomAccessStreamReference.CreateFromUri(new Uri("http:" + item2.transit_details.line.vehicle.icon));
                                        MapView.MapControl.MapElements.Add(new MapIcon()
                                        {
                                            Image = ico, Title = "arrival " + item2.transit_details.headsign, Location = new Geopoint(new BasicGeoposition()
                                            {
                                                Latitude = item2.transit_details.arrival_stop.location.lat, Longitude = item2.transit_details.arrival_stop.location.lng
                                            })
                                        });
                                        MapView.MapControl.MapElements.Add(new MapIcon()
                                        {
                                            Image = ico, Title = "departure  " + item2.transit_details.headsign, Location = new Geopoint(new BasicGeoposition()
                                            {
                                                Latitude = item2.transit_details.departure_stop.location.lat, Longitude = item2.transit_details.departure_stop.location.lng
                                            })
                                        });
                                    }
                                }
                            }
                            await new MessageDialog($"{MultilingualHelpToolkit.GetString("StringDirectionCalculated", "Text")}".Replace("{di}", di).Replace("{es}", es)).ShowAsync();
                            await MapView.MapControl.TryZoomToAsync(16);
                            MapView.MapControl.Center       = Origin;
                            MapView.MapControl.DesiredPitch = 45;
                            MapViewVM.ActiveNavigationMode  = true;
                            new DisplayRequest().RequestActive();
                        }
                        else
                        {
                            await new MessageDialog(MultilingualHelpToolkit.GetString("StringSelectBothOriginAndDestination", "Text")).ShowAsync();
                        }
                    }
                    catch (Exception ex)
                    {
                        //await new MessageDialog("error on DirectionFinder in Transit Mode" + Environment.NewLine + ex.Message).ShowAsync();
                    }
                });
            }
        }
示例#10
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     aud      = GetComponent <AudioSource> ();
 }
示例#11
0
 public void SetDestination(Vector3 pos)
 {
     agent.SetDestination(pos);
     VoiceHelper.GetInstance().PlayAck();
 }