Пример #1
0
 public PrinterViewModel(IPrinterService printerService, IUserInteraction userInteraction)
 {
     _printerService  = printerService;
     _userInteraction = userInteraction;
     EditCustomPrinterSettingsCommand = new CaptionCommand <string>(Resources.Settings,
                                                                    OnEditCustomPrinterSettings, CanEditCustomPrinterSettings);
 }
Пример #2
0
 public PrinterTemplateViewModel(IPrinterService printerService)
 {
     _printerService                 = printerService;
     LoadTicketTemplateCommand       = new CaptionCommand <string>("", OnLoadTicketTemplate);
     LoadKitchenOrderTemplateCommand = new CaptionCommand <string>("", OnLoadKitchenOrderTemplate);
     LoadCustomerReceiptCommand      = new CaptionCommand <string>("", OnLoadCustomerReceiptTemplate);
 }
Пример #3
0
        public PaymentEditorViewModel(IApplicationState applicationState, ITicketService ticketService,
            IPrinterService printerService, IUserService userService, IAutomationService automationService, TicketTotalsViewModel totals)
        {
            _applicationState = applicationState;
            _ticketService = ticketService;
            _printerService = printerService;
            _userService = userService;
            _automationService = automationService;

            _manualPrintCommand = new CaptionCommand<PrintJob>(Resources.Print, OnManualPrint, CanManualPrint);
            _makePaymentCommand = new CaptionCommand<PaymentTemplate>("", OnMakePayment, CanMakePayment);
            _serviceSelectedCommand = new CaptionCommand<CalculationTemplate>("", OnSelectCalculationTemplate);

            SubmitAccountPaymentCommand = new CaptionCommand<string>(Resources.AccountBalance_r, OnSubmitAccountPayment, CanSubmitAccountPayment);
            ClosePaymentScreenCommand = new CaptionCommand<string>(Resources.Close, OnClosePaymentScreen, CanClosePaymentScreen);
            TenderAllCommand = new CaptionCommand<string>(Resources.All, OnTenderAllCommand);
            TypeValueCommand = new DelegateCommand<string>(OnTypeValueExecuted);
            SetValueCommand = new DelegateCommand<string>(OnSetValue);
            DivideValueCommand = new DelegateCommand<string>(OnDivideValue);
            SelectMergedItemCommand = new DelegateCommand<MergedItem>(OnMergedItemSelected);

            SetDiscountAmountCommand = new CaptionCommand<string>(Resources.Round, OnSetDiscountAmountCommand, CanSetDiscount);
            AutoSetDiscountAmountCommand = new CaptionCommand<string>(Resources.Flat, OnAutoSetDiscount, CanAutoSetDiscount);
            SetDiscountRateCommand = new CaptionCommand<string>(Resources.DiscountPercentSign, OnSetDiscountRateCommand, CanSetDiscountRate);

            MergedItems = new ObservableCollection<MergedItem>();
            ReturningAmountVisibility = Visibility.Collapsed;

            Totals = totals;

            PaymentButtonGroup = new PaymentButtonGroupViewModel(_makePaymentCommand, null, ClosePaymentScreenCommand);

            LastTenderedAmount = "1";
        }
Пример #4
0
        public BasicReportModule(IRegionManager regionManager, BasicReportView basicReportView,
            IWorkPeriodService workPeriodService, IPrinterService printerService, ICacheService cacheService,
            IInventoryService inventoryService, IUserService userService, IAutomationService automationService,
            IApplicationState applicationState, ILogService logService, ISettingService settingService)
            : base(regionManager, AppScreens.ReportView)
        {
            ReportContext.PrinterService = printerService;
            ReportContext.WorkPeriodService = workPeriodService;
            ReportContext.InventoryService = inventoryService;
            ReportContext.UserService = userService;
            ReportContext.ApplicationState = applicationState;
            ReportContext.CacheService = cacheService;
            ReportContext.LogService = logService;
            ReportContext.SettingService = settingService;

            _userService = userService;

            _regionManager = regionManager;
            _basicReportView = basicReportView;
            SetNavigationCommand(Resources.Reports, Resources.Common, "Images/Ppt.png", 60);

            PermissionRegistry.RegisterPermission(PermissionNames.OpenReports, PermissionCategories.Navigation, Resources.CanDisplayReports);
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeReportDate, PermissionCategories.Report, Resources.CanChangeReportFilter);

            //todo refactor
            automationService.RegisterParameterSource("ReportName", () => ReportContext.Reports.Select(x => x.Header));

        }
