private async void MessageCenterSubmitAsync(RecorderViewModel arg1, PredictionData data) { Device.BeginInvokeOnMainThread(async() => { if (data == null) { await Application.Current.MainPage.DisplayAlert("Error", "No data returned. Please record your command again or contact support", "Cancel", "ok"); } if (data.ClassId.Trim() == "Back or Go back" && data.Probability > 70.0) { await Application.Current.MainPage.Navigation.PopAsync(); } else if (data.ClassId.Trim() == "item 1 or 1" && data.Probability > 70.0) { ItemSelectedCommand.Execute(Products[0]); } else if (data.ClassId.Trim() == "Item 2 or 2" && data.Probability > 70.0) { ItemSelectedCommand.Execute(Products[1]); } else if (data.ClassId.Trim() == "Item 3 or 3" && data.Probability > 70.0) { ItemSelectedCommand.Execute(Products[2]); } else if (data.ClassId.Trim() == "Item 4 or 4" && data.Probability > 70.0) { ItemSelectedCommand.Execute(Products[3]); } else if (data.ClassId.Trim() == "Item 5 or 5" && data.Probability > 70.0) { ItemSelectedCommand.Execute(Products[4]); } else if (data.ClassId.Trim() == "Open Cart" && data.Probability > 70.0) { CardItemCommand.Execute(null); } else { await Application.Current.MainPage.DisplayAlert("Error", "Please record your command again. Recording is not clear enough", "Cancel", "ok"); } }); }
private void MessageCenterSubmitAsync(RecorderViewModel arg1, PredictionData data) { Device.BeginInvokeOnMainThread(async() => { if (data == null) { await Application.Current.MainPage.DisplayAlert("Error", "No data returned. Please record your command again or contact support", "Cancel", "ok"); } if (data.ClassId.Trim() == "Add to cart" && data.Probability > 70.0) { AddToCartCommand.Execute(this); } else if (data.ClassId.Trim() == "Open Cart" && data.Probability > 70.0) { CardItemCommand.Execute(null); } else { await Application.Current.MainPage.DisplayAlert("Error", "Please record your command again. Recording is not clear enough", "Cancel", "ok"); } }); }