/// <summary> /// Initializes a new instance of the <see cref="CaptureRegion"/> class. /// </summary> /// /// <param name="viewModel">The main view model in the application.</param> /// public CaptureRegion(RecorderViewModel viewModel) : this() { this.viewModel = viewModel; // Call CreateControl, otherwise // binding to Visible won't work. this.ForceCreateControl(); }
/// <summary> /// Initializes a new instance of the <see cref="CaptureWindow"/> class. /// </summary> /// /// <param name="viewModel">The main view model.</param> /// public CaptureWindow(RecorderViewModel viewModel) : this() { if (viewModel == null) { throw new ArgumentNullException("viewModel"); } this.viewModel = viewModel; this.viewModel.ShowTargetWindow += viewModel_TargetWindowRequested; }
public Recorder(bool IsCartPage, string headerText, string contentText, string callerPage, bool isNewApi = false, string screen = null) { InitializeComponent(); var tensflowService = App.MockDataService ? TypeLocator.Resolve <IPytorchService>() : DataService.TypeLocator.Resolve <IPytorchService>(); _rvm = new RecorderViewModel(tensflowService, IsCartPage, headerText, contentText, callerPage, secsBeforeRecording: 5, isNewApi, screen); BindingContext = _rvm; }
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"); } }); }
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() == "Men's shoes" && data.Probability > 70.0) { var cat = Categories.FirstOrDefault(x => x.EngName.Trim() == "Men's Shoes"); CategorySelectedCommand.Execute(cat); } else if (data.ClassId.Trim() == "Men's watches" && data.Probability > 70.0) { var cat = Categories.FirstOrDefault(x => x.EngName.Trim() == "Men's Watches"); CategorySelectedCommand.Execute(cat); } else if (data.ClassId.Trim() == "Women's bags" && data.Probability > 70.0) { var cat = Categories.FirstOrDefault(x => x.EngName.Trim() == "Women's Bags"); CategorySelectedCommand.Execute(cat); } else if (data.ClassId.Trim() == "Women's shoes" && data.Probability > 70.0) { var cat = Categories.FirstOrDefault(x => x.EngName.Trim() == "Women's Shoes"); CategorySelectedCommand.Execute(cat); } else { await Application.Current.MainPage.DisplayAlert("Error", "Please record your command again. Recording is not clear enough", "Cancel", "ok"); } }); }
private async void MessageCenterSubmitAsync(RecorderViewModel source, 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 english if (data.ClassId.Trim() == "Place order" && data.Probability > 70.0) { PlaceOrderCommand.Execute(null); } else if (data.ClassId == "Back or Go back" && data.Probability > 70.0) { await Application.Current.MainPage.Navigation.PopAsync(); } else { await Application.Current.MainPage.DisplayAlert("Error", "Please record your command again. Recording is not clear enough", "Cancel", "ok"); } }); }