Exemple #1
0
 public InvoicesViewModel(IInvoiceAppService appService, IServiceProvider serviceProvider, IEventAggregator eventAggregator)
 {
     AppService       = appService;
     _serviceProvider = serviceProvider;
     EventAggregator  = eventAggregator;
     SelectedCommand  = new DelegateCommand <object[]>(OnItemSelected);
     CreateCommand    = new DelegateCommand(Create);
     UpdateCommand    = new DelegateCommand(Update);
     ImportCommand    = new DelegateCommand(Print);
     DeleteCommand    = new DelegateCommand(Delete);
     Items            = new ObservableCollection <InvoiceDto>();
     Items.AddRange(AppService.GetListAsync().Result.OrderByDescending(c => c.CreationTime));
     EventAggregator.GetEvent <InvoiceUpdatedEvent>().Subscribe(OnInvoiceUpdated);
     EventAggregator.GetEvent <InvoiceDeletedEvent>().Subscribe(OnInvoiceDeleted);
     EventAggregator.GetEvent <InvoiceAddedEvent>().Subscribe(OnInvoiceAdded);
     // Document = new InvoiceDocument ();
 }