Beispiel #1
0
        public EntitySwitcherViewModel(IRegionManager regionManager,
                                       IApplicationState applicationState, IApplicationStateSetter applicationStateSetter, ICacheService cacheService,
                                       EntitySelectorView entitySelectorView, EntitySelectorViewModel entitySelectorViewModel,
                                       EntitySearchView entitySearchView, EntitySearchViewModel entitySearchViewModel,
                                       EntityDashboardView entityDashboardView, EntityDashboardViewModel entityDashboardViewModel)
        {
            _regionManager            = regionManager;
            _applicationState         = applicationState;
            _applicationStateSetter   = applicationStateSetter;
            _cacheService             = cacheService;
            _entitySelectorView       = entitySelectorView;
            _entitySelectorViewModel  = entitySelectorViewModel;
            _entitySearchView         = entitySearchView;
            _entitySearchViewModel    = entitySearchViewModel;
            _entityDashboardView      = entityDashboardView;
            _entityDashboardViewModel = entityDashboardViewModel;

            SelectEntityCategoryCommand = new DelegateCommand <EntityScreen>(OnSelectEntityCategoryExecuted);

            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.ResetCache)
                {
                    _entityScreens         = null;
                    _entitySwitcherButtons = null;
                    RaisePropertyChanged(nameof(EntitySwitcherButtons));
                }
            });

            EventServiceFactory.EventService.GetEvent <GenericEvent <OperationRequest <Entity> > >().Subscribe(x =>
            {
                if (x.Topic == EventTopicNames.SelectEntity)
                {
                    var ss = UpdateEntityScreens(x.Value);
                    _currentOperationRequest = x.Value;
                    ActivateEntityScreen(ss);
                    if (ss != null && ss.DisplayMode == 1)
                    {
                        _entitySearchViewModel.SearchString = x.Value.Data;
                    }
                }
            });
        }
        public EntitySwitcherViewModel(IRegionManager regionManager,
            IApplicationState applicationState, IApplicationStateSetter applicationStateSetter, ICacheService cacheService,
            EntitySelectorView entitySelectorView, EntitySelectorViewModel entitySelectorViewModel,
            EntitySearchView entitySearchView, EntitySearchViewModel entitySearchViewModel,
            EntityDashboardView entityDashboardView, EntityDashboardViewModel entityDashboardViewModel)
        {
            _regionManager = regionManager;
            _applicationState = applicationState;
            _applicationStateSetter = applicationStateSetter;
            _cacheService = cacheService;
            _entitySelectorView = entitySelectorView;
            _entitySelectorViewModel = entitySelectorViewModel;
            _entitySearchView = entitySearchView;
            _entitySearchViewModel = entitySearchViewModel;
            _entityDashboardView = entityDashboardView;
            _entityDashboardViewModel = entityDashboardViewModel;

            SelectEntityCategoryCommand = new DelegateCommand<EntityScreen>(OnSelectEntityCategoryExecuted);

            EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(
            x =>
            {
                if (x.Topic == EventTopicNames.ResetCache)
                {
                    _entityScreens = null;
                    _entitySwitcherButtons = null;
                    RaisePropertyChanged(() => EntitySwitcherButtons);
                }
            });

            EventServiceFactory.EventService.GetEvent<GenericEvent<OperationRequest<Entity>>>().Subscribe(x =>
            {
                if (x.Topic == EventTopicNames.SelectEntity)
                {
                    var ss = UpdateEntityScreens(x.Value);
                    _currentOperationRequest = x.Value;
                    ActivateEntityScreen(ss);
                    if (ss.DisplayMode == 1)
                        _entitySearchViewModel.SearchString = x.Value.Data;
                }
            });
        }