Ejemplo n.º 1
0
 public PHmiRunTarget(INotificationReporter reporter, IServiceClientFactory clientFactory,
                      params IServiceRunTarget[] targets)
 {
     Reporter       = reporter;
     _clientFactory = clientFactory;
     _targets       = targets;
 }
Ejemplo n.º 2
0
 public IPHmiRunTarget Create(
     INotificationReporter reporter,
     IServiceClientFactory clientFactory,
     params IServiceRunTarget[] targets)
 {
     return new PHmiRunTarget(reporter, clientFactory, targets);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of this class with the specified <see cref="AuthorizationData"/>.
        /// </summary>
        /// <param name="authorizationData">Represents a user who intends to access the corresponding customer and account.</param>
        /// <param name="environment">Bing Ads API environment</param>
        public ServiceClient(AuthorizationData authorizationData, ApiEnvironment?environment)
        {
            if (authorizationData == null)
            {
                throw new ArgumentNullException("authorizationData");
            }

            _authorizationData = authorizationData;

            _serviceClientFactory = ServiceClientFactoryFactory.CreateServiceClientFactory();

            if (!_serviceClientFactory.SupportedServiceTypes.Contains(typeof(TService)))
            {
                throw new InvalidOperationException(ErrorMessages.ApiServiceTypeMustBeInterface);
            }
            if (environment == null)
            {
                var envSetting = HostingEnvironment.IsHosted ?
                                 WebConfigurationManager.AppSettings[EnvironmentAppSetting] :
                                 ConfigurationManager.AppSettings[EnvironmentAppSetting];

                if (!Enum.TryParse(envSetting, out _environment))
                {
                    _environment = ApiEnvironment.Production;
                }
            }
            else
            {
                _environment = environment.Value;
            }

            _channelFactory = _serviceClientFactory.CreateChannelFactory <TService>(_environment);

            RefreshOAuthTokensAutomatically = true;
        }
Ejemplo n.º 4
0
 public IPHmiRunTarget Create(
     INotificationReporter reporter,
     IServiceClientFactory clientFactory,
     params IServiceRunTarget[] targets)
 {
     return(new PHmiRunTarget(reporter, clientFactory, targets));
 }
Ejemplo n.º 5
0
        public LoginViewModel(IServiceClientFactory serviceClientFactory)
        {
            serviceClientFactory.IsNotNull(nameof(serviceClientFactory));
            _serviceClientFactory = serviceClientFactory;

            CreateCommands();
        }
Ejemplo n.º 6
0
 public InfoController(
     IConfiguration configuration,
     IBulkImportService importService,
     IServiceClientFactory serviceClientFactory)
 {
     this.configuration        = configuration ?? throw new ArgumentNullException(nameof(configuration));
     this.importService        = importService ?? throw new ArgumentNullException(nameof(importService));
     this.serviceClientFactory = serviceClientFactory ?? throw new ArgumentNullException(nameof(serviceClientFactory));
 }
Ejemplo n.º 7
0
        protected EventWebServicesTests(string baseUri)
        {
            if (string.IsNullOrWhiteSpace(baseUri)) throw new ArgumentNullException(nameof(baseUri));
            if (!Uri.IsWellFormedUriString(baseUri, UriKind.RelativeOrAbsolute)) throw new FormatException("baseUri");

            var rndGenerator = new RandomGenerator();
            GuidKeyGenerator = new SequentialGuidKeyGenerator();
            var fpiKeyGenerator = new FpiKeyGenerator(
                new ContentGenerator<ApprovalStatus>(() => Pick<ApprovalStatus>.RandomItemFrom(new[]
                {
                    ApprovalStatus.Informal, 
                    ApprovalStatus.None
                })),
                new ContentGenerator<string>(() => Pick<string>.RandomItemFrom(new[]
                {
                    "RXJG",
                    "GOGL",
                    "MSFT",
                    "YHOO"
                })),

                new ContentGenerator<string>(() => Pick<string>.RandomItemFrom(new[]
                {
                    "DTD",
                    "XSL",
                    "XML",
                    "JSON"
                })), 
                
                new ContentGenerator<string>(() => rndGenerator.Phrase(10)),
                new ContentGenerator<string>(() => Pick<string>.RandomItemFrom(new[]
                {
                    "EN",
                    "FR",
                    "DE",
                    "ES",
                    "IT",
                    "PL",
                    "RO"
                })));

            var valuesFactory = new ValuesFactory(GuidKeyGenerator);
            var parametersFactory = new ParametersFactory(valuesFactory);
            PropertiesFactory = new PropertiesFactory(GuidKeyGenerator, valuesFactory, parametersFactory);
            AlarmFactory = new AlarmFactory(GuidKeyGenerator, PropertiesFactory, valuesFactory);

            EventFactory = new EventFactory(GuidKeyGenerator, AlarmFactory, PropertiesFactory, valuesFactory);
            CalendarFactory = new CalendarFactory(GuidKeyGenerator, fpiKeyGenerator);

            ServiceClientFactory = new ServiceClientFactory();
            ServiceClientFactory.Register(() => new JsonServiceClient(baseUri));
            ServiceClientFactory.Register(() => new JsvServiceClient(baseUri));
            ServiceClientFactory.Register(() => new XmlServiceClient(baseUri));

            TestService = new EventTestService();
        }
Ejemplo n.º 8
0
        public LoginViewModel(IServiceClientFactory serviceClientFactory,
                              ConnectionConfiguration connectionConfiguration)
        {
            serviceClientFactory.IsNotNull(nameof(serviceClientFactory));
            connectionConfiguration.IsNotNull(nameof(connectionConfiguration));
            _serviceClientFactory    = serviceClientFactory;
            _connectionConfiguration = connectionConfiguration;

            CreateCommands();
        }
Ejemplo n.º 9
0
        public ShellViewModel(IEventAggregator eventAggregator, IServiceClientFactory serviceClientFactory, ScreenCoordinator screenCoordinator)
        {
            EventAggregator = eventAggregator;
            ServiceClientFactory = serviceClientFactory as WindowsStoreServiceClientFactory;
            ScreenCoordinator = screenCoordinator;
            Logger = log4net.LogManager.GetLogger(GetType());

            DisplayName = "The Shop";

            EventAggregator.Subscribe(this);
        }
Ejemplo n.º 10
0
        internal PHmiBase(
            INotificationReporterFactory reporterFactory,
            IServiceClientFactory clientFactory,
            ICyclicRunnerFactory cyclicRunnerFactory,
            IPHmiRunTargetFactory pHmiRunTargetFactory,
            ITimeService timeService,
            ITimerService timerService,
            IEventRunTarget beforeUpdateRunTarget,
            IUpdateStatusRunTargetFactory updateStatusRunTargetFactory,
            IUsersRunTarget usersRunTarget,
            ITagServiceFactory tagServiceFactory,
            IAlarmServiceFactory alarmServiceFactory,
            ITrendsServiceFactory trendsServiceFactory,
            ILogService logService,
            IEventRunTarget afterUpdateRunTarget)
        {
            _timeService                  = timeService;
            _timerService                 = timerService;
            _timerService.Elapsed        += TimerServiceElapsed;
            _reporter                     = reporterFactory.Create(timeService);
            _clientFactory                = clientFactory;
            beforeUpdateRunTarget.Runned += BeforeUpdateRunTargetRunned;
            IUpdateStatusRunTarget updateStatusRunTarget = updateStatusRunTargetFactory.Create(_timeService);

            _users               = new Users.Users(usersRunTarget);
            _tagService          = tagServiceFactory.Create(_reporter);
            _alarmService        = alarmServiceFactory.Create(_reporter);
            _trendsService       = trendsServiceFactory.Create(_reporter);
            _logService          = logService;
            _commonAlarmCategory =
                new AlarmCategoryBase(0, "CommonAlarms", () => Res.CommonAlarmsDescription);
            Add(_commonAlarmCategory);
            _cyclicRunnerFactory         = cyclicRunnerFactory;
            afterUpdateRunTarget.Runned += AfterUpdateRunTargetRunned;
            _pHmiRunTarget = pHmiRunTargetFactory.Create(
                _reporter,
                _clientFactory,
                beforeUpdateRunTarget,
                updateStatusRunTarget,
                usersRunTarget,
                _tagService,
                _alarmService,
                _trendsService,
                _logService,
                afterUpdateRunTarget);
            _cyclicRunner = _cyclicRunnerFactory.Create(_pHmiRunTarget);
            IoDevices     = new ReadOnlyCollection <IoDeviceAbstract>(_ioDevices);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of this class with the specified <see cref="AuthorizationData"/>.
        /// </summary>
        /// <param name="authorizationData">Represents a user who intends to access the corresponding customer and account.</param>
        /// <param name="environment">Bing Ads API environment</param>
        public ServiceClient(AuthorizationData authorizationData, ApiEnvironment?environment)
        {
            if (authorizationData == null)
            {
                throw new ArgumentNullException("authorizationData");
            }

            _authorizationData = authorizationData;

            _serviceClientFactory = ServiceClientFactoryFactory.CreateServiceClientFactory();

            if (!_serviceClientFactory.SupportedServiceTypes.Contains(typeof(TService)))
            {
                throw new InvalidOperationException(ErrorMessages.ApiServiceTypeMustBeInterface);
            }

            DetectApiEnvironment(authorizationData, environment);

            _channelFactory = _serviceClientFactory.CreateChannelFactory <TService>(_environment);

            RefreshOAuthTokensAutomatically = true;
        }
Ejemplo n.º 12
0
 public ProgressController(ITarget target, IServiceClientFactory serviceClientFactory)
 {
     ProgressController.TargetWrapper targetWrapper = new ProgressController.TargetWrapper(target);
     this.target = targetWrapper;
     if (target.ExportContext.ExportMetadata.IncludeUnsearchableItems && !Util.IncludeUnsearchableItems(target.ExportContext))
     {
         targetWrapper.ExportContextInternal.ExportMetadataInternal.IncludeUnsearchableItemsInternal = false;
         Tracer.TraceInformation("ProgressController.ProgressController: IncludeUnsearchableItems is disabled. search query={0}.", new object[]
         {
             target.ExportContext.Sources[0].SourceFilter
         });
     }
     this.abortTokenSourceForTasks    = new CancellationTokenSource();
     this.progressAvailable           = new Semaphore(0, int.MaxValue);
     this.progressQueue               = new ConcurrentQueue <ProgressRecord>();
     this.isDocIdHintFlightingEnabled = false;
     this.StatusManager               = new StatusManager(this.target);
     this.ItemListGenerator           = new ItemListGenerator(this.StatusManager.AllSourceInformation, this.target, this);
     this.SearchResults               = new SearchResults(this.StatusManager.AllSourceInformation, this.target);
     this.sourceDataProviderManager   = new SourceDataProviderManager(serviceClientFactory, this.abortTokenSourceForTasks.Token);
     this.sourceDataProviderManager.ProgressController = this;
 }
Ejemplo n.º 13
0
 public ShoppingListService(IServiceClientFactory <IShoppingListsClient> clientFactory)
 {
     _clientFactory = clientFactory;
 }
Ejemplo n.º 14
0
 public CardReadServiceProxy(IServiceClientFactory factory, ICardHandler callbackHandler)
     : base(factory, new InstanceContext(callbackHandler))
 {
 }
Ejemplo n.º 15
0
 public SourceDataProviderManager(IServiceClientFactory serviceClientFactory, CancellationToken abortTokenForTasks)
 {
     this.serviceClientFactory = serviceClientFactory;
     this.abortTokenForTasks   = abortTokenForTasks;
 }
Ejemplo n.º 16
0
 public ControllerIII(IServiceClientFactory serviceClientFactory)
 {
     this.serviceClientFactory = serviceClientFactory;
 }
 public GatewayResource(IServiceClientFactory clientFactory)
 {
     _clientFactory = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory));
 }
