Exemplo n.º 1
0
        public async void MenuCollectionUpdate(MenuDAO menu, bool updatepage)
        {
            var showAlert = false;

            try
            {
                ViewModelHelper.AddOrUpdateOrderItem(menu);
                if (updatepage)
                {
                    UpdateAndNotifyCollection();
                }
            }
            catch (Exception ex)
            {
                showAlert = true;
            }

            if (showAlert)
            {
                await page.DisplayAlert("Uh Oh :(", "Unable to update menu order.", "OK");
            }
        }
Exemplo n.º 2
0
        async Task ExecutePlaceOrderCommand()
        {
            if (IsBusy)
            {
                return;
            }

            Message = "Submitting feedback...";
            IsBusy  = true;
            PlaceOrderCommand.ChangeCanExecute();
            var showAlert = false;

            try
            {
                ViewModelHelper.AddOrUpdateOrderItem(Menu);
            }
            catch (Exception ex)
            {
                showAlert = true;
                //Xamarin.Insights.Report(ex);
            }
            finally
            {
                IsBusy = false;
                PlaceOrderCommand.ChangeCanExecute();
            }

            if (showAlert)
            {
                await page.DisplayAlert("Uh Oh :(", "Unable to place order, please try again.", "OK");
            }
            else
            {
                var  notificator = DependencyService.Get <IToastNotificator>();
                bool tapped      = await notificator.Notify(ToastNotificationType.Success, "Successful", "Order Updated", TimeSpan.FromSeconds(2));
            }
        }