示例#1
0
        public PaymentEditorViewModel(ITicketService ticketService, ICacheService cacheService, IAccountService accountService,
                                      ISettingService settingService, IAutomationService automationService, TicketTotalsViewModel totals, IApplicationStateSetter applicationStateSetter)
        {
            _ticketService          = ticketService;
            _cacheService           = cacheService;
            _accountService         = accountService;
            _settingService         = settingService;
            _automationService      = automationService;
            _applicationStateSetter = applicationStateSetter;

            _executeAutomationCommand       = new CaptionCommand <AutomationCommandData>("", OnExecuteAutomationCommand, CanExecuteAutomationCommand);
            _makePaymentCommand             = new CaptionCommand <PaymentType>("", OnMakePayment, CanMakePayment);
            _selectChangePaymentTypeCommand = new CaptionCommand <PaymentData>("", OnSelectChangePaymentType);
            _serviceSelectedCommand         = new CaptionCommand <CalculationSelector>("", OnSelectCalculationSelector, CanSelectCalculationSelector);
            _foreignCurrencySelectedCommand = new CaptionCommand <ForeignCurrency>("", OnForeignCurrencySelected);

            ClosePaymentScreenCommand = new CaptionCommand <string>(Resources.Close, OnClosePaymentScreen, CanClosePaymentScreen);

            ChangeTemplates           = new ObservableCollection <CommandButtonViewModel <PaymentData> >();
            ReturningAmountVisibility = Visibility.Collapsed;

            Totals = totals;

            PaymentButtonGroup     = new PaymentButtonGroupViewModel(_makePaymentCommand, null, ClosePaymentScreenCommand);
            ForeignCurrencyButtons = new List <CommandButtonViewModel <ForeignCurrency> >();
            NumberPadViewModel     = new NumberPadViewModel();
            NumberPadViewModel.TypedValueChanged += NumberPadViewModelTypedValueChanged;
            NumberPadViewModel.ResetValue        += NumberPadViewModelResetValue;
            NumberPadViewModel.PaymentDueChanged += NumberPadViewModelPaymentDueChanged;
            OrderSelector = new OrderSelectorViewModel(new OrderSelector(), NumberPadViewModel);

            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(x =>
            {
                if (SelectedTicket != null && x.Topic == EventTopicNames.CloseTicketRequested)
                {
                    SelectedTicket = null;
                }
            });
        }
 public PaymentButtonsViewModel(IApplicationState applicationState)
 {
     _applicationState  = applicationState;
     PaymentButtonGroup = new PaymentButtonGroupViewModel();
 }
 public PaymentButtonsViewModel(IApplicationState applicationState)
 {
     _applicationState = applicationState;
     PaymentButtonGroup = new PaymentButtonGroupViewModel();
 }