コード例 #1
0
ファイル: NavigationModule.cs プロジェクト: hpbaotho/sambapos
        public NavigationModule(IRegionManager regionManager, NavigationView navigationView)
        {
            _regionManager = regionManager;
            _navigationView = navigationView;

            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();
                });
        }
コード例 #2
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)
                                });
                    }
                });
        }