Ejemplo n.º 18
0
 public PHmiRunTarget(INotificationReporter reporter, IServiceClientFactory clientFactory, params IServiceRunTarget[] targets)
 {
     _reporter = reporter;
     _clientFactory = clientFactory;
     _targets = targets;
 }
 public DemoOptinProcessService(IServiceClientFactory serviceClientFactory, ICacheService cacheService, ICampaignSettings campaignConfig, IAuthenticationService authenticationService)
     : base(serviceClientFactory, cacheService, campaignConfig, authenticationService)
 {
 }
 public ExtendedRecipientListService(IServiceClientFactory serviceClientFactory, IAuthenticationService authenticationService, ICacheService cacheService, ICampaignSettings campaignConfig)
     : base(serviceClientFactory, authenticationService, cacheService, campaignConfig)
 {
 }
Ejemplo n.º 21
0
 public CategoryService(IServiceClientFactory <ICategoriesClient> clientFactory)
 {
     _clientFactory = clientFactory;
 }
Ejemplo n.º 22
0
 public AllArticlesHandler(IServiceClientFactory clientFactory, IMediator mediator)
 {
     _clientFactory = clientFactory;
     _mediator      = mediator;
 }
Ejemplo n.º 23
0
 public InvoiceServiceProxy(IServiceClientFactory factory)
     : base(factory)
 {
 }
 public ProductApplicationService(IServiceClientFactory serviceClientFactory)
 {
     _serviceClientFactory = serviceClientFactory;
 }
 public PrivacyModel(IServiceClientFactory serviceClientFactory)
 {
     _serviceClientFactory = serviceClientFactory;
 }
