Пример #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();
        }
Пример #2
0
 private void OnProductUpdatedRemote(string productId)
 {
     Deployment.Current.Dispatcher.BeginInvoke(delegate
     {
         // product updated remotely
         // we need to notify local modules
         var e = new ProductUpdatedEventArgs(productId, true);
         eventAggregator.GetEvent<ProductUpdatedEvent>().Publish(e);
     });
 }
        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);
                    Confirmed = true;
                    IsWindowOpen = false;
                }
            }
        }
Пример #4
0
        private async void Save(ChildWindow window)
        {
            ValidateName();
            ValidateSize();
            ValidateK();
            ValidatePriceOpt();
            ValidateCount();
            ValidateNd();
            ValidateLength();
            ValidatePriceIcome();

            if (HasErrors) return;

            var changed = PropsToProduct();

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