Пример #5
0
        public BasicReportModule(IRegionManager regionManager, BasicReportView basicReportView,
            IWorkPeriodService workPeriodService, IPrinterService printerService,
            IInventoryService inventoryService, IUserService userService,
            IApplicationState applicationState, IAutomationService automationService, ILogService logService)
            : base(regionManager, AppScreens.ReportView)
        {
            ReportContext.PrinterService = printerService;
            ReportContext.WorkPeriodService = workPeriodService;
            ReportContext.InventoryService = inventoryService;
            ReportContext.UserService = userService;
            ReportContext.ApplicationState = applicationState;
            ReportContext.LogService = logService;

            _userService = userService;

            _regionManager = regionManager;
            _basicReportView = basicReportView;
            SetNavigationCommand(Resources.Reports, Resources.Common, "Images/Ppt.png", 60);

            PermissionRegistry.RegisterPermission(PermissionNames.OpenReports, PermissionCategories.Navigation, Resources.CanDisplayReports);
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeReportDate, PermissionCategories.Report, Resources.CanChangeReportFilter);

            automationService.RegisterActionType("SaveReportToFile", Resources.SaveReportToFile, new { ReportName = "", FileName = "" });
            automationService.RegisterActionType(ActionNames.PrintReport, Resources.PrintReport, new { ReportName = "" });
            automationService.RegisterParameterSoruce("ReportName", () => ReportContext.Reports.Select(x => x.Header));

            EventServiceFactory.EventService.GetEvent<GenericEvent<IActionData>>().Subscribe(x =>
            {
                if (x.Value.Action.ActionType == "SaveReportToFile")
                {
                    var reportName = x.Value.GetAsString("ReportName");
                    var fileName = x.Value.GetAsString("FileName");
                    if (!string.IsNullOrEmpty(reportName))
                    {
                        var report = ReportContext.Reports.FirstOrDefault(y => y.Header == reportName);
                        if (report != null)
                        {
                            ReportContext.CurrentWorkPeriod = ReportContext.ApplicationState.CurrentWorkPeriod;
                            var document = report.GetReportDocument();
                            ReportViewModelBase.SaveAsXps(fileName, document);
                        }
                    }
                }

                if (x.Value.Action.ActionType == ActionNames.PrintReport)
                {
                    var reportName = x.Value.GetAsString("ReportName");
                    if (!string.IsNullOrEmpty(reportName))
                    {
                        var report = ReportContext.Reports.FirstOrDefault(y => y.Header == reportName);
                        if (report != null)
                        {
                            ReportContext.CurrentWorkPeriod = ReportContext.ApplicationState.CurrentWorkPeriod;
                            var document = report.GetReportDocument();
                            ReportContext.PrinterService.PrintReport(document, ReportContext.ApplicationState.CurrentTerminal.ReportPrinter);
                        }
                    }
                }
            });
        }
        public TicketListerWidgetViewModel(Widget model, IApplicationState applicationState, ITicketServiceBase ticketService,
            IPrinterService printerService, ICacheService cacheService, IAutomationDao automationDao)
            : base(model, applicationState)
        {
            _applicationState = applicationState;
            _ticketService = ticketService;
            _printerService = printerService;
            _cacheService = cacheService;
            _automationDao = automationDao;
            ItemSelectionCommand = new DelegateCommand<TicketViewData>(OnItemSelection);

            EventServiceFactory.EventService.GetEvent<GenericEvent<Message>>().Subscribe(
            x =>
            {
                if (_applicationState.ActiveAppScreen == AppScreens.EntityView
                    && x.Topic == EventTopicNames.MessageReceivedEvent
                    && x.Value.Command == Messages.TicketRefreshMessage)
                {
                    Refresh();
                }
            });

            EventServiceFactory.EventService.GetEvent<GenericEvent<WidgetEventData>>().Subscribe(
            x =>
            {
                if (x.Value.WidgetName == Name)
                {
                    State = x.Value.Value;
                }
            });
        }
Пример #7
0
        public BasicReportModule(IRegionManager regionManager, BasicReportView basicReportView,
                                 IWorkPeriodService workPeriodService, IPrinterService printerService, ICacheService cacheService,
                                 IInventoryService inventoryService, IUserService userService, IAutomationService automationService,
                                 IApplicationState applicationState, ILogService logService, ISettingService settingService)
            : base(regionManager, AppScreens.ReportView)
        {
            ReportContext.PrinterService    = printerService;
            ReportContext.WorkPeriodService = workPeriodService;
            ReportContext.InventoryService  = inventoryService;
            ReportContext.UserService       = userService;
            ReportContext.ApplicationState  = applicationState;
            ReportContext.CacheService      = cacheService;
            ReportContext.LogService        = logService;
            ReportContext.SettingService    = settingService;

            _userService = userService;

            _regionManager   = regionManager;
            _basicReportView = basicReportView;
            SetNavigationCommand(Resources.Reports, Resources.Common, "Images/Ppt.png", 60);

            PermissionRegistry.RegisterPermission(PermissionNames.OpenReports, PermissionCategories.Navigation, Resources.CanDisplayReports);
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeReportDate, PermissionCategories.Report, Resources.CanChangeReportFilter);

            //todo refactor
            automationService.RegisterParameterSource("ReportName", () => ReportContext.Reports.Select(x => x.Header));
        }
Пример #8
0
 public ExecutePrintJob(ITicketService ticketService, IApplicationState applicationState, ICacheService cacheService, IPrinterService printerService)
 {
     _ticketService    = ticketService;
     _applicationState = applicationState;
     _cacheService     = cacheService;
     _printerService   = printerService;
 }
Пример #9
0
 public static AbstractPrintJob CreatePrintJob(Printer printer, IPrinterService printerService)
 {
     if (printer.IsTextPrinter)
     {
         return(new TextPrinterJob(printer));
     }
     if (printer.IsHtmlPrinter)
     {
         return(new HtmlPrinterJob(printer));
     }
     if (printer.IsPortPrinter)
     {
         return(new PortPrinterJob(printer));
     }
     if (printer.IsDemoPrinter)
     {
         return(new DemoPrinterJob(printer));
     }
     if (printer.IsWindowsPrinter)
     {
         return(new WindowsPrinterJob(printer));
     }
     if (printer.IsCustomPrinter)
     {
         return(new CustomPrinterJob(printer, printerService));
     }
     if (printer.IsRawPrinter)
     {
         return(new RawPrinterJob(printer));
     }
     return(new SlipPrinterJob(printer));
 }
Пример #10
0
 public ExecutePrintJob(ITicketService ticketService, IApplicationState applicationState, ICacheService cacheService, IPrinterService printerService)
 {
     _ticketService = ticketService;
     _applicationState = applicationState;
     _cacheService = cacheService;
     _printerService = printerService;
 }