Ejemplo n.º 26
0
 public ReportService(IServiceClientFactory <IReportsClient> clientFactory)
 {
     _clientFactory = clientFactory;
 }
Ejemplo n.º 27
0
 public GetBySlugHandler(IServiceClientFactory clientFactory, IMediator mediator)
 {
     _clientFactory = clientFactory;
     _mediator      = mediator;
 }
Ejemplo n.º 28
0
 public ProductServiceProxy(IServiceClientFactory factory)
     : base(factory)
 {
 }
Ejemplo n.º 29
0
 public AllByArticleIdHandler(IServiceClientFactory clientFactory)
 {
     _clientFactory = clientFactory;
 }
Ejemplo n.º 30
0
        internal static IExportHandler CreateExportHandler(IExportContext exportContext, ITracer tracer, IServiceClientFactory serviceClientFactory)
        {
            if (exportContext == null)
            {
                throw new ArgumentNullException("exportContext");
            }
            if (exportContext.Sources == null || exportContext.Sources.Count == 0)
            {
                throw new ArgumentNullException("exportContext.Sources");
            }
            for (int i = 0; i < exportContext.Sources.Count; i++)
            {
                ISource source = exportContext.Sources[i];
                if (source == null)
                {
                    throw new ArgumentNullException(string.Format(CultureInfo.CurrentCulture, "exportContext.Source[{0}]", new object[]
                    {
                        i
                    }));
                }
                if (string.IsNullOrEmpty(source.Name))
                {
                    throw new ArgumentNullException(string.Format(CultureInfo.CurrentCulture, "exportContext.Source[{0}].Name", new object[]
                    {
                        i
                    }));
                }
                if (string.IsNullOrEmpty(source.Id))
                {
                    throw new ArgumentNullException(string.Format(CultureInfo.CurrentCulture, "exportContext.Source[{0}].Id", new object[]
                    {
                        i
                    }));
                }
                if (string.IsNullOrEmpty(source.SourceFilter))
                {
                    throw new ArgumentNullException(string.Format(CultureInfo.CurrentCulture, "exportContext.Source[{0}].SourceFilter", new object[]
                    {
                        i
                    }));
                }
            }
            if (exportContext.ExportMetadata == null)
            {
                throw new ArgumentNullException("exportContext.ExportMetadata");
            }
            if (string.IsNullOrEmpty(exportContext.ExportMetadata.ExportName))
            {
                throw new ArgumentNullException("exportContext.ExportMetadata.ExportName");
            }
            if (exportContext.ExportMetadata.ExportStartTime == default(DateTime))
            {
                throw new ArgumentNullException("exportContext.ExportMetadata.ExportStartTime");
            }
            if (exportContext.TargetLocation == null)
            {
                throw new ArgumentNullException("exportContext.TargetLocation");
            }
            PstTarget pstTarget = new PstTarget(exportContext);

            pstTarget.CheckLocation();
            return(ExportHandlerFactory.CreateExportHandler(tracer, pstTarget, serviceClientFactory));
        }
 public PublishHandler(IServiceClientFactory clientFactory)
 {
     _clientFactory = clientFactory;
 }
Ejemplo n.º 32
0
 public UserGroupService(IServiceClientFactory <IUserGroupClient> clientFactory)
 {
     _clientFactory = clientFactory;
 }
Ejemplo n.º 33
0
 internal static IExportHandler CreateExportHandler(ITracer tracer, ITarget target, IServiceClientFactory serviceClientFactory)
 {
     if (tracer != null)
     {
         Tracer.TracerInstance = tracer;
     }
     return(new ProgressController(target, serviceClientFactory));
 }