예제 #1
0
        public AutomateDbGenerator(IDbContextFactory dbContextFactory)
        {
            var jsonSerializer = new NewtonsoftJsonSerializer();

            var acpfMock = new Mock <INamedServiceFactory <IAutomationConditionProvider> >();

            acpfMock.Setup(x => x.GetRequiredService(FieldAutomationCondition.TypeCode))
            .Returns(new NoopAutomationConditionProvider {
                RuleType = new AutomationRuleType {
                    Type = typeof(FieldAutomationCondition)
                }
            });

            var aapfMock = new Mock <INamedServiceFactory <IAutomationActionProvider> >();

            aapfMock.Setup(x => x.GetRequiredService(NotifyByEmailAutomationAction.TypeCode))
            .Returns(new NoopAutomationActionProvider {
                RuleType = new AutomationRuleType {
                    Type = typeof(NotifyByEmailAutomationAction)
                }
            });

            var automationRepository = new DbAutomationRepository(dbContextFactory, acpfMock.Object, aapfMock.Object, jsonSerializer);

            _automationService = new DefaultAutomationService(dbContextFactory, jsonSerializer);

            _getAutomationHandler = new GetAutomationHandler(automationRepository);
        }
예제 #2
0
 public ActionContainerViewModel(ActionContainer model, RuleViewModel ruleViewModel, IAutomationService automationService,IAutomationDao automationDao)
 {
     Model = model;
     _ruleViewModel = ruleViewModel;
     _automationService = automationService;
     _automationDao = automationDao;
 }
예제 #3
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);
                        }
                    }
                }
            });
        }
예제 #4
0
 /// <summary>
 /// Default constructor for all automations.
 /// </summary>
 public AutomationBackgroundService(
     IAutomationService automationService,
     ILogger <AutomationBackgroundService> logger)
 {
     _service = automationService;
     _logger  = logger;
 }
예제 #5
0
        public TicketViewModel(Ticket model, TicketTemplate ticketTemplate, bool forcePayment,
            ITicketService ticketService, IAutomationService automationService,
            IApplicationState applicationState)
        {
            _ticketService = ticketService;
            _forcePayment = forcePayment;
            _model = model;
            _ticketTemplate = ticketTemplate;
            _automationService = automationService;
            _applicationState = applicationState;

            _orders = new ObservableCollection<OrderViewModel>(model.Orders.Select(x => new OrderViewModel(x, ticketTemplate, _automationService)).OrderBy(x => x.Model.CreatedDateTime));
            _itemsViewSource = new CollectionViewSource { Source = _orders };
            _itemsViewSource.GroupDescriptions.Add(new PropertyGroupDescription("GroupObject"));

            SelectAllItemsCommand = new CaptionCommand<string>("", OnSelectAllItemsExecute);

            PrintJobButtons = _applicationState.CurrentTerminal.PrintJobs
                .Where(x => (!string.IsNullOrEmpty(x.ButtonHeader))
                    && (x.PrinterMaps.Count(y => y.DepartmentId == 0 || y.DepartmentId == model.DepartmentId) > 0))
                .OrderBy(x => x.Order)
                .Select(x => new PrintJobButton(x, Model));

            if (PrintJobButtons.Count(x => x.Model.UseForPaidTickets) > 0)
            {
                PrintJobButtons = IsPaid
                    ? PrintJobButtons.Where(x => x.Model.UseForPaidTickets)
                    : PrintJobButtons.Where(x => !x.Model.UseForPaidTickets);
            }
        }
예제 #6
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 ActionContainerViewModel(ActionContainer model, RuleViewModel ruleViewModel, IAutomationService automationService, IAutomationDao automationDao)
 {
     Model              = model;
     _ruleViewModel     = ruleViewModel;
     _automationService = automationService;
     _automationDao     = automationDao;
 }
예제 #8
0
        public AccountModule(IRegionManager regionManager,
            IAutomationService automationService,
            IUserService userService,
            IAccountService accountService,
            AccountSelectorView accountSelectorView, AccountSelectorViewModel accountSelectorViewModel,
            AccountDetailsView accountDetailsView,
            DocumentCreatorView documentCreatorView,
            BatchDocumentCreatorView batchDocumentCreatorView, BatchDocumentCreatorViewModel batchDocumentCreatorViewModel)
            : base(regionManager, AppScreens.AccountList)
        {
            _regionManager = regionManager;
            _userService = userService;
            _accountService = accountService;
            _accountSelectorView = accountSelectorView;
            _accountSelectorViewModel = accountSelectorViewModel;
            _accountDetailsView = accountDetailsView;
            _documentCreatorView = documentCreatorView;
            _batchDocumentCreatorView = batchDocumentCreatorView;
            _batchDocumentCreatorViewModel = batchDocumentCreatorViewModel;

            AddDashboardCommand<EntityCollectionViewModelBase<AccountTypeViewModel, AccountType>>(Resources.AccountType.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand<EntityCollectionViewModelBase<AccountViewModel, Account>>(Resources.Account.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand<EntityCollectionViewModelBase<AccountScreenViewModel, AccountScreen>>(Resources.AccountScreen.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand<EntityCollectionViewModelBase<AccountTransactionTypeViewModel, AccountTransactionType>>(Resources.TransactionType.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand<EntityCollectionViewModelBase<AccountTransactionDocumentTypeViewModel, AccountTransactionDocumentType>>(Resources.DocumentType.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand<EntityCollectionViewModelBase<AccountTransactionDocumentViewModel, AccountTransactionDocument>>(Resources.TransactionDocument.ToPlural(), Resources.Accounts, 40);

            PermissionRegistry.RegisterPermission(PermissionNames.NavigateAccountView, PermissionCategories.Navigation, Resources.CanNavigateCash);
            PermissionRegistry.RegisterPermission(PermissionNames.CreateAccount, PermissionCategories.Account, Resources.CanCreateAccount);

            SetNavigationCommand(Resources.Accounts, Resources.Common, "Images/Xls.png", 70);

            automationService.RegisterActionType(ActionNames.CreateAccountTransactionDocument, string.Format(Resources.Create_f, Resources.AccountTransactionDocument), new { AccountTransactionDocumentName = "" });
        }
예제 #9
0
        public AreaService(
            IComponentService componentService,
            IAutomationService automationService,
            ISystemEventsService systemEventsService,
            ISystemInformationService systemInformationService,
            IApiService apiService,
            ISettingsService settingsService)
        {
            if (componentService == null) throw new ArgumentNullException(nameof(componentService));
            if (automationService == null) throw new ArgumentNullException(nameof(automationService));
            if (systemEventsService == null) throw new ArgumentNullException(nameof(systemEventsService));
            if (systemInformationService == null) throw new ArgumentNullException(nameof(systemInformationService));
            if (apiService == null) throw new ArgumentNullException(nameof(apiService));
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));

            _componentService = componentService;
            _automationService = automationService;
            _apiService = apiService;
            _settingsService = settingsService;

            systemEventsService.StartupCompleted += (s, e) =>
            {
                systemInformationService.Set("Areas/Count", _areas.GetAll().Count);
            };

            apiService.ConfigurationRequested += HandleApiConfigurationRequest;
        }
예제 #10
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));

        }