Пример #11
0
        public TicketListerWidgetViewModel(Widget model, IApplicationState applicationState, ITicketServiceBase ticketService,
                                           IPrinterService printerService, ICacheService cacheService, IAutomationDao automationDao)
            : base(model, applicationState)
        {
            _applicationState    = applicationState;
            _ticketService       = ticketService;
            _printerService      = printerService;
            _cacheService        = cacheService;
            _automationDao       = automationDao;
            ItemSelectionCommand = new DelegateCommand <TicketViewData>(OnItemSelection);

            EventServiceFactory.EventService.GetEvent <GenericEvent <Message> >().Subscribe(
                x =>
            {
                if (_applicationState.ActiveAppScreen == AppScreens.EntityView &&
                    x.Topic == EventTopicNames.MessageReceivedEvent &&
                    x.Value.Command == Messages.TicketRefreshMessage)
                {
                    Refresh();
                }
            });

            EventServiceFactory.EventService.GetEvent <GenericEvent <WidgetEventData> >().Subscribe(
                x =>
            {
                if (x.Value.WidgetName == Name)
                {
                    State = x.Value.Value;
                }
            });
        }
Пример #12
0
        public BasicReportModule(IRegionManager regionManager, BasicReportView basicReportView,
                                 IWorkPeriodService workPeriodService, IPrinterService printerService,
                                 IInventoryService inventoryService, IUserService userService,
                                 IApplicationState applicationState, IAutomationService automationService, ILogService logService)
            : base(regionManager, AppScreens.ReportView)
        {
            ReportContext.PrinterService    = printerService;
            ReportContext.WorkPeriodService = workPeriodService;
            ReportContext.InventoryService  = inventoryService;
            ReportContext.UserService       = userService;
            ReportContext.ApplicationState  = applicationState;
            ReportContext.LogService        = logService;

            _userService = userService;

            _regionManager   = regionManager;
            _basicReportView = basicReportView;
            SetNavigationCommand(Resources.Reports, Resources.Common, "Images/Ppt.png", 60);

            PermissionRegistry.RegisterPermission(PermissionNames.OpenReports, PermissionCategories.Navigation, Resources.CanDisplayReports);
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeReportDate, PermissionCategories.Report, Resources.CanChangeReportFilter);

            automationService.RegisterActionType("SaveReportToFile", Resources.SaveReportToFile, new { ReportName = "", FileName = "" });
            automationService.RegisterActionType(ActionNames.PrintReport, Resources.PrintReport, new { ReportName = "" });
            automationService.RegisterParameterSoruce("ReportName", () => ReportContext.Reports.Select(x => x.Header));

            EventServiceFactory.EventService.GetEvent <GenericEvent <ActionData> >().Subscribe(x =>
            {
                if (x.Value.Action.ActionType == "SaveReportToFile")
                {
                    var reportName = x.Value.GetAsString("ReportName");
                    var fileName   = x.Value.GetAsString("FileName");
                    if (!string.IsNullOrEmpty(reportName))
                    {
                        var report = ReportContext.Reports.FirstOrDefault(y => y.Header == reportName);
                        if (report != null)
                        {
                            ReportContext.CurrentWorkPeriod = ReportContext.ApplicationState.CurrentWorkPeriod;
                            var document = report.GetReportDocument();
                            ReportViewModelBase.SaveAsXps(fileName, document);
                        }
                    }
                }

                if (x.Value.Action.ActionType == ActionNames.PrintReport)
                {
                    var reportName = x.Value.GetAsString("ReportName");
                    if (!string.IsNullOrEmpty(reportName))
                    {
                        var report = ReportContext.Reports.FirstOrDefault(y => y.Header == reportName);
                        if (report != null)
                        {
                            ReportContext.CurrentWorkPeriod = ReportContext.ApplicationState.CurrentWorkPeriod;
                            var document = report.GetReportDocument();
                            ReportContext.PrinterService.PrintReport(document, ReportContext.ApplicationState.CurrentTerminal.ReportPrinter);
                        }
                    }
                }
            });
        }
        /// <summary>
        /// The main application entry point.
        /// </summary>
        public static void Main()
        {
            IPrinterService service = null;

            try
            {
                string   location     = Assembly.GetExecutingAssembly().Location;
                FileInfo assemblyFile = new FileInfo(location);
                if (assemblyFile.Directory == null)
                {
                    throw new ApplicationException("Unable to determine the location of the running application");
                }

                Directory.SetCurrentDirectory(assemblyFile.Directory.FullName);
                string logFileDir = Path.Combine(Application.UserAppDataPath, "Logs");
                if (!Directory.Exists(logFileDir))
                {
                    Directory.CreateDirectory(logFileDir);
                }

                GlobalContext.Properties["LogDir"] = logFileDir;

                XmlConfigurator.Configure(new FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile));

                logger = LogManager.GetLogger(typeof(Program));

                /* Initialize and load the composition container for dependency injection */
                var aggregateCatalog = new AggregateCatalog();

                /* Just look in the executable directory for implementations */
                aggregateCatalog.Catalogs.Add(new DirectoryCatalog(AppDomain.CurrentDomain.BaseDirectory));

                var container = new CompositionContainer(aggregateCatalog);

                /* Create the printer inside of the using block (will delete the printer when this block
                 * exits as long as the printer did not already exist). */
                service = container.GetExportedValue <IPrinterService>();

                RunLoop(service);
            }
            catch (Exception ex)
            {
                logger.Fatal(ex);
            }
            finally
            {
                try
                {
                    if (service != null)
                    {
                        service.Dispose();
                    }
                }
                catch (Exception ex)
                {
                    logger.Fatal(ex);
                }
            }
        }
