private void PlaceOrderAction() { if (IsOrderAvailable) { // Save to backend DB ThreadingHelpers.InvokeOnMainThread(async() => await AppNavigationService.GoToAsync(nameof(UserDashboardPage).ToLower(), (UserDashboardPageViewModel vm) => { vm.UserDetails = App.UserDetails; vm.Products = this.Products; //vm.Orders = Orders.Where(o => o.IsSubmitted).ToList(); }) ); } else { ThreadingHelpers.InvokeOnMainThread(async() => { AppInitialiserService.SetInitialiser <ProductCataloguePageViewModel>((ProductCataloguePageViewModel vm) => { vm.UserDetails = UserDetails; vm.ProductTypes = App.MasterData.ProductTypeMaster; //vm.ProductList = Products; //vm.Product = new Product(); //vm.ProductTypes = App.MasterData.ProductTypeMaster; }); await AppNavigationService.GoToAsync(nameof(ProductCataloguePage).ToLower()); }); } }
private void PlaceOrderAction() { try { /*ThreadingHelpers.InvokeOnMainThread(async () => * { * AppInitialiserService.SetInitialiser<ProductCataloguePageViewModel>((ProductCataloguePageViewModel vm) => * { * vm.UserDetails = UserDetails; * vm.ProductTypes = App.MasterData.ProductTypeMaster; * }); * * await AppNavigationService.GoToAsync(nameof(ProductCataloguePage).ToLower()); * });*/ ThreadingHelpers.InvokeOnMainThread(async() => await AppNavigationService.GoToAsync(nameof(SupplierCataloguePage).ToLower(), (SupplierCataloguePageViewModel vm) => { vm.UserDetails = UserDetails; vm.ProductTypes = App.MasterData.ProductTypeMaster; }) ); } catch (Exception ex) { } }
private async Task SupplierTapped(LinCUser item) { try { AppSpinner.ShowLoading(); var response = await _services.UserService.GetUserProducts(UserDetails.UserId, item.UserId, SelectedProductType.ProductTypeId); if (response.Data.Item1 != null && response.Data.Item1.Count > 0) { ThreadingHelpers.InvokeOnMainThread(async() => await AppNavigationService.GoToAsync(nameof(ProductsPage).ToLower(), (ProductsPageViewModel vm) => { vm.UserDetails = App.UserDetails; vm.Products = response.Data.Item1; vm.SupplierId = item.UserId; }) ); } AppSpinner.HideLoading(); } catch (Exception ex) { } }
private void NavigateToEditContactPage(StoredContactViewModel contact) { if (contact != null) { AppNavigationService.NavigateTo( new Uri(EditPage + "?id=" + contact.EMail, UriKind.Relative)); } }
private async Task NavigateToDetails(Airport airport) { if (airport == null) { return; } await AppNavigationService.NavigateToAirportDetails(airport).ConfigureAwait(false); }
private void CallCustomerCare() { ThreadingHelpers.InvokeOnMainThread(async() => await AppNavigationService.GoToAsync(nameof(ChatPage).ToLower(), (ChatPageViewModel vm) => { vm.UserDetails = App.UserDetails; }) ); }
private void Register() { ThreadingHelpers.InvokeOnMainThread(async() => await AppNavigationService.GoToAsync(nameof(RegistrationPage).ToLower(), (RegistrationPageViewModel vm) => { //vm.UserDetails = new LinCUser(); }) ); }
private void ProductCatAction() { ThreadingHelpers.InvokeOnMainThread(async() => await AppNavigationService.GoToAsync(nameof(ProductCataloguePage).ToLower(), (ProductCataloguePageViewModel vm) => { vm.UserDetails = App.UserDetails; }) ); }
private static INavigationService CreateNavigationService() { var navigationService = new AppNavigationService(); navigationService.Configure(ViewKeys.ShellViewKey, typeof(ShellView)); navigationService.Configure(ViewKeys.SearchViewKey, typeof(SearchView)); navigationService.Configure(ViewKeys.ProgressViewKey, typeof(ProgressView)); navigationService.Configure(ViewKeys.CalendarViewKey, typeof(CalendarView)); navigationService.Configure(ViewKeys.SettingViewKey, typeof(SettingView)); navigationService.Configure(ViewKeys.SubjectViewKey, typeof(SubjectView)); return(navigationService); }
/// <summary> /// Durch NavigateToDetailsCommand gerufene 'Execute'-Methode, die zur Details- /// seite einer Aktie navigiert /// </summary> /// <param name="aktieViewModel">Aktie zuderen Details navigiert werden soll.</param> public void NavigateToDetails(AktieViewModel aktieViewModel) { if (aktieViewModel == null) { return; } var uri = new Uri("/Views/AktieDetailsView.xaml?symbol=" + aktieViewModel.Symbol, UriKind.Relative); AppNavigationService.NavigateTo(uri); }
public void NavigateToDetails(CarForListViewModel car) { if (car != null) { var navigationUri = new Uri("/Views/CarDetailsView.xaml?id=" + car.Id, UriKind.Relative); AppNavigationService .NavigateTo(navigationUri); } }
private async Task RegisterAction() { //AppSpinner.ShowLoading(); //await GetMasterData(); //AppSpinner.HideLoading(); ThreadingHelpers.InvokeOnMainThread(async() => await AppNavigationService.GoToAsync(nameof(RegistrationPage).ToLower(), (RegistrationPageViewModel vm) => { //vm.UserDetails = new LinCUser(); }) ); }
private async Task SubmitProductsAction() { if (Products == null || Products.Count == 0) { await AppPopupInputService.ShowMessageOkAlertPopup("Submit Product", "No product available to submit.", "OK"); return; } var selectedPrdCount = Products.Count(p => p.IsSubmitted); if (selectedPrdCount == 0) { await AppPopupInputService.ShowMessageOkAlertPopup("Submit Product", "Please select one product to submit.", "OK"); return; } // save to db try { AppSpinner.ShowLoading(); var response = await _services.UserService.SaveOrders(Products, UserDetails, SupplierId); AppSpinner.HideLoading(); if (response.Data != null) { ThreadingHelpers.InvokeOnMainThread(async() => await AppNavigationService.GoToAsync(nameof(UserDashboardPage).ToLower(), (UserDashboardPageViewModel vm) => { vm.UserDetails = App.UserDetails; vm.Products = Products; vm.Orders = response.Data; }) ); } else { await AppPopupInputService.ShowMessageOkAlertPopup("Submit Product", "Unable to place order. Please try again.", "OK"); } } catch (Exception ex) { } }
private void AddProductAction() { ThreadingHelpers.InvokeOnMainThread(async() => { // AppInitialiserService.SetInitialiser<AddProductPageViewModel>((AddProductPageViewModel vm) => // { // vm.UserDetails = UserDetails; // vm.ProductList = Products; // vm.Product = new Product(); // vm.ProductTypes = App.MasterData.ProductTypeMaster; // vm.IsAddProduct = true; // }); await AppNavigationService.GoBackAsync(); }); }
private void AddProductAction() { ThreadingHelpers.InvokeOnMainThread(async() => { AppInitialiserService.SetInitialiser <AddProductPageViewModel>((AddProductPageViewModel vm) => { vm.UserDetails = UserDetails; vm.ProductList = Products; vm.Product = new Product(); vm.ProductTypes = App.MasterData.ProductTypeMaster; vm.IsAddProduct = true; }); await AppNavigationService.GoToAsync(nameof(AddProductPage).ToLower()); }); }
private void CreateCommands() { DescribeImageCommand = new AutoRelayCommand(async() => await DescribeImageAsync(), () => IsVisionServiceRegistered && !IsBusy) .DependsOn(() => IsBusy); SwapCameraCommand = new AutoRelayCommand(async() => await SwapCameraAsync(), () => !IsBusy) .DependsOn(() => IsBusy); GotoSettingsCommand = new AutoRelayCommand(() => AppNavigationService.NavigateTo(Pages.SettingsPage.ToString())); GotoRecognizeTextCommand = new AutoRelayCommand(() => AppNavigationService.NavigateTo(Pages.RecognizeTextPage.ToString()), () => IsVisionServiceRegistered && !IsBusy) .DependsOn(() => IsBusy); HowToRegisterCommand = new AutoRelayCommand(() => launcherService.LaunchUriAsync(Constants.HowToRegisterUrl), () => !IsVisionServiceRegistered).DependsOn(() => IsVisionServiceRegistered); OnCreateCommands(); }
private async Task AddToCartAction() { try { ThreadingHelpers.InvokeOnMainThread(async() => await AppNavigationService.GoToAsync(nameof(CartPage).ToLower(), (CartPageViewModel vm) => { vm.UserDetails = App.UserDetails; vm.Products = this.Products; vm.Orders = this.Products.Where(p => p.ShouldAddToCart).ToList(); }) ); } catch (Exception ex) { } }
private async Task EditProductAction(Product item) { AppSpinner.ShowLoading(); await Task.Delay(10); ThreadingHelpers.InvokeOnMainThread(async() => { AppInitialiserService.SetInitialiser <ProductCataloguePageViewModel>((ProductCataloguePageViewModel vm) => { vm.UserDetails = UserDetails; vm.Products = Products; }); await AppNavigationService.GoToAsync(nameof(ProductCataloguePage).ToLower()); //await AppNavigationService.GoBackAsync(); } ); AppSpinner.HideLoading(); }
public async Task EditProductAction(Product item) { AppSpinner.ShowLoading(); await Task.Delay(10); ThreadingHelpers.InvokeOnMainThread(async() => { // AppInitialiserService.SetInitialiser<AddProductPageViewModel>((AddProductPageViewModel vm) => // { // vm.UserDetails = UserDetails; // vm.ProductList = Products; // vm.Product = item; // vm.IsAddProduct = false; // }); await AppNavigationService.GoBackAsync(); } ); AppSpinner.HideLoading(); }
// Called when a notification is opened. // The name of the method can be anything as long as the signature matches. // Method must be static or this object should be marked as DontDestroyOnLoad private static void HandleNotificationOpened(OSNotificationOpenedResult result) { OSNotificationPayload payload = result.notification.payload; Dictionary <string, object> additionalData = payload.additionalData; string message = payload.body; string actionID = result.action.actionID; if (additionalData != null) { if (additionalData.ContainsKey("codChamadaVeiculo")) { //DateTime dtRecebimento = CrossSettings.Current.Get<DateTime>("dataRecebimentoChamada"); if (additionalData.ContainsKey("tempoEsperaAceitacao")) { string tempoEspera = additionalData["tempoEsperaAceitacao"].ToString(); CrossSettings.Current.Set("tempoEsperaAceitacao", tempoEspera); } // var tempoEspera = CrossSettings.Current.Contains var value = additionalData["codChamadaVeiculo"]; CrossSettings.Current.Set("ChamadaParaResposta", value.ToString()); //NavigationParameters param = new NavigationParameters(); // param.Add("codChamada", value); // if(actionID != null) AppNavigationService.NavigateAsync("//NavigationPage/ResponderChamada", null, true); } } //if (actionID != null) //{ // if (actionID.Equals("__DEFAULT__")) // AppNavigationService.NavigateAsync("Chamada"); // // actionSelected equals the id on the button the user pressed. // // actionSelected will equal "__DEFAULT__" when the notification itself was tapped when buttons were present. // // extraMessage = "Pressed ButtonId: " + actionID; //} }
// Called when your app is in focus and a notificaiton is recieved. // The name of the method can be anything as long as the signature matches. // Method must be static or this object should be marked as DontDestroyOnLoad private static void HandleNotificationReceived(OSNotification notification) { OSNotificationPayload payload = notification.payload; string message = payload.body; Dictionary <string, object> additionalData = payload.additionalData; if (additionalData != null) { if (additionalData.ContainsKey("mdn_area")) { CrossSettings.Current.Set("atualizarDados", true); } if (additionalData.ContainsKey("logout")) { CrossSettings.Current.Clear(); AppNavigationService.NavigateAsync("NavigationPage/Logar"); } if (additionalData.ContainsKey("tempoEsperaAceitacao")) { CrossSettings.Current.Set("dataRecebimentoChamada", DateTime.Now); } } }
private void CreateCommands() { RegisterCommand = new AutoRelayCommand(() => launcherService.LaunchUriAsync(Constants.HowToRegisterUrl)); GotoAboutCommand = new AutoRelayCommand(() => AppNavigationService.NavigateTo(Pages.AboutPage.ToString())); GotoPrivacyPolicyCommand = new AutoRelayCommand(() => AppNavigationService.NavigateTo(Pages.PrivacyPolicyPage.ToString())); }
private async Task TakePhotoAsync() { IsBusy = true; string recognizeText = null; try { using (var stream = await mediaPicker.TakePhotoAsync()) { if (stream != null) { var imageBytes = await stream.ToArrayAsync(); MessengerInstance.Send(new NotificationMessage <byte[]>(imageBytes, Constants.PhotoTaken)); Message = null; if (await NetworkService.IsInternetAvailableAsync()) { var result = await cognitiveClient.AnalyzeAsync(stream, Language, RecognitionType.Text); var ocrResult = result.OcrResult; if (ocrResult.ContainsText) { recognizeText = ocrResult.Text; } else { recognizeText = AppResources.UnableToRecognizeText; } } else { // Internet isn't available, the service cannot be reached. recognizeText = AppResources.NoConnection; } } else { // If message is null at this point, this is the first request. If we cancel it, turns automatically to the // previous page. if (message == null) { AppNavigationService.GoBack(); } IsBusy = false; return; } } } catch (CognitiveException ex) { // Unable to access the service (message contains translated error details). recognizeText = ex.Message; } catch (WebException) { // Internet isn't available, the service cannot be reached. recognizeText = AppResources.NoConnection; } catch (Exception ex) { var error = AppResources.RecognitionError; if (Settings.ShowExceptionOnError) { error = $"{error} ({ex.Message})"; } recognizeText = error; } // Shows the result. Message = this.GetNormalizedMessage(recognizeText); IsBusy = false; }
private void CreateCommands() { GotoGitHubCommand = new AutoRelayCommand(() => launcherService.LaunchUriAsync(Constants.GitHubProjectUrl)); GotoUrlCommand = new AutoRelayCommand <string>((url) => launcherService.LaunchUriAsync(url)); GotoPrivacyPolicyCommand = new AutoRelayCommand(() => AppNavigationService.NavigateTo(Pages.PrivacyPolicyPage.ToString())); }
public ShellView() { this.InitializeComponent(); _appNavigationService = IoC.Get <AppNavigationService>(); }
private async Task Login() { try { //if(UserDetails.Email) AppSpinner.ShowLoading(); var response = await _services.UserService.GetUserAsync(null, null, null, UserDetails.UserName, UserDetails.UserSecret); //Get Products & orders if (response.Data.Item1 != null) { App.UserDetails = response.Data.Item1; int? supplierId = null; List <Product> prdList = new List <Product>(); switch (App.UserDetails.UserTypeId) { case 1: // SUPPLIER var responseProdCat = await _services.UserService.GetProductCategoryByUser(App.UserDetails.UserId.Value); App.MasterData.ProductCategoryList = responseProdCat.Data.ProductCategoryList; var productTypes = responseProdCat.Data.ProductCategoryList.Select(l => l.ProductTypeId).Distinct(); supplierId = App.UserDetails.UserId.Value; foreach (var item in productTypes) { var products = await _services.UserService.GetUserProducts(App.UserDetails.UserId.Value, supplierId, item); if (products.Data.Item1 != null && products.Data.Item1.Count > 0) { prdList.AddRange(products.Data.Item1); } } break; case 2: //CONSUMER break; case 3: // VOLUNTEER break; default: break; } // get orders for the user var orders = _services.UserService.GetOrders(App.UserDetails); ThreadingHelpers.InvokeOnMainThread(async() => await AppNavigationService.GoToAsync(nameof(UserDashboardPage).ToLower(), (UserDashboardPageViewModel vm) => { vm.UserDetails = App.UserDetails; vm.Products = prdList; vm.Orders = orders.Result.Data; }) ); } else { AppErrorService.AddError(response); } AppSpinner.HideLoading(); AppErrorService.ProcessErrors(); } catch (Exception ex) { HandleUIError(ex); } }
public void Remove() { _appContacts.Remove(EMail); AppNavigationService.GoBack(); }
public void Update() { _appContacts.Update(this); AppNavigationService.GoBack(); }
/// <summary> /// Gerufen durch SaveAktieCommand als 'Execute'-Methode /// Speichert Aktiensymbol im lokalen Storage /// </summary> private void Save() { _aktienStorage.AddAktie(Symbol); AppNavigationService.GoBack(); }
private async Task NextButtonTapped() { if (SelectedProductType != null) { if (Product.ProductTypeId == 0) { Product.ProductTypeId = SelectedProductType.ProductTypeId; Product.ProductType = SelectedProductType.ProductTypeName; } } if (SelectedProductCategory != null) { if (Product.ProductCategoryId == 0) { Product.ProductCategoryId = SelectedProductCategory.ProductCategoryId; Product.ProductCategory = SelectedProductCategory.ProductCategoryName; } } if (Product.Quantity == 0) { await AppPopupInputService.ShowMessageOkAlertPopup("Add Product", "Quantity cannot be zero.", "OK"); return;; } if (Product.ProductTypeId == 0) { await AppPopupInputService.ShowMessageOkAlertPopup("Add Product", "Please select product type.", "OK"); return;; } if (Product.ProductCategoryId == 0) { await AppPopupInputService.ShowMessageOkAlertPopup("Add Product", "Please select product category.", "OK"); return;; } //ThreadingHelpers.InvokeOnMainThread(async () => // await AppNavigationService.GoToAsync(nameof(ChatPage).ToLower(), // (ChatPageViewModel vm) => // { // }) // ); try { if (ProductList == null) { ProductList = new List <Product>(); } if (IsAddProduct) { ProductList.Add(Product); } ThreadingHelpers.InvokeOnMainThread(async() => await AppNavigationService.GoToAsync(nameof(ReviewProductsPage).ToLower(), (ReviewProductsPageViewModel vm) => { vm.UserDetails = UserDetails; vm.Products = ProductList; }) ); } catch (Exception ex) { } }