Ejemplo n.º 1
0
 private async Task Delete(PositionViewModel _position)
 {
     // Delete position
     if (await _pageService.DisplayAlert("Warning", $"Are you sure you want to delete {_position.Name}?", "Yes", "No"))
     {
         TotalPrice = -_position.Price;
         PositionOrderViewModel.Remove(_position);
     }
 }
Ejemplo n.º 2
0
        private async Task AddPosition()
        {
            var viewModel = new AddNewPositionPageViewModel(_userBase, _pageService);

            // If new position added change list and change total price
            viewModel.PosAdded += (source, newPosition) =>
            {
                PositionOrderViewModel.Add(new PositionViewModel(newPosition));
                TotalPrice = PositionOrderViewModel[PositionOrderViewModel.Count - 1].Price;
            };

            await _pageService.PushAsync(new AddNewPositionPage(viewModel));
        }
Ejemplo n.º 3
0
        private async Task MakeOrder()
        {
            // The bill:
            string tmp = "";

            foreach (var pos in PositionOrderViewModel)
            {
                tmp += pos.Name + " " + pos.Description + " -" + pos.Price + "$\n";
            }
            tmp += "----------------------------------------\n";
            tmp += "Total price: " + TotalPrice.ToString() + "$";

            await _pageService.DisplayAlert("Your order", tmp, "OK");

            // Clear all fields
            PositionOrderViewModel.Clear();
            TotalPrice = -TotalPrice;
        }