private async void Delete(Confirmation conf) { if (conf.Confirmed) { var ids = selectedItems.OfType<Product>().Select(x => x.Id).ToList(); var task = await productsRepository.Delete(ids); if (task.Succeed) { var args = new ProductDeletedBatchEventArgs(ids, false); eventAggregator.GetEvent<ProductDeletedBatchEvent>().Publish(args); } } }
private void OnProductDeletedBatchRemote(List<string> ids) { Deployment.Current.Dispatcher.BeginInvoke(delegate { // products removed remotely // we need to notify local modules var e = new ProductDeletedBatchEventArgs(ids, true); eventAggregator.GetEvent<ProductDeletedBatchEvent>().Publish(e); }); }
public void OnProductsDeleted(ProductDeletedBatchEventArgs args) { if (items == null) return; if (args == null || args.ProductIds == null) return; foreach (var id in args.ProductIds) { string _id = id; var p = items.FirstOrDefault(x => x.Id == _id); if (p != null) { items.Remove(p); } } UpdateTotalWeight(); }
public void OnProductDeletedBatchLocal(ProductDeletedBatchEventArgs e) { if (e.FromRemote) return; // products removed locally // we need to notify other clients hubProxy.Invoke(ProductDeletedBatchEvent.HubMethodName, e.ProductIds).Wait(); }