예제 #1
0
        public SettingsModule(IRegionManager regionManager, WorkPeriodsView workPeriodsView)
        {
            _regionManager = regionManager;
            _workPeriodsView = workPeriodsView;

            NavigateWorkPeriodsCommand = new CategoryCommand<string>(Resources.DayOperations, Resources.Common, "Images/Run.png", OnNavigateWorkPeriods, CanNavigateWorkPeriods);

            ListProgramSettingsCommand = new CategoryCommand<string>(Resources.LocalSettings, Resources.Settings, OnListProgramSettings);
            ListTerminalsCommand = new CategoryCommand<string>(Resources.Terminals, Resources.Settings, OnListTerminals);
            ListPrintersCommand = new CategoryCommand<string>(Resources.Printers, Resources.Settings, OnListPrinters);
            ListPrintJobsCommand = new CategoryCommand<string>(Resources.PrintJobs, Resources.Settings, OnListPrintJobs);
            ListPrinterTemplatesCommand = new CategoryCommand<string>(Resources.PrinterTemplates, Resources.Settings, OnListPrinterTemplates);
            ListNumeratorsCommand = new CategoryCommand<string>(Resources.Numerators, Resources.Settings, OnListNumerators);
            ListVoidReasonsCommand = new CategoryCommand<string>(Resources.VoidReasons, Resources.Products, OnListVoidReasons);
            ListGiftReasonsCommand = new CategoryCommand<string>(Resources.GiftReasons, Resources.Products, OnListGiftReasons);
            ListMenuItemSettingsCommand = new CategoryCommand<string>(Resources.ProgramSettings, Resources.Settings, OnListMenuItemSettings) { Order = 10 };
            ListRuleActionsCommand = new CategoryCommand<string>(Resources.RuleActions, Resources.Settings, OnListRuleActions);
            ListRulesCommand = new CategoryCommand<string>(Resources.Rules, Resources.Settings, OnListRules);
            ListTriggersCommand = new CategoryCommand<string>(Resources.Triggers, Resources.Settings, OnListTriggers);

            ShowBrowser = new CategoryCommand<string>(Resources.SambaPosWebsite, Resources.SambaNetwork, OnShowBrowser) { Order = 99 };

            PermissionRegistry.RegisterPermission(PermissionNames.OpenWorkPeriods, PermissionCategories.Navigation, Resources.CanStartEndOfDay);
            PermissionRegistry.RegisterPermission(PermissionNames.CloseActiveWorkPeriods, PermissionCategories.Navigation, Resources.ForceClosingActiveWorkPeriod);

            EventServiceFactory.EventService.GetEvent<GenericEvent<VisibleViewModelBase>>().Subscribe(s =>
            {
                if (s.Topic == EventTopicNames.ViewClosed)
                {
                    if (s.Value == _settingsViewModel)
                        _settingsViewModel = null;

                    if (s.Value == _terminalListViewModel)
                        _terminalListViewModel = null;

                    if (s.Value == _printerListViewModel)
                        _printerListViewModel = null;

                    if (s.Value == _printerTemplateCollectionViewModel)
                        _printerTemplateCollectionViewModel = null;

                    if (s.Value == _printJobsViewModel)
                        _printJobsViewModel = null;

                    if (s.Value == _numeratorListViewModel)
                        _numeratorListViewModel = null;

                    if (s.Value == _voidReasonListViewModel)
                        _voidReasonListViewModel = null;

                    if (s.Value == _giftReasonListViewModel)
                        _giftReasonListViewModel = null;

                    if (s.Value == _ruleActionListViewModel)
                        _ruleActionListViewModel = null;

                    if (s.Value == _ruleListViewModel)
                        _ruleListViewModel = null;

                    if (s.Value == _triggerListViewModel)
                        _triggerListViewModel = null;
                }
            });
        }
예제 #2
0
 private void OnListRules(string obj)
 {
     if (_ruleListViewModel == null)
         _ruleListViewModel = new RuleListViewModel();
     CommonEventPublisher.PublishViewAddedEvent(_ruleListViewModel);
 }