Пример #14
0
 public PrinterMapViewModel(PrinterMap model,
     IMenuService menuService, IPrinterService printerService, ICacheService cacheService)
 {
     Model = model;
     _menuService = menuService;
     _printerService = printerService;
     _cacheService = cacheService;
 }
Пример #15
0
 public TicketListerWidgetCreator(ITicketServiceBase ticketServiceBase, IPrinterService printerService,
                                  ICacheService cacheService, IAutomationDao automationDao)
 {
     _ticketServiceBase = ticketServiceBase;
     _printerService    = printerService;
     _cacheService      = cacheService;
     _automationDao     = automationDao;
 }
 public PrintAccountTransactionDocument(IAccountService accountService, ICacheService cacheService, IApplicationState applicationState,
     IPrinterService printerService)
 {
     _accountService = accountService;
     _cacheService = cacheService;
     _applicationState = applicationState;
     _printerService = printerService;
 }
Пример #17
0
 public PrinterMapViewModel(PrinterMap model,
                            IMenuService menuService, IPrinterService printerService, ICacheService cacheService)
 {
     Model           = model;
     _menuService    = menuService;
     _printerService = printerService;
     _cacheService   = cacheService;
 }
Пример #18
0
 public GenericModemDeviceFactory(IApplicationState applicationState, ICacheService cacheService, IEntityService entityService, IApplicationStateSetter applicationStateSetter, IPrinterService printerService)
 {
     this._applicationState       = applicationState;
     this._cacheService           = cacheService;
     this._entityService          = entityService;
     this._applicationStateSetter = applicationStateSetter;
     this._printerService         = printerService;
 }
Пример #19
0
 protected AbstractCidDevice(string key, string name, ICacheService cacheService, IApplicationState applicationState, IEntityService entityService, IApplicationStateSetter applicationStateSettter, IPrinterService printerService) : base(name, key)
 {
     this._cacheService            = cacheService;
     this._applicationState        = applicationState;
     this._entityService           = entityService;
     this._applicationStateSettter = applicationStateSettter;
     this._printerService          = printerService;
 }
Пример #20
0
 public BrestBTGateway(IPrinterService printerService,
                       IBrestBTClient brestBTClient,
                       IConfigurationProvider configurationProvider)
     : base(printerService)
 {
     _brestBTClient         = brestBTClient;
     _configurationProvider = configurationProvider;
 }
Пример #21
0
 public TicketListerWidgetCreator(ITicketServiceBase ticketServiceBase, IPrinterService printerService,
     ICacheService cacheService, IAutomationDao automationDao)
 {
     _ticketServiceBase = ticketServiceBase;
     _printerService = printerService;
     _cacheService = cacheService;
     _automationDao = automationDao;
 }
Пример #22
0
 public AccountTransactionDocumentViewModel(ICacheService cacheService, IPrinterService printerService, IApplicationState applicationState)
 {
     _cacheService     = cacheService;
     _printerService   = printerService;
     _applicationState = applicationState;
     AddItemCommand    = new CaptionCommand <string>(string.Format(Resources.Add_f, Resources.Line), OnAddItem);
     PrintCommand      = new CaptionCommand <string>(Resources.Print, OnPrint, CanPrint);
 }
 public PrintAccountTransactionDocument(IAccountService accountService, ICacheService cacheService, IApplicationState applicationState,
                                        IPrinterService printerService)
 {
     _accountService   = accountService;
     _cacheService     = cacheService;
     _applicationState = applicationState;
     _printerService   = printerService;
 }
Пример #24
0
 public PrintJobViewModel(IMenuService menuService, IPrinterService printerService, ICacheService cacheService)
 {
     _newPrinterMaps         = new List <PrinterMap>();
     _menuService            = menuService;
     _printerService         = printerService;
     _cacheService           = cacheService;
     AddPrinterMapCommand    = new CaptionCommand <string>(Resources.Add, OnAddPrinterMap);
     DeletePrinterMapCommand = new CaptionCommand <string>(Resources.Delete, OnDelete, CanDelete);
 }
 public EntityGridWidgetCreator(IEntityService entityService, IUserService userService, ICacheService cacheService,
                                IAutomationDao automationDao, IPrinterService printerService)
 {
     _entityService  = entityService;
     _userService    = userService;
     _cacheService   = cacheService;
     _automationDao  = automationDao;
     _printerService = printerService;
 }
Пример #26
0
 public EntityGridWidgetCreator(IEntityService entityService, IUserService userService, ICacheService cacheService, 
     IAutomationDao automationDao,IPrinterService printerService)
 {
     _entityService = entityService;
     _userService = userService;
     _cacheService = cacheService;
     _automationDao = automationDao;
     _printerService = printerService;
 }
Пример #27
0
 public VirtualViolationCreateEditViewModel(INavigationManager navigationManager, IViolationService violationService, IVideoService videoService, IPrinterService printerService) : base(navigationManager)
 {
     _printerService   = printerService;
     _violationService = violationService;
     _videoService     = videoService;
     _currentAccount   = SessionStorage.Instance.Get <AccountAssociationModel>(StorageConstants.ACCOUNT_ASSOCIATION_KEY);
     _violation        = SessionStorage.Instance.Get <ViolationModel>(StorageConstants.VIOLATION_ITEM_KEY);
     _video            = SessionStorage.Instance.Get <MediaFile>(StorageConstants.VIOLATION_VIDEO_FILE_KEY);
     _videoId          = SessionStorage.Instance.Get <Guid>(StorageConstants.VIDEO_FILE_ID_KEY);
     _thumbnail        = videoService.GetVideoThumbnailFromFile(_video.Path);
 }
