public CustomersViewModel(ICustomerService customerService, IPlaceService placeService, IFilePickerService filePickerService, ICommonServices commonServices) : base(commonServices) { CustomerService = customerService; CustomerList = new CustomerListViewModel(CustomerService, commonServices); CustomerDetails = new CustomerDetailsViewModel(CustomerService, filePickerService, commonServices); CustomerPlaces = new PlaceListViewModel(placeService, commonServices); }
public PlacesViewModel(IPlaceService placeService, IOrderService orderService, IFilePickerService filePickerService, ICommonServices commonServices) : base(commonServices) { PlaceService = placeService; PlaceList = new PlaceListViewModel(PlaceService, commonServices); PlaceDetails = new PlaceDetailsViewModel(PlaceService, filePickerService, commonServices); PlaceOrders = new OrderListViewModel(orderService, commonServices); }
private async void OnMessage(PlaceListViewModel viewModel, string message, object args) { if (viewModel == PlaceList && message == "ItemSelected") { await ContextService.RunAsync(() => { OnItemSelected(); }); } }
private async void OnListMessage(PlaceListViewModel sender, string message, object args) { var current = Item; if (current != null) { switch (message) { case "ItemsDeleted": if (args is IList <PlaceModel> deletedModels) { if (deletedModels.Any(r => r.PlaceID == current.PlaceID)) { await OnItemDeletedExternally(); } } break; case "ItemRangesDeleted": try { var model = await PlaceService.GetPlaceAsync(current.PlaceID); if (model == null) { await OnItemDeletedExternally(); } } catch (Exception ex) { LogException("Place", "Handle Ranges Deleted", ex); } break; } } }