예제 #11
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";
        }
예제 #12
0
 public RuleViewModel(IAutomationService automationService, IAutomationDao automationDao)
 {
     _automationService   = automationService;
     _automationDao       = automationDao;
     SelectActionsCommand = new CaptionCommand <string>(Resources.SelectActions, OnSelectActions);
     Constraints          = new ObservableCollection <RuleConstraint>();
 }
예제 #13
0
        public UserInteraction(IAutomationService automationService)
        {
            _popupDataViewModel = new PopupDataViewModel();

            automationService.RegisterActionType("ShowMessage", Resources.ShowMessage, new { Message = "" });
            automationService.RegisterActionType("DisplayPopup", Resources.DisplayPopup, new { Title = "", Message = "", Color = "" });

            EventServiceFactory.EventService.GetEvent <GenericEvent <IActionData> >().Subscribe(x =>
            {
                if (x.Value.Action.ActionType == "ShowMessage")
                {
                    var param = x.Value.GetAsString("Message");
                    if (!string.IsNullOrEmpty(param))
                    {
                        GiveFeedback(param);
                    }
                }

                if (x.Value.Action.ActionType == "DisplayPopup")
                {
                    var title   = x.Value.GetAsString("Title");
                    var message = x.Value.GetAsString("Message");
                    var color   = x.Value.GetAsString("Color");
                    color       = string.IsNullOrEmpty(color.Trim()) ? "DarkRed" : color;
                    if (!string.IsNullOrEmpty(message.Trim()))
                    {
                        DisplayPopup(title, message, null, "", color);
                    }
                }
            });
        }
예제 #14
0
        private void Button2_Click(object sender, EventArgs e)
        {
            try
            {
                // http://taeyo.net/columns/View.aspx?SEQ=347&PSEQ=23&IDX=5
                Uri             uri = new Uri("http://localhost:53045/Services/Automation/AutomationService.svc");
                ServiceEndpoint ep  = new ServiceEndpoint(
                    ContractDescription.GetContract(typeof(IAutomationService)),
                    new BasicHttpBinding(),
                    new EndpointAddress(uri));

                ChannelFactory <IAutomationService> factory = new ChannelFactory <IAutomationService>(ep);

                IAutomationService          proxy      = factory.CreateChannel();
                Dictionary <string, object> parameters = new Dictionary <string, object>();
                parameters.Add("ID", "aaa");
                //var result = proxy.SelectDeptList(parameters);

                var results = proxy.SelectSiteList(parameters);

                (proxy as IDisposable).Dispose();
            }
            catch (Exception ex)
            {
            }
        }
