private void MainPage_DirectionProcessed(object sender, Objects.LookingDirectionObject e)
 {
     if (e.IsLookingTop)
     {
         vm.TopCount += 1;
     }
     if (e.IsLookingLeft)
     {
         vm.LeftCount += 1;
     }
     if (e.IsLookingRight)
     {
         vm.RightCount += 1;
     }
     if (e.IsLookingBottom)
     {
         vm.BottomCount += 1;
     }
 }
        private async void CameraService_DirectionProcessedAsync(object sender, Objects.LookingDirectionObject e)
        {
            var selection = vm.Selections[vm.SelectionIndex];

            if (e.IsLookingLeft)
            {
                CheckIsRepeat("Left");
                if (vm.SelectionIndex > repeat)
                {
                    vm.SelectionIndex -= repeat;
                }
                else
                {
                    vm.SelectionIndex = 0;
                }
            }

            if (e.IsLookingRight)
            {
                CheckIsRepeat("Right");
                if (vm.Selections.Count - 1 - vm.SelectionIndex >= repeat)
                {
                    vm.SelectionIndex += repeat;
                }
                else
                {
                    vm.SelectionIndex = vm.Selections.Count;
                }
            }

            if (e.IsLookingTop)
            {
                CheckIsRepeat("Top");

                if (selection == "Back")
                //this.Frame.GoBack();
                {
                }
                else if (selection == "Send")
                {
                    Frame.Navigate(typeof(MainPage)); // next page! ask to auto correct and spacing
                }
                else
                {
                    vm.InputText += selection;

                    // do this algorithm after adding text!
                    var lastword = await GetLastWord();

                    // generate auto suggestion
                    var query = db.WordFrequencies
                                .FirstOrDefault(x => x.Word.StartsWith(lastword));

                    if (query != null)
                    {
                        var wordFromDb = query.Word;
                        vm.AutoCompleteText = wordFromDb;
                    }
                    else
                    {
                        var wordFromList = EnglishDictionary.EnglishWords
                                           .Where(x => x.StartsWith(lastword))
                                           .FirstOrDefault();

                        if (wordFromList == null)
                        {
                            vm.AutoCompleteText = "";
                        }
                        else
                        {
                            vm.AutoCompleteText = wordFromList;
                        }
                    }
                }
            }

            if (e.IsLookingBottom && !e.IsLookingRight && !e.IsLookingLeft)
            {
                CheckIsRepeat("Bottom");

                if (vm.AutoCompleteText == "")
                {
                    return;
                }

                var lastword = await GetLastWord();

                vm.InputText = vm.InputText.Substring(0, vm.InputText.Count() - lastword.Count());

                // don't want double spacing
                if (!vm.InputText.EndsWith(" "))
                {
                    vm.InputText += " ";
                }

                vm.InputText       += selection + " ";
                vm.AutoCompleteText = await NextWordWebService.GetNextWordAsync(vm.AutoCompleteText);

                vm.AutoCompleteText = "";
            }

            if (e.IsLookingCenter)
            {
                CheckIsRepeat("Center");
            }
        }