Пример #28
0
 public DocumentCreatorViewModel(IAccountService accountService, ICacheService cacheService, IPrinterService printerService, IApplicationState applicationState)
 {
     _accountService = accountService;
     _cacheService = cacheService;
     _printerService = printerService;
     _applicationState = applicationState;
     SaveCommand = new CaptionCommand<string>(Resources.Save, OnSave);
     PrintCommand = new CaptionCommand<string>("Print", OnPrint);
     CancelCommand = new CaptionCommand<string>(Resources.Cancel, OnCancel);
     EventServiceFactory.EventService.GetEvent<GenericEvent<DocumentCreationData>>().Subscribe(OnDocumentCreation);
 }
Пример #29
0
 public DocumentCreatorViewModel(IAccountService accountService, ICacheService cacheService, IPrinterService printerService, IApplicationState applicationState)
 {
     _accountService   = accountService;
     _cacheService     = cacheService;
     _printerService   = printerService;
     _applicationState = applicationState;
     SaveCommand       = new CaptionCommand <string>(Resources.Save, OnSave);
     PrintCommand      = new CaptionCommand <string>("Print", OnPrint);
     CancelCommand     = new CaptionCommand <string>(Resources.Cancel, OnCancel);
     EventServiceFactory.EventService.GetEvent <GenericEvent <DocumentCreationData> >().Subscribe(OnDocumentCreation);
 }
Пример #30
0
        public Export(IPrinterService printerService)
        {
            _printerService = printerService;

            app.HelpOption("-?|-h|--help");
            app.OnExecute(() =>
            {
                _printerService.NodesToCsv();
                _printerService.EdgesToCsv();
                return(1);
            });
        }
Пример #31
0
        public TicketListViewModel(IApplicationState applicationState, IApplicationStateSetter applicationStateSetter,
            ITicketService ticketService, IAccountService accountService, IPrinterService printerService,
            IResourceService locationService, IUserService userService, IAutomationService automationService,
            ICacheService cacheService, TicketOrdersViewModel ticketOrdersViewModel, TicketTotalsViewModel totals)
        {
            _printerService = printerService;
            _ticketService = ticketService;
            _accountService = accountService;
            _locationService = locationService;
            _userService = userService;
            _applicationState = applicationState;
            _applicationStateSetter = applicationStateSetter;
            _automationService = automationService;
            _cacheService = cacheService;
            _ticketOrdersViewModel = ticketOrdersViewModel;
            _totals = totals;

            _selectedOrders = new ObservableCollection<Order>();

            PrintJobCommand = new CaptionCommand<PrintJob>(Resources.Print, OnPrintJobExecute, CanExecutePrintJob);
            SelectResourceCommand = new DelegateCommand<ResourceTemplate>(OnSelectResource);

            AddMenuItemCommand = new DelegateCommand<ScreenMenuItemData>(OnAddMenuItemCommandExecute);
            CloseTicketCommand = new CaptionCommand<string>(Resources.CloseTicket_r, OnCloseTicketExecute, CanCloseTicket);
            MakePaymentCommand = new CaptionCommand<string>(Resources.Settle, OnMakePaymentExecute, CanMakePayment);
            MakeFastPaymentCommand = new CaptionCommand<PaymentTemplate>("[FastPayment]", OnMakeFastPaymentExecute, CanMakeFastPayment);
            ShowAllOpenTickets = new CaptionCommand<string>(Resources.AllTickets_r, OnShowAllOpenTickets);
            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);
            ShowOrderTagsCommand = new CaptionCommand<OrderTagGroup>(Resources.Tag, OnShowOrderTagsExecute, CanShowOrderTagsExecute);
            CancelItemCommand = new CaptionCommand<string>(Resources.Cancel, OnCancelItemCommand, CanCancelSelectedItems);
            MoveOrdersCommand = new CaptionCommand<string>(Resources.MoveTicketLine, OnMoveOrders, CanMoveOrders);
            EditTicketNoteCommand = new CaptionCommand<string>(Resources.TicketNote, OnEditTicketNote, CanEditTicketNote);
            RemoveTicketLockCommand = new CaptionCommand<string>(Resources.ReleaseLock, OnRemoveTicketLock, CanRemoveTicketLock);
            ChangePriceCommand = new CaptionCommand<string>(Resources.ChangePrice, OnChangePrice, CanChangePrice);

            PaymentButtonGroup = new PaymentButtonGroupViewModel(MakeFastPaymentCommand, MakePaymentCommand, CloseTicketCommand);

            EventServiceFactory.EventService.GetEvent<GenericEvent<ScreenMenuItemData>>().Subscribe(OnMenuItemSelected);
            EventServiceFactory.EventService.GetEvent<GenericEvent<OrderViewModel>>().Subscribe(OnSelectedOrdersChanged);
            EventServiceFactory.EventService.GetEvent<GenericEvent<TicketTagData>>().Subscribe(OnTagSelected);
            EventServiceFactory.EventService.GetEvent<GenericEvent<EntityOperationRequest<Resource>>>().Subscribe(OnAccountSelectedForTicket);
            EventServiceFactory.EventService.GetEvent<GenericEvent<EntityOperationRequest<ResourceScreenItem>>>().Subscribe(OnResourceScreenItemSelected);
            EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(OnRefreshTicket);
            EventServiceFactory.EventService.GetEvent<GenericEvent<Message>>().Subscribe(OnMessageReceived);
            EventServiceFactory.EventService.GetEvent<GenericEvent<PopupData>>().Subscribe(OnAccountSelectedFromPopup);
            EventServiceFactory.EventService.GetEvent<GenericEvent<OrderTagData>>().Subscribe(OnOrderTagEvent);
            EventServiceFactory.EventService.GetEvent<GenericEvent<MenuItemPortion>>().Subscribe(OnPortionSelected);
            EventServiceFactory.EventService.GetEvent<GenericIdEvent>().Subscribe(OnTicketIdPublished);
        }
 public BatchDocumentCreatorViewModel(IAccountService accountService, ICacheService cacheService,
                                      IPrinterService printerService, IApplicationState applicationState)
 {
     Accounts          = new ObservableCollection <AccountRowViewModel>();
     _accountService   = accountService;
     _cacheService     = cacheService;
     _printerService   = printerService;
     _applicationState = applicationState;
     CreateDocuments   = new CaptionCommand <string>(string.Format(Resources.Create_f, "").Trim(), OnCreateDocuments, CanCreateDocument);
     GoBack            = new CaptionCommand <string>(Resources.Back, OnGoBack);
     Print             = new CaptionCommand <string>(Resources.Print, OnPrint);
 }
 public BatchDocumentCreatorViewModel(IAccountService accountService, ICacheService cacheService,
     IPrinterService printerService, IApplicationState applicationState)
 {
     Accounts = new ObservableCollection<AccountRowViewModel>();
     _accountService = accountService;
     _cacheService = cacheService;
     _printerService = printerService;
     _applicationState = applicationState;
     CreateDocuments = new CaptionCommand<string>(string.Format(Resources.Create_f, "").Trim(), OnCreateDocuments, CanCreateDocument);
     GoBack = new CaptionCommand<string>(Resources.Back, OnGoBack);
     Print = new CaptionCommand<string>(Resources.Print, OnPrint);
 }