예제 #15
0
        public AccountModule(IRegionManager regionManager,
                             IAutomationService automationService,
                             IUserService userService,
                             IAccountService accountService,
                             AccountSelectorView accountSelectorView, AccountSelectorViewModel accountSelectorViewModel,
                             AccountDetailsView accountDetailsView,
                             DocumentCreatorView documentCreatorView,
                             BatchDocumentCreatorView batchDocumentCreatorView, BatchDocumentCreatorViewModel batchDocumentCreatorViewModel)
            : base(regionManager, AppScreens.AccountList)
        {
            _regionManager                 = regionManager;
            _userService                   = userService;
            _accountService                = accountService;
            _accountSelectorView           = accountSelectorView;
            _accountSelectorViewModel      = accountSelectorViewModel;
            _accountDetailsView            = accountDetailsView;
            _documentCreatorView           = documentCreatorView;
            _batchDocumentCreatorView      = batchDocumentCreatorView;
            _batchDocumentCreatorViewModel = batchDocumentCreatorViewModel;

            AddDashboardCommand <EntityCollectionViewModelBase <AccountTypeViewModel, AccountType> >(Resources.AccountType.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand <EntityCollectionViewModelBase <AccountViewModel, Account> >(Resources.Account.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand <EntityCollectionViewModelBase <AccountScreenViewModel, AccountScreen> >(Resources.AccountScreen.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand <EntityCollectionViewModelBase <AccountTransactionTypeViewModel, AccountTransactionType> >(Resources.TransactionType.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand <EntityCollectionViewModelBase <AccountTransactionDocumentTypeViewModel, AccountTransactionDocumentType> >(Resources.DocumentType.ToPlural(), Resources.Accounts, 40);
            AddDashboardCommand <EntityCollectionViewModelBase <AccountTransactionDocumentViewModel, AccountTransactionDocument> >(Resources.TransactionDocument.ToPlural(), Resources.Accounts, 40);

            PermissionRegistry.RegisterPermission(PermissionNames.NavigateAccountView, PermissionCategories.Navigation, Resources.CanNavigateCash);
            PermissionRegistry.RegisterPermission(PermissionNames.CreateAccount, PermissionCategories.Account, Resources.CanCreateAccount);

            SetNavigationCommand(Resources.Accounts, Resources.Common, "Images/Xls.png", 70);

            automationService.RegisterActionType(ActionNames.CreateAccountTransactionDocument, string.Format(Resources.Create_f, Resources.AccountTransactionDocument), new { AccountTransactionDocumentName = "" });
        }
 public ReturningAmountViewModel(ICacheService cacheService, IAutomationService automationService,
      PaymentEditor paymentEditor)
 {
     _cacheService = cacheService;
     _automationService = automationService;
     _paymentEditor = paymentEditor;
 }
예제 #17
0
 public OrderViewModel(Order model, IAutomationService automationService)
 {
     _model = model;
     _automationService = automationService;
     ResetSelectedQuantity();
     ItemSelectedCommand = new DelegateCommand<OrderViewModel>(OnItemSelected);
     UpdateItemColor();
 }
예제 #18
0
 public OrderViewModel(Order model, TicketTemplate ticketTemplate, IAutomationService ruleService)
 {
     _model = model;
     _ticketTemplate = ticketTemplate;
     _automationService = ruleService;
     ResetSelectedQuantity();
     ItemSelectedCommand = new DelegateCommand<OrderViewModel>(OnItemSelected);
     UpdateItemColor();
 }
예제 #19
0
 public UserService(IUserDao userDao, IApplicationState applicationState, IApplicationStateSetter applicationStateSetter,
     IDepartmentService departmentService, IAutomationService automationService)
 {
     _userDao = userDao;
     _applicationState = applicationState;
     _applicationStateSetter = applicationStateSetter;
     _departmentService = departmentService;
     _automationService = automationService;
 }
예제 #20
0
 public RuleViewModel(IAutomationService automationService, IAutomationDao automationDao)
 {
     _automationService      = automationService;
     _automationDao          = automationDao;
     SelectActionsCommand    = new CaptionCommand <string>(Resources.SelectActions, OnSelectActions);
     AddConstraintCommand    = new CaptionCommand <string>(string.Format(Resources.Add_f, Resources.CustomConstraint), OnAddConstraint, CanAddConstraint);
     RemoveConstraintCommand = new CaptionCommand <RuleConstraintValueViewModel>(Resources.Remove, OnRemoveConstraint);
     Constraints             = new ObservableCollection <RuleConstraint>();
 }
예제 #21
0
 public InstallingViewModel()
 {
     Messenger.Default.Register<InstallationProgressMessage>(this, HandleMessage);
     var loc = new LocalServiceLocator();
     update = loc.UpdateService;
     nav = loc.NavigationService;
     Automation = loc.AutomationService;
     Loaded += OnLoaded;
     Title = "CoApp Update";
 }
예제 #22
0
        public UtilityChannelViewModel(
            string name, IUnityContainer contain, IRegionManager regman, IEventAggregator events, IChatModel cm,
            ICharacterManager manager, IAutomationService automation)
            : base(contain, regman, events, cm, manager)
        {
            this.automation = automation;
            try
            {
                Model = Container.Resolve<GeneralChannelModel>(name);
                ConnectTime = 0;
                flavorText = new StringBuilder("Connecting");
                connectDotDot = new StringBuilder();

                Container.RegisterType<object, UtilityChannelView>(Model.Id, new InjectionConstructor(this));
                minuteOnlineCount = new CacheCount(OnlineCountPrime, 15, 1000*15);

                updateTimer.Enabled = true;
                updateTimer.Elapsed += (s, e) =>
                    {
                        OnPropertyChanged("RoughServerUpTime");
                        OnPropertyChanged("RoughClientUpTime");
                        OnPropertyChanged("LastMessageReceived");
                        OnPropertyChanged("IsConnecting");
                    };

                updateTimer.Elapsed += UpdateConnectText;

                Events.GetEvent<NewUpdateEvent>().Subscribe(
                    param =>
                        {
                            if (!(param is CharacterUpdateModel))
                                return;

                            var temp = param as CharacterUpdateModel;
                            if (!(temp.Arguments is CharacterUpdateModel.LoginStateChangedEventArgs))
                                return;

                            OnPropertyChanged("OnlineCount");
                            OnPropertyChanged("OnlineFriendsCount");
                            OnPropertyChanged("OnlineBookmarksCount");
                            OnPropertyChanged("OnlineCountChange");
                        });

                Events.GetEvent<LoginAuthenticatedEvent>().Subscribe(LoggedInEvent);
                Events.GetEvent<LoginFailedEvent>().Subscribe(LoginFailedEvent);
                Events.GetEvent<ReconnectingEvent>().Subscribe(LoginReconnectingEvent);
            }
            catch (Exception ex)
            {
                ex.Source = "Utility Channel ViewModel, init";
                Exceptions.HandleException(ex);
            }
        }
예제 #23
0
 public TicketService(ITicketDao ticketDao, IDepartmentService departmentService, IApplicationState applicationState,
     IAutomationService automationService, IUserService userService, ISettingService settingService,
     IAccountService accountService, ICacheService cacheService)
 {
     _ticketDao = ticketDao;
     _applicationState = applicationState;
     _automationService = automationService;
     _userService = userService;
     _settingService = settingService;
     _accountService = accountService;
     _cacheService = cacheService;
 }
예제 #24
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);
        }
예제 #25
0
        public UpdatingViewModel()
        {
            Title = "CoApp Update";

            var loc = new LocalServiceLocator();
            UpdateService = loc.UpdateService;
            NavigationService = loc.NavigationService;
            AutomationService = loc.AutomationService;

            Loaded += HandleLoaded;
            Unloaded += OnUnloaded;
        }
예제 #26
0
        public UserService(IApplicationState applicationState, IApplicationStateSetter applicationStateSetter,
                           IDepartmentService departmentService, IAutomationService automationService)
        {
            _applicationState       = applicationState;
            _applicationStateSetter = applicationStateSetter;
            _departmentService      = departmentService;
            _automationService      = automationService;

            ValidatorRegistry.RegisterDeleteValidator(new UserDeleteValidator());
            ValidatorRegistry.RegisterDeleteValidator(new UserRoleDeleteValidator());
            ValidatorRegistry.RegisterSaveValidator(new UserSaveValidator());
        }
예제 #27
0
        public AutomationModule(IAutomationService automationService, IApplicationState applicationState)
        {
            _automationService = automationService;
            _applicationState  = applicationState;

            AddDashboardCommand <EntityCollectionViewModelBase <RuleActionViewModel, AppAction> >(Resources.RuleActions, Resources.Automation, 45);
            AddDashboardCommand <EntityCollectionViewModelBase <RuleViewModel, AppRule> >(Resources.Rules, Resources.Automation, 45);
            AddDashboardCommand <TriggerListViewModel>(Resources.Trigger.ToPlural(), Resources.Automation, 45);
            AddDashboardCommand <EntityCollectionViewModelBase <AutomationCommandViewModel, AutomationCommand> >(Resources.AutomationCommand.ToPlural(), Resources.Automation, 45);
            AddDashboardCommand <EntityCollectionViewModelBase <ScriptViewModel, Script> >(Resources.Script.ToPlural(), Resources.Automation, 45);

            HighlightingManager.Instance.RegisterHighlighting("SambaDSL", null, () => LoadHighlightingDefinition("SambaDSL.xshd"));
        }
예제 #28
0
        public AutomationModule(IExpressionService expressionService, IAutomationService automationService)
        {
            _expressionService = expressionService;
            AddDashboardCommand<EntityCollectionViewModelBase<RuleActionViewModel, AppAction>>(Resources.RuleActions, Resources.Automation, 45);
            AddDashboardCommand<EntityCollectionViewModelBase<RuleViewModel, AppRule>>(Resources.Rules, Resources.Automation, 45);
            AddDashboardCommand<TriggerListViewModel>(Resources.Trigger.ToPlural(), Resources.Automation, 45);
            AddDashboardCommand<EntityCollectionViewModelBase<AutomationCommandViewModel, AutomationCommand>>(Resources.AutomationCommand.ToPlural(), Resources.Automation, 45);
            AddDashboardCommand<EntityCollectionViewModelBase<ScriptViewModel, Script>>(Resources.Script.ToPlural(), Resources.Automation, 45);

            automationService.RegisterActionType(ActionNames.ExecuteScript, Resources.ExecuteScript, new { ScriptName = "" });

            HighlightingManager.Instance.RegisterHighlighting("SambaDSL", null, () => LoadHighlightingDefinition("SambaDSL.xshd"));
        }
예제 #29
0
        public TicketService(IDepartmentService departmentService, IApplicationState applicationState, IAutomationService automationService,
                             IUserService userService, ISettingService settingService, ICacheService cacheService, IAccountService accountService)
        {
            _departmentService = departmentService;
            _applicationState  = applicationState;
            _automationService = automationService;
            _userService       = userService;
            _settingService    = settingService;
            _cacheService      = cacheService;
            _accountService    = accountService;

            ValidatorRegistry.RegisterConcurrencyValidator(new TicketConcurrencyValidator());
        }
예제 #30
0
        public AutomationModule(IExpressionService expressionService, IAutomationService automationService)
        {
            _expressionService = expressionService;
            AddDashboardCommand <EntityCollectionViewModelBase <RuleActionViewModel, AppAction> >(Resources.RuleActions, Resources.Automation, 45);
            AddDashboardCommand <EntityCollectionViewModelBase <RuleViewModel, AppRule> >(Resources.Rules, Resources.Automation, 45);
            AddDashboardCommand <TriggerListViewModel>(Resources.Trigger.ToPlural(), Resources.Automation, 45);
            AddDashboardCommand <EntityCollectionViewModelBase <AutomationCommandViewModel, AutomationCommand> >(Resources.AutomationCommand.ToPlural(), Resources.Automation, 45);
            AddDashboardCommand <EntityCollectionViewModelBase <ScriptViewModel, Script> >(Resources.Script.ToPlural(), Resources.Automation, 45);

            automationService.RegisterActionType(ActionNames.ExecuteScript, Resources.ExecuteScript, new { ScriptName = "" });

            HighlightingManager.Instance.RegisterHighlighting("SambaDSL", null, () => LoadHighlightingDefinition("SambaDSL.xshd"));
        }
예제 #31
0
        public WorkPeriodsViewModel(IWorkPeriodService workPeriodService, IApplicationState applicationState,
                                    IAutomationService ruleService, ITicketService ticketService)
        {
            _workPeriodService = workPeriodService;
            _applicationState  = applicationState;
            _automationService = ruleService;
            _ticketService     = ticketService;

            StartOfDayCommand = new CaptionCommand <string>(Resources.StartWorkPeriod, OnStartOfDayExecute, CanStartOfDayExecute);
            EndOfDayCommand   = new CaptionCommand <string>(Resources.EndWorkPeriod, OnEndOfDayExecute, CanEndOfDayExecute);
            DisplayStartOfDayScreenCommand = new CaptionCommand <string>(Resources.StartWorkPeriod, OnDisplayStartOfDayScreenCommand, CanStartOfDayExecute);
            DisplayEndOfDayScreenCommand   = new CaptionCommand <string>(Resources.EndWorkPeriod, OnDisplayEndOfDayScreenCommand, CanEndOfDayExecute);
            CancelCommand = new CaptionCommand <string>(Resources.Cancel, OnCancel);
        }
예제 #32
0
        public WorkPeriodsViewModel(IWorkPeriodService workPeriodService, IApplicationState applicationState,
            IAutomationService ruleService, ITicketService ticketService)
        {
            _workPeriodService = workPeriodService;
            _applicationState = applicationState;
            _automationService = ruleService;
            _ticketService = ticketService;

            StartOfDayCommand = new CaptionCommand<string>(Resources.StartWorkPeriod, OnStartOfDayExecute, CanStartOfDayExecute);
            EndOfDayCommand = new CaptionCommand<string>(Resources.EndWorkPeriod, OnEndOfDayExecute, CanEndOfDayExecute);
            DisplayStartOfDayScreenCommand = new CaptionCommand<string>(Resources.StartWorkPeriod, OnDisplayStartOfDayScreenCommand, CanStartOfDayExecute);
            DisplayEndOfDayScreenCommand = new CaptionCommand<string>(Resources.EndWorkPeriod, OnDisplayEndOfDayScreenCommand, CanEndOfDayExecute);
            CancelCommand = new CaptionCommand<string>(Resources.Cancel, OnCancel);
        }
예제 #33
0
        public AutomationModule(IAutomationService automationService, IApplicationState applicationState)
        {
            _automationService = automationService;
            _applicationState = applicationState;

            AddDashboardCommand<EntityCollectionViewModelBase<RuleActionViewModel, AppAction>>(Resources.RuleActions, Resources.Automation, 45);
            AddDashboardCommand<EntityCollectionViewModelBase<RuleViewModel, AppRule>>(Resources.Rules, Resources.Automation, 45);
            AddDashboardCommand<TriggerListViewModel>(Resources.Trigger.ToPlural(), Resources.Automation, 45);
            AddDashboardCommand<EntityCollectionViewModelBase<AutomationCommandViewModel, AutomationCommand>>(Resources.AutomationCommand.ToPlural(), Resources.Automation, 45);
            AddDashboardCommand<EntityCollectionViewModelBase<ScriptViewModel, Script>>(Resources.Script.ToPlural(), Resources.Automation, 45);

            HighlightingManager.Instance.RegisterHighlighting("SambaDSL", null, () => LoadHighlightingDefinition("SambaDSL.xshd"));

        }
예제 #34
0
파일: Area.cs 프로젝트: v1ku/HA4IoT
        public Area(AreaId id, IComponentService componentService, IAutomationService automationService)
        {
            if (componentService == null)
            {
                throw new ArgumentNullException(nameof(componentService));
            }
            if (automationService == null)
            {
                throw new ArgumentNullException(nameof(automationService));
            }

            _componentService  = componentService;
            _automationService = automationService;

            Id = id;
        }
예제 #35
0
        public CommandButtonsViewModel(PaymentEditor paymentEditor, IApplicationState applicationState, IAutomationService automationService,
            TenderedValueViewModel tenderedValueViewModel, OrderSelectorViewModel orderSelectorViewModel, NumberPadViewModel numberPadViewModel,
            IExpressionService expressionService)
        {
            _paymentEditor = paymentEditor;
            _applicationState = applicationState;
            _automationService = automationService;
            _tenderedValueViewModel = tenderedValueViewModel;

            _orderSelectorViewModel = orderSelectorViewModel;
            _numberPadViewModel = numberPadViewModel;
            _expressionService = expressionService;

            _executeAutomationCommand = new CaptionCommand<AutomationCommandData>("", OnExecuteAutomationCommand, CanExecuteAutomationCommand);
            _serviceSelectedCommand = new CaptionCommand<CalculationSelector>("", OnSelectCalculationSelector, CanSelectCalculationSelector);
        }
예제 #36
0
파일: AreaService.cs 프로젝트: v1ku/HA4IoT
        public AreaService(
            IComponentService componentService,
            IAutomationService automationService,
            ISystemEventsService systemEventsService,
            ISystemInformationService systemInformationService,
            IApiService apiService,
            ISettingsService settingsService)
        {
            if (componentService == null)
            {
                throw new ArgumentNullException(nameof(componentService));
            }
            if (automationService == null)
            {
                throw new ArgumentNullException(nameof(automationService));
            }
            if (systemEventsService == null)
            {
                throw new ArgumentNullException(nameof(systemEventsService));
            }
            if (systemInformationService == null)
            {
                throw new ArgumentNullException(nameof(systemInformationService));
            }
            if (apiService == null)
            {
                throw new ArgumentNullException(nameof(apiService));
            }
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }

            _componentService  = componentService;
            _automationService = automationService;
            _apiService        = apiService;
            _settingsService   = settingsService;

            systemEventsService.StartupCompleted += (s, e) =>
            {
                systemInformationService.Set("Areas/Count", _areas.GetAll().Count);
            };

            apiService.ConfigurationRequested += HandleApiConfigurationRequest;
        }
예제 #37
0
        public PosViewModel(IRegionManager regionManager, IApplicationState applicationState, IApplicationStateSetter applicationStateSetter,
            ITicketService ticketService, IUserService userService, ICacheService cacheService, IAutomationService automationService,
            TicketListViewModel ticketListViewModel, TicketTagListViewModel ticketTagListViewModel, MenuItemSelectorViewModel menuItemSelectorViewModel,
            MenuItemSelectorView menuItemSelectorView, TicketViewModel ticketViewModel, TicketOrdersViewModel ticketOrdersViewModel,
            TicketEntityListViewModel ticketEntityListViewModel, TicketTypeListViewModel ticketTypeListViewModel)
        {
            _ticketService = ticketService;
            _userService = userService;
            _cacheService = cacheService;
            _automationService = automationService;
            _applicationState = applicationState;
            _applicationStateSetter = applicationStateSetter;
            _regionManager = regionManager;
            _menuItemSelectorView = menuItemSelectorView;
            _ticketViewModel = ticketViewModel;
            _ticketOrdersViewModel = ticketOrdersViewModel;
            _menuItemSelectorViewModel = menuItemSelectorViewModel;
            _ticketListViewModel = ticketListViewModel;
            _ticketTagListViewModel = ticketTagListViewModel;
            _ticketEntityListViewModel = ticketEntityListViewModel;
            _ticketTypeListViewModel = ticketTypeListViewModel;

            EventServiceFactory.EventService.GetEvent<GenericEvent<Ticket>>().Subscribe(OnTicketEventReceived);
            EventServiceFactory.EventService.GetEvent<GenericEvent<SelectedOrdersData>>().Subscribe(OnSelectedOrdersChanged);
            EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(OnTicketEvent);
            EventServiceFactory.EventService.GetEvent<GenericEvent<ScreenMenuItemData>>().Subscribe(OnMenuItemSelected);
            EventServiceFactory.EventService.GetEvent<GenericIdEvent>().Subscribe(OnTicketIdPublished);
            EventServiceFactory.EventService.GetEvent<GenericEvent<EntityOperationRequest<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.ScreenMenuId);
                }
            });
        }
