Пример #1
0
 private void OnListTransactions(string obj)
 {
     if (_transactionListViewModel == null)
     {
         _transactionListViewModel = new TransactionListViewModel();
     }
     CommonEventPublisher.PublishViewAddedEvent(_transactionListViewModel);
 }
Пример #2
0
        public InventoryModule()
        {
            ListInventoryItemsCommand = new CategoryCommand <string>(Resources.InventoryItems, Resources.Products, OnListInventoryItems)
            {
                Order = 26
            };
            ListRecipesCommand = new CategoryCommand <string>(Resources.Recipes, Resources.Products, OnListRecipes)
            {
                Order = 27
            };
            ListTransactionsCommand = new CategoryCommand <string>(Resources.Transactions, Resources.Products, OnListTransactions)
            {
                Order = 28
            };
            ListPeriodicConsumptionsCommand = new CategoryCommand <string>(Resources.EndOfDayRecords, Resources.Products, OnListPeriodicConsumptions)
            {
                Order = 29
            };

            EventServiceFactory.EventService.GetEvent <GenericEvent <VisibleViewModelBase> >().Subscribe(s =>
            {
                if (s.Topic == EventTopicNames.ViewClosed)
                {
                    if (s.Value == _inventoryItemListViewModel)
                    {
                        _inventoryItemListViewModel = null;
                    }
                    if (s.Value == _recipeListViewModel)
                    {
                        _recipeListViewModel = null;
                    }
                    if (s.Value == _transactionListViewModel)
                    {
                        _transactionListViewModel = null;
                    }
                    if (s.Value == _periodicConsumptionListViewModel)
                    {
                        _periodicConsumptionListViewModel = null;
                    }
                }
            });

            EventServiceFactory.EventService.GetEvent <GenericEvent <WorkPeriod> >().Subscribe(OnWorkperiodStatusChanged);
        }