Пример #1
0
        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;
                }
            }
        }
Пример #3
0
 public async void OnProductUpdated(ProductUpdatedEventArgs e)
 {
     IsBusy = true;
     var task = await productsRepository.GetAsync(e.ProductId);
     IsBusy = false;
     if (task.Succeed)
     {
         UpdateProductItem(task.Result);
         UpdateTotalWeight();
     }
 }
Пример #4
0
 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);
     }));
 }