예제 #38
0
        public TicketViewModel(IApplicationState applicationState,
                               ITicketService ticketService, IAccountService accountService, IResourceService locationService, IUserService userService,
                               IAutomationService automationService, ICacheService cacheService, TicketOrdersViewModel ticketOrdersViewModel,
                               TicketTotalsViewModel totals, TicketInfoViewModel ticketInfoViewModel, PaymentButtonViewModel paymentButtonViewModel)
        {
            _ticketService         = ticketService;
            _userService           = userService;
            _applicationState      = applicationState;
            _automationService     = automationService;
            _cacheService          = cacheService;
            _ticketOrdersViewModel = ticketOrdersViewModel;
            _totals                 = totals;
            _ticketInfo             = ticketInfoViewModel;
            _paymentButtonViewModel = paymentButtonViewModel;

            SelectResourceCommand     = new DelegateCommand <ResourceType>(OnSelectResource, CanSelectResource);
            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);
            ShowOrderStatesCommand      = new CaptionCommand <OrderStateGroup>(Resources.Tag, OnShowOrderStatesExecute, CanShowOrderStatesExecute);
            ShowOrderTagsCommand        = new CaptionCommand <OrderTagGroup>(Resources.Tag, OnShowOrderTagsExecute, CanShowOrderTagsExecute);
            CancelItemCommand           = new CaptionCommand <string>(Resources.Cancel, OnCancelItemCommand);
            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);

            EventServiceFactory.EventService.GetEvent <GenericEvent <OrderViewModel> >().Subscribe(OnSelectedOrdersChanged);
            EventServiceFactory.EventService.GetEvent <GenericEvent <TicketTagData> >().Subscribe(OnTagSelected);
            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(OnRefreshTicket);
            EventServiceFactory.EventService.GetEvent <GenericEvent <PopupData> >().Subscribe(OnAccountSelectedFromPopup);
            EventServiceFactory.EventService.GetEvent <GenericEvent <OrderTagData> >().Subscribe(OnOrderTagEvent);
            EventServiceFactory.EventService.GetEvent <GenericEvent <OrderStateData> >().Subscribe(OnOrderStateEvent);
            EventServiceFactory.EventService.GetEvent <GenericEvent <MenuItemPortion> >().Subscribe(OnPortionSelected);
            EventServiceFactory.EventService.GetEvent <GenericEvent <Department> >().Subscribe(OnDepartmentChanged);

            SelectedTicket = Ticket.Empty;
        }
