Exemplo n.º 1
0
        public PosViewModel(IRegionManager regionManager, IApplicationState applicationState, IApplicationStateSetter applicationStateSetter,
                            ITicketService ticketService, ITicketServiceBase ticketServiceBase, IUserService userService, ICacheService cacheService, IMessagingService messagingService,
                            TicketListViewModel ticketListViewModel, TicketTagListViewModel ticketTagListViewModel, MenuItemSelectorViewModel menuItemSelectorViewModel,
                            MenuItemSelectorView menuItemSelectorView, TicketViewModel ticketViewModel, TicketOrdersViewModel ticketOrdersViewModel,
                            TicketEntityListViewModel ticketEntityListViewModel, TicketTypeListViewModel ticketTypeListViewModel, AccountBalances accountBalances)
        {
            _ticketService             = ticketService;
            _ticketServiceBase         = ticketServiceBase;
            _userService               = userService;
            _cacheService              = cacheService;
            _messagingService          = messagingService;
            _applicationState          = applicationState;
            _applicationStateSetter    = applicationStateSetter;
            _regionManager             = regionManager;
            _menuItemSelectorView      = menuItemSelectorView;
            _ticketViewModel           = ticketViewModel;
            _ticketOrdersViewModel     = ticketOrdersViewModel;
            _menuItemSelectorViewModel = menuItemSelectorViewModel;
            _ticketListViewModel       = ticketListViewModel;
            _ticketTagListViewModel    = ticketTagListViewModel;
            _ticketEntityListViewModel = ticketEntityListViewModel;
            _ticketTypeListViewModel   = ticketTypeListViewModel;
            _accountBalances           = accountBalances;

            EventServiceFactory.EventService.GetEvent <GenericEvent <Order> >().Subscribe(OnOrderEventReceived);
            EventServiceFactory.EventService.GetEvent <GenericEvent <Ticket> >().Subscribe(OnTicketEventReceived);
            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(OnTicketEvent);
            EventServiceFactory.EventService.GetEvent <GenericEvent <ScreenMenuItemData> >().Subscribe(OnMenuItemSelected);
            EventServiceFactory.EventService.GetEvent <GenericIdEvent>().Subscribe(OnTicketIdPublished);
            EventServiceFactory.EventService.GetEvent <GenericEvent <OperationRequest <Entity> > >().Subscribe(OnEntitySelectedForTicket);
            EventServiceFactory.EventService.GetEvent <GenericEvent <TicketTagGroup> >().Subscribe(OnTicketTagSelected);
            EventServiceFactory.EventService.GetEvent <GenericEvent <TicketStateData> >().Subscribe(OnTicketStateSelected);
            EventServiceFactory.EventService.GetEvent <GenericEvent <TicketType> >().Subscribe(OnTicketTypeChanged);

            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.ResetCache && _applicationState.CurrentTicketType != null)
                {
                    _menuItemSelectorViewModel.Reset();
                    _menuItemSelectorViewModel.UpdateCurrentScreenMenu(_applicationState.CurrentTicketType.GetScreenMenuId(_applicationState.CurrentTerminal));
                }
            });
        }
Exemplo n.º 2
0
        public TicketViewModel(IApplicationState applicationState, IExpressionService expressionService,
                               ITicketService ticketService, IAccountService accountService, IEntityServiceClient locationService, IUserService userService,
                               ICacheService cacheService, TicketOrdersViewModel ticketOrdersViewModel,
                               TicketTotalsViewModel totals, TicketInfoViewModel ticketInfoViewModel)
        {
            _ticketService         = ticketService;
            _userService           = userService;
            _cacheService          = cacheService;
            _applicationState      = applicationState;
            _expressionService     = expressionService;
            _ticketOrdersViewModel = ticketOrdersViewModel;
            _totals     = totals;
            _ticketInfo = ticketInfoViewModel;

            SelectEntityCommand       = new DelegateCommand <EntityType>(OnSelectEntity, CanSelectEntity);
            ExecuteAutomationCommnand = new DelegateCommand <CommandContainerButton>(OnExecuteAutomationCommand, CanExecuteAutomationCommand);

            IncQuantityCommand          = new CaptionCommand <string>("+", OnIncQuantityCommand, CanIncQuantity);
            DecQuantityCommand          = new CaptionCommand <string>("-", OnDecQuantityCommand, CanDecQuantity);
            IncSelectionQuantityCommand = new CaptionCommand <string>("(+)", OnIncSelectionQuantityCommand, CanIncSelectionQuantity);
            DecSelectionQuantityCommand = new CaptionCommand <string>("(-)", OnDecSelectionQuantityCommand, CanDecSelectionQuantity);
            ShowTicketTagsCommand       = new CaptionCommand <TicketTagGroup>(Resources.Tag, OnShowTicketsTagExecute, CanExecuteShowTicketTags);
            CancelItemCommand           = new CaptionCommand <string>(Resources.Cancel, OnCancelItemCommand);
            MoveOrdersCommand           = new CaptionCommand <string>(Resources.MoveTicketLine, OnMoveOrders, CanMoveOrders);
            EditTicketNoteCommand       = new CaptionCommand <string>(Resources.TicketNote.Replace(" ", Environment.NewLine), OnEditTicketNote, CanEditTicketNote);
            RemoveTicketLockCommand     = new CaptionCommand <string>(Resources.ReleaseLock, OnRemoveTicketLock, CanRemoveTicketLock);
            ChangePriceCommand          = new CaptionCommand <string>(Resources.ChangePrice, OnChangePrice, CanChangePrice);
            AddOrderCommand             = new CaptionCommand <string>(Resources.AddOrder.Replace(" ", Environment.NewLine), OnAddOrder, CanAddOrder);
            ModifyOrderCommand          = new CaptionCommand <string>(Resources.ModifyOrder.Replace(" ", Environment.NewLine), OnModifyOrder, CanModifyOrder);

            EventServiceFactory.EventService.GetEvent <GenericEvent <OrderViewModel> >().Subscribe(OnSelectedOrdersChanged);
            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(OnRefreshTicket);
            EventServiceFactory.EventService.GetEvent <GenericEvent <OrderTagData> >().Subscribe(OnOrderTagEvent);
            EventServiceFactory.EventService.GetEvent <GenericEvent <MenuItemPortion> >().Subscribe(OnPortionSelected);
            EventServiceFactory.EventService.GetEvent <GenericEvent <Department> >().Subscribe(OnDepartmentChanged);
            EventServiceFactory.EventService.GetEvent <GenericEvent <AutomationCommandValueData> >().Subscribe(OnAutomationCommandValueSelected);
            EventServiceFactory.EventService.GetEvent <GenericEvent <AutomationCommandData> >().Subscribe(OnAutomationCommandSelected);

            SelectedTicket = Ticket.Empty;
        }
Exemplo n.º 3
0
        public TicketOrdersView(TicketOrdersViewModel viewModel)
        {
            DataContext = viewModel;
            InitializeComponent();

            EventServiceFactory.EventService.GetEvent <GenericEvent <Order> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.OrderAdded)
                {
                    Scroller.ScrollToEnd();
                }
            });


            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.ActivatePosView && !((TicketOrdersViewModel)DataContext).SelectedOrders.Any())
                {
                    Scroller.ScrollToEnd();
                }
            });
        }