Пример #34
0
 public AccountDetailsViewModel(IApplicationState applicationState, ICacheService cacheService,
                                IAccountService accountService, IPrinterService printerService)
 {
     _applicationState         = applicationState;
     _cacheService             = cacheService;
     _accountService           = accountService;
     _printerService           = printerService;
     CloseAccountScreenCommand = new CaptionCommand <string>(Resources.Close, OnCloseAccountScreen);
     DisplayTicketCommand      = new CaptionCommand <string>(Resources.FindTicket.Replace(" ", "\r"), OnDisplayTicket);
     PrintAccountCommand       = new CaptionCommand <string>(Resources.Print, OnPrintAccount);
     AccountDetails            = new ObservableCollection <AccountDetailViewModel>();
     DocumentTypes             = new ObservableCollection <DocumentTypeButtonViewModel>();
     AccountSummaries          = new ObservableCollection <AccountSummaryViewModel>();
     EventServiceFactory.EventService.GetEvent <GenericEvent <EntityOperationRequest <AccountData> > >().Subscribe(OnDisplayAccountTransactions);
 }
Пример #35
0
        public MusicContractServiceTests()
        {
            //setup our DI
            var serviceProvider = new ServiceCollection()
                                  .AddSingleton <IDataContext <MusicContract>, DataContext <MusicContract> >()
                                  .AddTransient <IRepository <MusicContract>, MusicContractRepository <MusicContract> >()
                                  .AddTransient <IDataContext <DistributionPartnerContract>, DataContext <DistributionPartnerContract> >()
                                  .AddTransient <IRepository <DistributionPartnerContract>, DistributionPartnerContractRepository <DistributionPartnerContract> >()
                                  .AddTransient <IMusicContractService, MusicContractService>()
                                  .AddTransient <IPrinterService <MusicContract>, ConsolePrinterService <MusicContract> >()
                                  .BuildServiceProvider();

            _musicContractService  = serviceProvider.GetService <IMusicContractService>();
            _consolePrinterService = serviceProvider.GetService <IPrinterService <MusicContract> >();
        }
Пример #36
0
 public AccountDetailsViewModel(IApplicationState applicationState, IAccountService accountService,
     IPrinterService printerService, ICacheService cacheService)
 {
     _applicationState = applicationState;
     _accountService = accountService;
     _printerService = printerService;
     _cacheService = cacheService;
     CloseAccountScreenCommand = new CaptionCommand<string>(Resources.Close, OnCloseAccountScreen);
     DisplayTicketCommand = new CaptionCommand<string>(Resources.FindTicket.Replace(" ", "\r"), OnDisplayTicket);
     PrintAccountCommand = new CaptionCommand<string>(Resources.Print, OnPrintAccount);
     AccountDetails = new ObservableCollection<AccountDetailViewModel>();
     DocumentTypes = new ObservableCollection<DocumentTypeButtonViewModel>();
     AccountSummaries = new ObservableCollection<AccountSummaryViewModel>();
     EventServiceFactory.EventService.GetEvent<GenericEvent<EntityOperationRequest<AccountData>>>().Subscribe(OnDisplayAccountTransactions);
 }
Пример #37
0
 public static AbstractPrintJob CreatePrintJob(Printer printer, IPrinterService printerService)
 {
     if (printer.IsTextPrinter)
         return new TextPrinterJob(printer);
     if (printer.IsHtmlPrinter)
         return new HtmlPrinterJob(printer);
     if (printer.IsPortPrinter)
         return new PortPrinterJob(printer);
     if (printer.IsDemoPrinter)
         return new DemoPrinterJob(printer);
     if (printer.IsWindowsPrinter)
         return new WindowsPrinterJob(printer);
     if (printer.IsCustomPrinter)
         return new CustomPrinterJob(printer, printerService);
     return new SlipPrinterJob(printer);
 }