예제 #39
0
        public TicketViewModel(IApplicationState applicationState,
            ITicketService ticketService, IAccountService accountService, IResourceService locationService, IUserService userService,
            IAutomationService automationService, ICacheService cacheService, TicketOrdersViewModel ticketOrdersViewModel,
            TicketTotalsViewModel totals, TicketInfoViewModel ticketInfoViewModel, PaymentButtonViewModel paymentButtonViewModel)
        {
            _ticketService = ticketService;
            _userService = userService;
            _applicationState = applicationState;
            _automationService = automationService;
            _cacheService = cacheService;
            _ticketOrdersViewModel = ticketOrdersViewModel;
            _totals = totals;
            _ticketInfo = ticketInfoViewModel;
            _paymentButtonViewModel = paymentButtonViewModel;

            SelectResourceCommand = new DelegateCommand<ResourceType>(OnSelectResource, CanSelectResource);
            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);
            ShowOrderStatesCommand = new CaptionCommand<OrderStateGroup>(Resources.Tag, OnShowOrderStatesExecute, CanShowOrderStatesExecute);
            ShowOrderTagsCommand = new CaptionCommand<OrderTagGroup>(Resources.Tag, OnShowOrderTagsExecute, CanShowOrderTagsExecute);
            CancelItemCommand = new CaptionCommand<string>(Resources.Cancel, OnCancelItemCommand);
            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);

            EventServiceFactory.EventService.GetEvent<GenericEvent<OrderViewModel>>().Subscribe(OnSelectedOrdersChanged);
            EventServiceFactory.EventService.GetEvent<GenericEvent<TicketTagData>>().Subscribe(OnTagSelected);
            EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(OnRefreshTicket);
            EventServiceFactory.EventService.GetEvent<GenericEvent<PopupData>>().Subscribe(OnAccountSelectedFromPopup);
            EventServiceFactory.EventService.GetEvent<GenericEvent<OrderTagData>>().Subscribe(OnOrderTagEvent);
            EventServiceFactory.EventService.GetEvent<GenericEvent<OrderStateData>>().Subscribe(OnOrderStateEvent);
            EventServiceFactory.EventService.GetEvent<GenericEvent<MenuItemPortion>>().Subscribe(OnPortionSelected);
            EventServiceFactory.EventService.GetEvent<GenericEvent<Department>>().Subscribe(OnDepartmentChanged);

            SelectedTicket = Ticket.Empty;
        }
        public PaymentEditorViewModel(ITicketService ticketService, ICacheService cacheService, IAccountService accountService,
            IUserService userService, IAutomationService automationService, TicketTotalsViewModel totals)
        {
            _ticketService = ticketService;
            _cacheService = cacheService;
            _accountService = accountService;
            _userService = userService;
            _automationService = automationService;

            _executeAutomationCommand = new CaptionCommand<AutomationCommandData>("", OnExecuteAutomationCommand, CanExecuteAutomationCommand);
            _makePaymentCommand = new CaptionCommand<PaymentTemplate>("", OnMakePayment, CanMakePayment);
            _serviceSelectedCommand = new CaptionCommand<CalculationSelector>("", OnSelectCalculationSelector, CanSelectCalculationSelector);

            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";

            EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(x =>
            {
                if (SelectedTicket != null && x.Topic == EventTopicNames.CloseTicketRequested)
                {
                    SelectedTicket = null;
                }
            });
        }
        /// <summary>
        /// Default constructor for the test.
        /// </summary>
        public AutomationTests()
        {
            _automationService = new AutomationService(
                new Mock <IAutomationManager>().Object,
                new Mock <IOptions <AutomationOptions> >().Object,
                new Mock <ILogger <AutomationService> >().Object);

            _defaultCustomer = new Customer()
            {
                Name   = "Test1",
                Email  = "*****@*****.**",
                Age    = 18,
                Active = false
            };

            _defaultAutomation          = new Automation();
            _defaultAutomation.IsActive = true;
            _defaultAutomation.Conditions.Add(new Condition <Customer>(_defaultAutomation.AutomationId, (e) => !string.IsNullOrEmpty(e.Name)));
            _defaultAutomation.Conditions.Add(new Condition <Customer>(_defaultAutomation.AutomationId, (e) => !string.IsNullOrEmpty(e.Email)));
            _defaultAutomation.Conditions.Add(new Condition <Customer>(_defaultAutomation.AutomationId, (e) => e.Age >= 18));
        }
