Exemplo n.º 1
0
 private async void Delete(Confirmation conf)
 {
     if (conf.Confirmed)
     {
         var ids = selectedItems.OfType<Product>().Select(x => x.Id).ToList();
         IsBusy = true;
         var task = await productsRepository.Delete(ids);
         IsBusy = false;
         if (task.Succeed)
         {
             var args = new ProductDeletedBatchEventArgs(ids, false);
             eventAggregator.GetEvent<ProductDeletedBatchEvent>().Publish(args);
         }
     }
 }
Exemplo n.º 2
0
 private void OnProductDeletedBatchRemote(List<string> ids)
 {
     Application.Current.Dispatcher.BeginInvoke(new Action(() =>
     {
         // products removed remotely
         // we need to notify local modules
         var e = new ProductDeletedBatchEventArgs(ids, true);
         eventAggregator.GetEvent<ProductDeletedBatchEvent>().Publish(e);
     }));
 }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        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();
        }