/// <summary>
        /// Event handler for when the environment has changed.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">An object that contains the name of the new configuration.</param>
        public void EnvironmentChangedEventHandler(object sender, PubSubEventArgs <string> args)
        {
            this.logger.Debug("Handling environment changed received event.");
            this.query = new RestQuery(ProxyConfigHelper.GetConfig(args.Item), this.logger);

            this.SearchCommand.Execute(this.Model);
        }
コード例 #2
0
 private void EnvironmentChangedEventHandler(object sender, PubSubEventArgs <string> e)
 {
     this.logger.Debug("Handling environment changed received event.");
     this.restQuery = new RestQuery(ProxyConfigHelper.GetConfig(e.Item), this.logger);
     this.Model.ResultCollection       = new ObservableCollection <OrganizationModel>();
     this.Model.EmptyMessageVisibility = false;
     this.Model.SelectAllChecked       = false;
 }
        /// <summary>
        /// Initializes a new instance of the SearchOrganizationInformationViewModel class.
        /// </summary>
        /// <param name="logger">The logger to be used by the instance.</param>
        /// <param name="mapper">The AutoMapper instance to use by the view model.</param>
        /// <param name="query">The query proxy to use in the actual searches.</param>
        public SearchOrganizationInformationViewModel(ILog logger, IMapper mapper, IRestQuery query)
        {
            this.logger = logger;
            this.mapper = mapper;
            this.query  = query;

            this.Model         = new SearchOrganizationInformationModel();
            this.SearchCommand = new RelayCommand <SearchOrganizationInformationModel>(this.SearchCommandHandler);

            PubSub <ObservableCollection <OrganizationModel> > .AddEvent(EventNames.SearchResultReceivedEvent, this.SearchResultReceivedEventHandler);

            PubSub <bool> .AddEvent(EventNames.SearchStartedEvent, this.SearchStartedEventHandler);

            PubSub <string> .RegisterEvent(EventNames.EnvironmentChangedEvent, this.EnvironmentChangedEventHandler);
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the SearchResultViewModel class.
        /// </summary>
        /// <param name="logger">The logger to be used by the instance.</param>
        /// <param name="mapper">The AutoMapper instance to use by the view model.</param>
        /// <param name="restQuery">The query proxy to use in the actual context.</param>
        public SearchResultViewModel(ILog logger, IMapper mapper, IRestQuery restQuery)
        {
            this.logger    = logger;
            this.mapper    = mapper;
            this.restQuery = restQuery;

            this.Model = new SearchResultModel {
                ResultCollection = new ObservableCollection <OrganizationModel>()
            };

            PubSub <ObservableCollection <OrganizationModel> > .RegisterEvent(EventNames.SearchResultReceivedEvent, this.SearchResultReceivedEventHandler);

            PubSub <bool> .RegisterEvent(EventNames.SearchStartedEvent, this.SearchStartedEventHandler);

            PubSub <string> .RegisterEvent(EventNames.EnvironmentChangedEvent, this.EnvironmentChangedEventHandler);

            PubSub <OrganizationModel> .RegisterEvent(EventNames.OrganizationSelectedChangedEvent, this.OrganizationSelectedChangedEventHandler);

            PubSub <SearchResultModel> .RegisterEvent(EventNames.OrganizationSelectedAllChangedEvent, this.OrganizationSelectedAllChangedEventHandler);

            this.GetContactsCommand = new RelayCommand <OrganizationModel>(this.GetContactsCommandHandler);
            this.CopyToClipboardPlainTextCommand   = new RelayCommand(this.CopyToClipboardPlainTextHandler);
            this.CopyToClipboardExcelFormatCommand = new RelayCommand(this.CopyToClipboardExcelFormatHandler);
        }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the RolesSearchResultViewModel class.
        /// </summary>
        /// <param name="logger">The logger to be used by the instance.</param>
        /// <param name="mapper">The AutoMapper instance to use by the view model.</param>
        /// <param name="restQuery">The query proxy to use in the actual context.</param>
        public RolesSearchResultViewModel(ILog logger, IMapper mapper, IRestQuery restQuery)
        {
            this.logger    = logger;
            this.mapper    = mapper;
            this.restQuery = restQuery;

            this.Model = new RolesSearchResultModel {
                ResultCollection = new ObservableCollection <RoleModel>()
            };
            this.Model.RolesSelectAllChecked = false;

            PubSub <ObservableCollection <RoleModel> > .RegisterEvent(EventNames.RoleSearchResultReceivedEvent, this.RoleSearchResultReceivedEventHandler);

            PubSub <bool> .RegisterEvent(EventNames.RoleSearchStartedEvent, this.RoleSearchStartedEventHandler);

            PubSub <string> .RegisterEvent(EventNames.EnvironmentChangedEvent, this.EnvironmentChangedEventHandler);

            PubSub <RoleModel> .RegisterEvent(EventNames.RoleSelectedChangedEvent, this.RoleSelectedChangedEventHandler);

            PubSub <RolesSearchResultModel> .RegisterEvent(EventNames.RoleSelectedAllChangedEvent, this.RoleSelectedAllChangedEventHandler);

            this.CopyToClipboardPlainTextCommand   = new RelayCommand(this.CopyRolesToClipboardPlainTextHandler);
            this.CopyToClipboardExcelFormatCommand = new RelayCommand(this.CopyRolesToClipboardExcelFormatHandler);
        }