예제 #42
0
        public CommandService(
            IChatModel cm,
            IChatConnection conn,
            IChannelManager manager,
            IUnityContainer contain,
            IRegionManager regman,
            IEventAggregator eventagg,
            ICharacterManager characterManager,
            IAutomationService automation)
            : base(contain, regman, eventagg, cm, characterManager)
        {
            connection = conn;
            this.manager = manager;
            this.automation = automation;

            Events.GetEvent<CharacterSelectedLoginEvent>()
                .Subscribe(GetCharacter, ThreadOption.BackgroundThread, true);
            Events.GetEvent<ChatCommandEvent>().Subscribe(EnqueAction, ThreadOption.BackgroundThread, true);
            Events.GetEvent<ConnectionClosedEvent>().Subscribe(WipeState, ThreadOption.PublisherThread, true);

            ChatModel.CurrentAccount = connection.Account;
        }
예제 #43
0
        public NavigationModule(IRegionManager regionManager, NavigationView navigationView, IUserService userService,
            IAutomationService automationService)
            : base(regionManager, AppScreens.Navigation)
        {
            _regionManager = regionManager;
            _navigationView = navigationView;
            _userService = userService;
            _automationService = automationService;

            PermissionRegistry.RegisterPermission(PermissionNames.OpenNavigation, PermissionCategories.Navigation, Resources.CanOpenNavigation);

            EventServiceFactory.EventService.GetEvent<GenericEvent<User>>().Subscribe(
                x =>
                {
                    if (x.Topic == EventTopicNames.UserLoggedIn)
                        ActivateNavigation();
                });

            EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(
                x =>
                {
                    if (x.Topic == EventTopicNames.ActivateNavigation)
                        ActivateNavigation();
                });

            EventServiceFactory.EventService.GetEvent<GenericEvent<AppScreenChangeData>>().Subscribe(
                x =>
                {
                    if (x.Topic == EventTopicNames.Changed)
                    {
                        _automationService.NotifyEvent(RuleEventNames.ApplicationScreenChanged,
                            new
                                {
                                    PreviousScreen = Enum.GetName(typeof(AppScreens), x.Value.PreviousScreen),
                                    CurrentScreen = Enum.GetName(typeof(AppScreens), x.Value.CurrentScreen)
                                });
                    }
                });
        }