Пример #38
0
        public JobsService(IAppSettings appSettings,
                           ISettingsService settingsService,
                           IFileService fileService,
                           IPrinterService printerService,
                           ILoggerService loggingService)
        {
            _settingsService = settingsService;
            _fileService     = fileService;
            _printerService  = printerService;
            _loggingService  = loggingService;

            _pusherApplicationKey = appSettings.PusherApplicationKey;
            _printingJobs         = new Dictionary <Printer, Job>();

            _settingsService.ChannelChangedEvent += _settingsService_ChannelChangedEvent;
        }
Пример #39
0
        static void Main(string[] args)
        {
            var printer = new IPrinterService[]
            {
                new InjectPrinter(),
                new LaserPrinter(),
                new LedPrinter()
            };

            Console.WriteLine("We have:");

            foreach (var p in printer)
            {
                p.Print();
            }

            Console.ReadLine();
        }
Пример #40
0
        public EntityGridWidgetViewModel(Widget model, IApplicationState applicationState, IPrinterService printerService,
            IEntityService entityService, IUserService userService, ICacheService cacheService, IAutomationDao automationDao)
            : base(model, applicationState)
        {
            _applicationState = applicationState;
            _cacheService = cacheService;
            _automationDao = automationDao;
            ResourceSelectorViewModel = new EntitySelectorViewModel(applicationState, entityService, userService, cacheService, printerService);

            EventServiceFactory.EventService.GetEvent<GenericEvent<WidgetEventData>>().Subscribe(
                x =>
                {
                    if (x.Value.WidgetName == Name)
                    {
                        Settings.StateFilterName = x.Value.Value;
                        Refresh();
                    }
                });
        }
Пример #41
0
        public ConsoleViewModel(
            IConsoleService consoleService,
            ISerialPortService serialPortService,
            ISettingsService settingsService,
            IClipboardService clipboardService,
            IDialogService dialogService,
            IApplicationServices applicationServices,
            IWindowService windowService,
            IPrinterService printerService,
            ITaskHelpers taskHelpers)
        {
            // Services

            ConsoleService      = consoleService;
            SerialPortService   = serialPortService;
            SettingsService     = settingsService;
            ClipboardService    = clipboardService;
            DialogService       = dialogService;
            ApplicationServices = applicationServices;
            WindowService       = windowService;
            PrinterService      = printerService;
            TaskHelpers         = taskHelpers;


            // Commands

            NewSessionCommand        = new AsyncRelayCommand(NewSessionCommandImpl);
            EndSessionCommand        = new RelayCommand(EndSessionCommandImpl);
            SaveCommand              = new AsyncRelayCommand(SaveCommandImpl);
            PrintCommand             = new RelayCommand(PrintCommandImpl);
            ClearCommand             = new RelayCommand(ClearCommandImpl);
            CopyCommand              = new RelayCommand(CopyCommandImpl);
            PasteCommand             = new AsyncRelayCommand(PasteCommandImpl);
            PasteAndSendCommand      = new AsyncRelayCommand(PasteAndSendCommandImpl);
            PasteAndSendLinesCommand = new AsyncRelayCommand(PasteAndSendLinesCommandImpl);
            CutCommand       = new AsyncRelayCommand(CutCommandImpl);
            SelectAllCommand = new RelayCommand(SelectAllCommandImpl);
            QuitCommand      = new RelayCommand(QuitCommandImpl);
            SettingsCommand  = new RelayCommand(SettingsCommandImpl);

            Title = "Serial Port Utility";
        }
        public TicketListerWidgetViewModel(Widget model, IApplicationState applicationState, ITicketServiceBase ticketService,
            IPrinterService printerService, ISettingService settingService)
            : base(model, applicationState)
        {
            _applicationState = applicationState;
            _ticketService = ticketService;
            _printerService = printerService;
            _settingService = settingService;

            EventServiceFactory.EventService.GetEvent<GenericEvent<Message>>().Subscribe(
            x =>
            {
                if (_applicationState.ActiveAppScreen == AppScreens.EntityView
                    && x.Topic == EventTopicNames.MessageReceivedEvent
                    && x.Value.Command == Messages.TicketRefreshMessage)
                {
                    Refresh();
                }
            });
        }
Пример #43
0
        public TicketListerWidgetViewModel(Widget model, IApplicationState applicationState, ITicketServiceBase ticketService,
                                           IPrinterService printerService, ISettingService settingService)
            : base(model, applicationState)
        {
            _applicationState = applicationState;
            _ticketService    = ticketService;
            _printerService   = printerService;
            _settingService   = settingService;

            EventServiceFactory.EventService.GetEvent <GenericEvent <Message> >().Subscribe(
                x =>
            {
                if (_applicationState.ActiveAppScreen == AppScreens.EntityView &&
                    x.Topic == EventTopicNames.MessageReceivedEvent &&
                    x.Value.Command == Messages.TicketRefreshMessage)
                {
                    Refresh();
                }
            });
        }
        public AccountSelectorViewModel(IAccountService accountService, ICacheService cacheService, IApplicationState applicationState,
                                        IPrinterService printerService)
        {
            _accounts                    = new ObservableCollection <AccountRowData>();
            _accountService              = accountService;
            _cacheService                = cacheService;
            _applicationState            = applicationState;
            _printerService              = printerService;
            ShowAccountDetailsCommand    = new CaptionCommand <string>(Resources.AccountDetails.Replace(' ', '\r'), OnShowAccountDetails, CanShowAccountDetails);
            PrintCommand                 = new CaptionCommand <string>(Resources.Print, OnPrint);
            AccountButtonSelectedCommand = new CaptionCommand <AccountScreen>("", OnAccountScreenSelected);

            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.ResetCache)
                {
                    _accountButtons        = null;
                    _batchDocumentButtons  = null;
                    _selectedAccountScreen = null;
                }
            });
        }
