public void OnProductUpdatedLocal(ProductUpdatedEventArgs e) { if (e.FromRemote) return; // product updated locally // we need to notify other clients hubProxy.Invoke(ProductUpdatedEvent.HubMethodName, e.ProductId).Wait(); }
private async void Save() { if (context.IsValid()) { var changed = context.GetUpdatedProduct(); IsBusy = true; var task = await repository.SaveAsync(changed); IsBusy = false; if (task.Succeed) { var args = new ProductUpdatedEventArgs(task.Result, false); eventAggregator.GetEvent<ProductUpdatedEvent>().Publish(args); IsWindowOpen = false; } } }
public async void OnProductUpdated(ProductUpdatedEventArgs e) { IsBusy = true; var task = await productsRepository.GetAsync(e.ProductId); IsBusy = false; if (task.Succeed) { UpdateProductItem(task.Result); UpdateTotalWeight(); } }
private void OnProductUpdatedRemote(string productId) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { // product updated remotely // we need to notify local modules var e = new ProductUpdatedEventArgs(productId, true); eventAggregator.GetEvent<ProductUpdatedEvent>().Publish(e); })); }