예제 #44
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;
                }
            });
        }
예제 #45
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;
                }
            });
        }
예제 #46
0
        public PrimaryViewModel()
        {
            Title = "CoApp Update";
            MessengerInstance.Register<InstallationFailedMessage>(this, HandleInstallFailed);
            MessengerInstance.Register<InstallationFinishedMessage>(this, HandleInstallFinished);
            MessengerInstance.Register<SelectedProductsChangedMessage>(this, HandleChanged);

            Loaded += OnLoaded;
            var loc = new LocalServiceLocator();
            UpdateService = loc.UpdateService;
            PolicyService = loc.PolicyService;
            NavigationService = loc.NavigationService;
            AutomationService = loc.AutomationService;
            UpdateSettingsService = loc.UpdateSettingsService;

            SelectUpdates = new RelayCommand(() => NavigationService.GoTo(ViewModelLocator.SelectUpdatesViewModelStatic));
            Install = new RelayCommand(() => NavigationService.GoTo(ViewModelLocator.InstallingViewModelStatic, false));
            CheckForUpdates = new RelayCommand(() => NavigationService.GoTo(ViewModelLocator.UpdatingViewModelStatic));

            /*
            FeedWarning = new RelayCommand(() => MessengerInstance.Send(new MetroDialogBoxMessage
                                                                            {
                                                                                Title =
                                                                                    "The Following Feeds Could Not Be Reached",
                                                                                Content = Warnings,
                                                                                Buttons =
                                                                                    new ObservableCollection
                                                                                    <ButtonDescription>
                                                                                        {
                                                                                            new ButtonDescription
                                                                                                {
                                                                                                    Title = "Cancel",
                                                                                                    IsCancel = true
                                                                                                }
                                                                                        }
                                                                            }));*/
        }
예제 #47
0
 public ResourceService(IResourceDao resourceDao, IAutomationService automationService, ICacheService cacheService)
 {
     _resourceDao = resourceDao;
     _automationService = automationService;
     _cacheService = cacheService;
 }
예제 #48
0
 public AutomationButtonWidgetViewModel(Widget widget, IAutomationService automationService)
     : base(widget)
 {
     _automationService = automationService;
     ItemClickedCommand = new CaptionCommand <AutomationButtonWidgetViewModel>("", OnItemClicked);
 }
 public AutomationButtonWidgetCreator(IAutomationService automationService)
 {
     _automationService = automationService;
 }