Пример #45
0
        public EntitySelectorViewModel(IApplicationState applicationState, IEntityService entityService,
            IUserService userService, ICacheService cacheService, IPrinterService printerService)
        {
            _applicationState = applicationState;
            _entityService = entityService;
            _userService = userService;
            _cacheService = cacheService;
            _printerService = printerService;

            EntitySelectionCommand = new DelegateCommand<EntityScreenItemViewModel>(OnSelectEntityExecuted);
            IncPageNumberCommand = new CaptionCommand<string>(Resources.NextPage + " >>", OnIncPageNumber, CanIncPageNumber);
            DecPageNumberCommand = new CaptionCommand<string>("<< " + Resources.PreviousPage, OnDecPageNumber, CanDecPageNumber);

            EventServiceFactory.EventService.GetEvent<GenericEvent<Message>>().Subscribe(
                x =>
                {
                    if (_applicationState.ActiveAppScreen == AppScreens.EntityView
                        && x.Topic == EventTopicNames.MessageReceivedEvent
                        && x.Value.Command == Messages.TicketRefreshMessage)
                    {
                        RefreshEntityScreenItems();
                    }
                });
        }
Пример #46
0
        public EntitySelectorViewModel(IApplicationState applicationState, IEntityService entityService,
                                       IUserService userService, ICacheService cacheService, IPrinterService printerService)
        {
            _applicationState = applicationState;
            _entityService    = entityService;
            _userService      = userService;
            _cacheService     = cacheService;
            _printerService   = printerService;

            EntitySelectionCommand = new DelegateCommand <EntityScreenItemViewModel>(OnSelectEntityExecuted);
            IncPageNumberCommand   = new CaptionCommand <string>(Resources.NextPage + " >>", OnIncPageNumber, CanIncPageNumber);
            DecPageNumberCommand   = new CaptionCommand <string>("<< " + Resources.PreviousPage, OnDecPageNumber, CanDecPageNumber);

            EventServiceFactory.EventService.GetEvent <GenericEvent <Message> >().Subscribe(
                x =>
            {
                if (_applicationState.ActiveAppScreen == AppScreens.EntityView &&
                    x.Topic == EventTopicNames.MessageReceivedEvent &&
                    x.Value.Command == Messages.TicketRefreshMessage)
                {
                    RefreshEntityScreenItems();
                }
            });
        }
Пример #47
0
 public PrintEntity(ICacheService cacheService, IPrinterService printerService,IEntityService entityService)
 {
     _cacheService = cacheService;
     _printerService = printerService;
     _entityService = entityService;
 }
Пример #48
0
 public ReportService(IAccountService accountService, IPrinterService printerService, ISettingService settingService)
 {
     _accountService = accountService;
     _printerService = printerService;
     _settingService = settingService;
 }
Пример #49
0
 public CustomPrinterJob(Printer printer, IPrinterService printerService)
     : base(printer)
 {
     _printerService = printerService;
 }
 public PrinterController(IPrinterService printerService)
 {
     this.printerService = printerService;
 }
 public TicketListerWidgetCreator(ITicketServiceBase ticketServiceBase, IPrinterService printerService, ISettingService settingService)
 {
     _ticketServiceBase = ticketServiceBase;
     _printerService = printerService;
     _settingService = settingService;
 }
Пример #52
0
        public MainViewModel(IMessageBoxService servMsgBox, IFileManagerDialogService servFileManager,
            IProcessStarterService servProcess, IPrinterService servImpr)
        {
            ////if (IsInDesignMode)
            ////{
            ////    // Code runs in Blend --> create design time data.
            ////}
            ////else
            ////{
            ////    // Code runs "for real"
            ////}

            
            ArchivoActual = new Archivo();            
            ListaMensajesCompilacion = new ObservableCollection<MensajeCompilacion>();

            
            CommandNew = new RelayCommand(New);
            CommandOpen = new RelayCommand(Open);
            CommandSave = new RelayCommand(Save);
            CommandSaveAs = new RelayCommand(SaveAs);
            CommandPrint = new RelayCommand(Print);
            CommandExit = new RelayCommand(Exit);


            CommandCompilar = new RelayCommand(Compilar);
            CommandEjecutar = new RelayCommand(Ejecutar);

            CommandAbrirManual = new RelayCommand(AbrirManual);
            CommandAboutUs = new RelayCommand(AboutUs);


            servicioMessageBox = servMsgBox;
            servicioFileManager = servFileManager;
            servicioImpresion = servImpr;
            servicioProcesos = servProcess;

            compilador = new Compilador();
        }
        public AccountSelectorViewModel(IAccountService accountService, ICacheService cacheService, IApplicationState applicationState, 
            IPrinterService printerService)
        {
            _accounts = new ObservableCollection<AccountRowData>();
            _accountService = accountService;
            _cacheService = cacheService;
            _applicationState = applicationState;
            _printerService = printerService;
            ShowAccountDetailsCommand = new CaptionCommand<string>(Resources.AccountDetails.Replace(' ', '\r'), OnShowAccountDetails, CanShowAccountDetails);
            PrintCommand = new CaptionCommand<string>(Resources.Print, OnPrint);
            AccountButtonSelectedCommand = new CaptionCommand<AccountScreen>("", OnAccountScreenSelected);

            EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(
            x =>
            {
                if (x.Topic == EventTopicNames.ResetCache)
                {
                    _accountButtons = null;
                    _batchDocumentButtons = null;
                    _selectedAccountScreen = null;
                }
            });
        }
Пример #54
0
 public FizzBuzzService(IPrinterService printerService)
 {
     _printerService = printerService;
 }