public OrderItemsViewModel(IOrderItemService orderItemService, IOrderService orderService, ICommonServices commonServices) : base(commonServices)
        {
            OrderItemService = orderItemService;

            OrderItemList    = new OrderItemListViewModel(OrderItemService, commonServices);
            OrderItemDetails = new OrderItemDetailsViewModel(OrderItemService, commonServices);
        }
 private async void OnMessage(OrderItemListViewModel viewModel, string message, object args)
 {
     if (viewModel == OrderItemList && message == "ItemSelected")
     {
         await ContextService.RunAsync(() =>
         {
             OnItemSelected();
         });
     }
 }
示例#3
0
        private async void OnListMessage(OrderItemListViewModel sender, string message, object args)
        {
            var current = Item;

            if (current != null)
            {
                switch (message)
                {
                case "ItemsDeleted":
                    if (args is IList <OrderItemModel> deletedModels)
                    {
                        if (deletedModels.Any(r => r.OrderID == current.OrderID && r.OrderLine == current.OrderLine))
                        {
                            await OnItemDeletedExternally();
                        }
                    }
                    break;

                case "ItemRangesDeleted":
                    try
                    {
                        var model = await OrderItemService.GetOrderItemAsync(current.OrderID, current.OrderLine);

                        if (model == null)
                        {
                            await OnItemDeletedExternally();
                        }
                    }
                    catch (Exception ex)
                    {
                        LogException("OrderItem", "Handle Ranges Deleted", ex);
                    }
                    break;
                }
            }
        }