예제 #50
0
 public TriggerService(IApplicationState applicationState, IAutomationService automationService)
 {
     _applicationState  = applicationState;
     _automationService = automationService;
     _cronObjects       = new List <CronObject>();
 }
        public string StartService(Controller controller)
        {
            #region Info
            //var asm = Assembly.LoadFile(@"C:\myDll.dll");
            //var type = asm.GetType("TestRunner");
            //var runnable = Activator.CreateInstance(type) as IRunnable;
            //if (runnable == null) throw new Exception("broke");
            //runnable.Run();

            //var domain = AppDomain.CreateDomain("NewDomainName");
            //var pathToDll = @"C:\myDll.dll";
            //var t = typeof(TypeIWantToLoad);
            //var runnable = domain.CreateInstanceFromAndUnwrap(pathToDll, t.FullName) as IRunnable;
            //if (runnable == null) throw new Exception("broke");
            //runnable.Run();
            #endregion

            if (service != null)
                service.Stop();

            service = null;

            if (!string.IsNullOrEmpty(Script))
            {
                MySensors.Controllers.Scripting.Script script = new MySensors.Controllers.Scripting.Script(Language.CSharp, Script);
                script.AddReference("System.dll");
                script.AddReference("MySensors.Controllers.dll");

                CompilerResults cr = script.Compile();
                if (cr.Errors.HasErrors)
                {
                    string res = "Error compiling script of Automation module \"" + Name + "\"\n";
                    for (int i = 0; i < cr.Errors.Count; i++)
                        res += cr.Errors[i].ToString() + "\n";

                    return res;
                }

                if (script.IsCompiled)
                {
                    var serviceType = script.CompiledAssembly.ExportedTypes.FirstOrDefault();
                    if (serviceType == null || !serviceType.IsClass || !serviceType.IsPublic)
                        return "No service found in Automation module \"" + Name + "\"";

                    service = script.CreateObject(serviceType.FullName) as IAutomationService;
                    if (service == null)
                        return "Error creating service of Automation module \"" + Name + "\"";

                    try
                    {
                        service.Start(controller);
                    }
                    catch (Exception ex)
                    {
                        string res = "Error starting service of Automation module \"" + Name + "\"\n";
                        res += ex.Message + "\n" + ex.StackTrace;
                        return res;
                    }
                }
            }

            return null;
        }
예제 #52
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));
        }
 public RuleActionViewModel(IAutomationService automationService)
 {
     _automationService = automationService;
 }
예제 #54
0
        public MessageService(
            IRegionManager regman,
            IUnityContainer contain,
            IEventAggregator events,
            IChatModel model,
            IChatConnection connection,
            IListConnection api,
            ICharacterManager manager,
            ILoggingService logger,
            IAutomationService automation)
        {
            this.logger = logger;
            this.automation = automation;

            try
            {
                region = regman.ThrowIfNull("regman");
                container = contain.ThrowIfNull("contain");
                this.events = events.ThrowIfNull("events");
                this.model = model.ThrowIfNull("model");
                this.connection = connection.ThrowIfNull("connection");
                this.api = api.ThrowIfNull("api");
                characterManager = manager.ThrowIfNull("characterManager");

                this.model.SelectedChannelChanged += (s, e) => RequestNavigate(this.model.CurrentChannel.Id);

                this.events.GetEvent<ChatOnDisplayEvent>()
                    .Subscribe(BuildHomeChannel, ThreadOption.UIThread, true);
                this.events.GetEvent<RequestChangeTabEvent>()
                    .Subscribe(RequestNavigate, ThreadOption.UIThread, true);
                this.events.GetEvent<UserCommandEvent>().Subscribe(CommandRecieved, ThreadOption.UIThread, true);

                commands = new Dictionary<string, CommandHandler>
                    {
                        {"priv", OnPrivRequested},
                        {Commands.UserMessage, OnPriRequested},
                        {Commands.ChannelMessage, OnMsgRequested},
                        {Commands.ChannelAd, OnLrpRequested},
                        {Commands.UserStatus, OnStatusChangeRequested},
                        {"close", OnCloseRequested},
                        {"join", OnJoinRequested},
                        {Commands.UserIgnore, OnIgnoreRequested},
                        {"clear", OnClearRequested},
                        {"clearall", OnClearAllRequested},
                        {"_logger_open_log", OnOpenLogRequested},
                        {"_logger_open_folder", OnOpenLogFolderRequested},
                        {"code", OnChannelCodeRequested},
                        {"_snap_to_last_update", OnNotificationFocusRequested},
                        {Commands.UserInvite, OnInviteToChannelRequested},
                        {"who", OnWhoInformationRequested},
                        {"getdescription", OnChannelDescripionRequested},
                        {"interesting", OnMarkInterestedRequested},
                        {"notinteresting", OnMarkNotInterestedRequested},
                        {"ignoreUpdates", OnIgnoreUpdatesRequested},
                        {Commands.AdminAlert, OnReportRequested},
                        {"tempignore", OnTemporaryIgnoreRequested},
                        {"tempunignore", OnTemporaryIgnoreRequested},
                        {"tempinteresting", OnTemporaryInterestingRequested},
                        {"tempnotinteresting", OnTemporaryInterestingRequested},
                        {"handlelatest", OnHandleLatestReportRequested},
                        {"handlereport", OnHandleLatestReportByUserRequested}
                    };
            }
            catch (Exception ex)
            {
                ex.Source = "Message Daemon, init";
                Exceptions.HandleException(ex);
            }
        }
 public AutomationController(IAutomationService automationService)
 {
     _automationService = automationService;
 }
예제 #56
0
 public InsertAutomationHandler(IUnitOfWorkFactory unitOfWorkFactory, IAutomationService automationService)
 {
     _unitOfWorkFactory = unitOfWorkFactory;
     _automationService = automationService;
 }
예제 #57
0
 public SessionService(ISessionRepository sessionRepository, IAutomationService automationService)
 {
     _sessionRepository = sessionRepository;
     _automationService = automationService;
 }