private object[] OnEndGetDangerLocation(System.IAsyncResult result)
 {
     FollowMe.Enums.TargetLocation retVal = ((IRemoteControl)(this)).EndGetDangerLocation(result);
     return(new object[] {
         retVal
     });
 }
Example #2
0
        void remoteControlClient_GetPersonAndDangerLocationCompleted(object sender, GetPersonAndDangerLocationCompletedEventArgs e)
        {
            FollowMe.Enums.TargetLocation personLocation = FollowMe.Enums.TargetLocation.Unknown;
            FollowMe.Enums.TargetLocation dangerLocation = FollowMe.Enums.TargetLocation.Unknown;

            try
            {
                personLocation = e.Result.PersonLocation;
                dangerLocation = e.Result.DangerLocation;
            }
            catch (Exception exception)
            {
                Dispatcher.BeginInvoke(
                    () =>
                {
                    App.ViewModel.ErrorMessage = exception.ToString();
                });
                return;
            }


            Dispatcher.BeginInvoke(
                () =>
            {
                App.ViewModel.ErrorMessage = string.Empty;
            });



            if (personLocation.ToString() == TargetLocation.Unknown.ToString())
            {
                PersonLocalized = false;
                Dispatcher.BeginInvoke(
                    () =>
                {
                    App.ViewModel.PersonDetected = false;
                    App.ViewModel.PersonLocation = string.Empty;
                });
            }
            else
            {
                PersonLocalized = true;
                Dispatcher.BeginInvoke(
                    () =>
                {
                    App.ViewModel.PersonDetected = true;
                    App.ViewModel.PersonLocation = personLocation.ToString();
                });
            }

            if (dangerLocation.ToString() == TargetLocation.Unknown.ToString())
            {
                Dispatcher.BeginInvoke(
                    () =>
                {
                    App.ViewModel.DangerDetected = false;
                    App.ViewModel.DangerLocation = string.Empty;
                });
            }
            else
            {
                vibrateController.Start(TimeSpan.FromMilliseconds(1000));

                if (dangerLocation.ToString().ToLower().Contains("right"))
                {
                    Speak("Danger ahead, right side!");
                }
                else if (dangerLocation.ToString().ToLower().Contains("left"))
                {
                    Speak("Danger ahead, left side!");
                }
                else if (dangerLocation.ToString().ToLower().Contains("center"))
                {
                    Speak("Danger ahead!");
                }

                Dispatcher.BeginInvoke(
                    () =>
                {
                    App.ViewModel.DangerDetected = true;
                    App.ViewModel.DangerLocation = dangerLocation.ToString();
                });
            }
        }
 public FollowMe.Enums.TargetLocation EndGetDangerLocation(System.IAsyncResult result)
 {
     object[] _args = new object[0];
     FollowMe.Enums.TargetLocation _result = ((FollowMe.Enums.TargetLocation)(base.EndInvoke("GetDangerLocation", _args, result)));
     return(_result);
 }