private const string LED_CODE = "LED"; // LED equipment code #endregion Fields #region Methods private static void HandleNotifications(IClientService service, Device device, CancellationToken token) { try { var timestamp = DateTime.UtcNow; while (true) { // poll notification from the server var notifications = service.PollNotifications(device.Id.Value, timestamp, token); if (notifications == null) continue; // display information about received notification foreach (var notification in notifications.Where(n => n.Name == "equipment" && n.GetParameter("equipment") == LED_CODE)) { var message = "Device sent LED state change notification, new state: {0}"; Console.WriteLine(string.Format(message, notification.GetParameter("state"))); } // update last received notification timestamp timestamp = notifications.Max(n => n.Timestamp.Value); } } catch (OperationCanceledException) { return; } }
public ServiceFactory(IClientService clientService, ITokenService tokenService, IResourceOwnerService resourceOwnerService, IAuthorizationGrantService authorizationGrantService) { ClientService = clientService; TokenService = tokenService; ResourceOwnerService = resourceOwnerService; AuthorizationGrantService = authorizationGrantService; }
public static AuthorizeRequestValidator CreateAuthorizeValidator( CoreSettings settings = null, IScopeService scopes = null, IClientService clients = null, IUserService users = null, ICustomRequestValidator customValidator = null) { if (settings == null) { settings = new TestSettings(); } if (scopes == null) { scopes = new InMemoryScopeService(TestScopes.Get()); } if (clients == null) { clients = new InMemoryClientService(TestClients.Get()); } if (customValidator == null) { customValidator = new DefaultCustomRequestValidator(); } if (users == null) { users = new TestUserService(); } return new AuthorizeRequestValidator(settings, scopes, clients, users, customValidator); }
/// <summary> /// Creates a suitable exception for an HTTP response, attempting to parse the body as /// JSON but falling back to just using the text as the message. /// </summary> internal static async Task<GoogleApiException> ExceptionForResponseAsync( IClientService service, HttpResponseMessage response) { // If we can't even read the response, let that exception bubble up, just as it would have done // if the error had been occurred when sending the request. string responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); RequestError parsedError = null; string message = responseText; try { var parsedResponse = service.Serializer.Deserialize<StandardResponse<object>>(responseText); if (parsedResponse != null && parsedResponse.Error != null) { parsedError = parsedResponse.Error; message = parsedError.ToString(); } } catch (JsonException) { // Just make do with a null RequestError, and the message set to the body of the response. // The contents of the caught exception aren't particularly useful - we don't need to include it // as a cause, for example. The expectation is that the exception returned by this method (below) // will be thrown by the caller. } return new GoogleApiException(service.Name, message) { Error = parsedError, HttpStatusCode = response.StatusCode }; }
/// <summary> /// Sets the content of the request by the given body and the the required GZip configuration. /// </summary> /// <param name="request">The request.</param> /// <param name="service">The service.</param> /// <param name="body">The body of the future request. If <c>null</c> do nothing.</param> /// <param name="gzipEnabled"> /// Indicates if the content will be wrapped in a GZip stream, or a regular string stream will be used. /// </param> internal static void SetRequestSerailizedContent(this HttpRequestMessage request, IClientService service, object body, bool gzipEnabled) { if (body == null) { return; } HttpContent content = null; var mediaType = "application/" + service.Serializer.Format; var serializedObject = service.SerializeObject(body); if (gzipEnabled) { content = CreateZipContent(serializedObject); content.Headers.ContentType = new MediaTypeHeaderValue(mediaType) { CharSet = Encoding.UTF8.WebName }; } else { content = new StringContent(serializedObject, Encoding.UTF8, mediaType); } request.Content = content; }
public HomeController() { ProductService = new ProductService(); ShoppingListService = new ShoppingListService(); ClientService = new ClientService(); ItemShoppingService = new ItemShoppingService(); }
public LiveCheckController( IClientService clientService, ISiteService siteService) { _clientService = clientService; _siteService = siteService; }
public AccountController(IClientService clientService, IRoleService roleService, IUtilisateurService<Client> utilisateurService, IImageService imageService) { ClientService = clientService; RoleService = roleService; UtilisateurService = utilisateurService; ImageService = imageService; }
public PaymentService(JudoPayApi judoAPI, Judo judo) { _judoAPI = judoAPI; _judo = judo; clientService = DependencyService.Get<IClientService>(); CycleSession(); }
public SiteUpdateCompositionGateway( IClientService clientService, IBus bus ) { _clientService = clientService; _bus = bus; }
public Client(IClientService clientService, IConfiguration configuration, IServerStatusService serverStatusService, ILog log) { State = State.Instanciated; _clientService = clientService; _configuration = configuration; _serverStatusService = serverStatusService; _log = log; }
public TokenValidator(CoreSettings settings, IUserService users, IClientService clients, ITokenHandleStore tokenHandles, ICustomTokenValidator customValidator) { _settings = settings; _users = users; _clients = clients; _tokenHandles = tokenHandles; _customValidator = customValidator; }
public NativeHandler(HttpMessageHandler innerHandler, Credentials credentials, ILog log, string apiVersionHeader, string apiVersionValue, IClientService clientService) : base(innerHandler) { _log = log; _credentials = credentials; _clientService = clientService; _apiVersionHeader = apiVersionHeader; _apiVersionValue = apiVersionValue; }
public DataGenerator() { _ninjectKernel = new StandardKernel(new Modules.MockRepositoryModule()); _ninjectKernel.Bind<IClientService>().To<ClientService>(); _ninjectKernel.Bind<IUserAccountService>().To<UserAccountService>(); _clientService = _ninjectKernel.Get<IClientService>(); _userAccountService = _ninjectKernel.Get<IUserAccountService>(); }
public WorkerClient(IClientService clientService, IConfiguration configuration, IServerStatusService serverStatusService, IWorkflowEngine workflowEngine, ILog log, IWorkerLockManager workerLockManager, IWorkerServiceHost workerServiceHost) : base(clientService, configuration, serverStatusService, log) { _workflowEngine = workflowEngine; _workerLockManager = workerLockManager; _workerServiceHost = workerServiceHost; }
public ActionTriggerClient(IClientService clientService, IConfiguration configuration, IServerStatusService serverStatusService, IActionServiceHost actionServiceHost, IActionRegistry actionRegistry, ILog log) : base(clientService, configuration, serverStatusService, log) { _actionServiceHost = actionServiceHost; _actionRegistry = actionRegistry; Triggers = new List<Trigger>(); }
public void Initialize() { _ninjectKernel = new StandardKernel(new Modules.MockRepositoryModule()); _ninjectKernel.Bind<IClientService>().To<ClientService>(); _service = _ninjectKernel.Get<IClientService>(); //var dataGenerator = new DataGenerator(); //dataGenerator.InitializeContext(); }
public AccountController( IBus bus, IAccountRepository accountRepository, IClientService clientService) { _bus = bus; _accountRepository = accountRepository; _clientService = clientService; }
public ClientsController(ApiServices services, IUnitOfWork unitOfWork, IClientService clientService, IAccountService accountService) : base(services, unitOfWork) { Requires.NotNull(clientService, "clientService"); _clientService = clientService; Requires.NotNull(accountService, "accountService"); _accountService = accountService; }
public CompanyDetailsService( IClientService clientService, IPeninsulaLog log, IBus bus) { _clientService = clientService; _log = log; _bus = bus; }
public static ClientValidator CreateClientValidator( IClientService clients = null) { if (clients == null) { clients = new InMemoryClientService(TestClients.Get()); } return new ClientValidator(clients); }
public LoginViewModel(IEventAggregator _events, IClientService _clientService) { events = _events; clientService = _clientService; initUserData(); if (AutoLogin) { login(); } }
public AuthorizeRequestValidator(CoreSettings core, IScopeService scopes, IClientService clients, IUserService users, ICustomRequestValidator customValidator) { _core = core; _scopes = scopes; _clients = clients; _users = users; _customValidator = customValidator; _validatedRequest = new ValidatedAuthorizeRequest(); _validatedRequest.CoreSettings = _core; }
private static string GetAccessToken(IClientService service) { try { return ((UserCredential)service.HttpClientInitializer).Token.AccessToken; } catch (NullReferenceException) { return null; } }
public ScorecardsDepartmentsNodesPath(StratsysAuthentication authentication, Path path) { m_authentication = authentication; m_path = path; m_descriptionFieldValueService = new GenericService(authentication, path.Descriptionfields); m_nodeKeywordService = new GenericService(authentication, path.Keywords); m_nodeExternalPageService = new GenericService(authentication, path.ExternalPages); m_scorecardsDepartmentsNodesResponsibilityRolesPath = new ScorecardsDepartmentsNodesResponsibilityRolesPath(authentication, path.Resource("responsibilityroles")); }
public EventhandlerClient(IClientService clientService, IConfiguration configuration, IServerStatusService serverStatusService, ILog log, IEventhandlingServiceHost eventhandlingServiceHost, IEventHandlingService eventHandlingService, IEventhandlingLockManager eventhandlingLockManager) : base(clientService, configuration, serverStatusService, log) { _eventhandlingServiceHost = eventhandlingServiceHost; _eventHandlingService = eventHandlingService; _eventhandlingLockManager = eventhandlingLockManager; }
public static string CreateDomain(string sessionId, string ipaddress, DateTime time, IClientService clientService) { string clientId = Guid.NewGuid().ToString(); try { AddClient(sessionId, clientId, ipaddress, time, clientService); return clientId; } catch (Exception ex) { throw new FaultException(ex.Source + ":创建客户端运行环境失败!"); } }
public ArticleViewModel(IClientService clientService) { _clientService = clientService; ArticleDto = new ArticleDto { Id = Guid.Empty, Created = DateTime.Today, Description = "", Text = "", Title = "Новая статья", Comments = new List<CommentDto>() }; SubscribeToGuiMessages(); }
private void btnSauvegarder_Click(object sender, RoutedEventArgs e) { //Si aucun client, on va le chercher dans la base de données par son numéro de téléphone if (ViewModel.Soumission.Client == null) { _clientService = ServiceFactory.Instance.GetService<IClientService>(); RetrieveClientArgs = new RetrieveClientArgs(); RetrieveClientArgs.IdClient = 2; Client = _clientService.Retrieve(RetrieveClientArgs); MessageBox.Show(Client.Nom); } ViewModel.SauvegarderCommand(); }
public ClientController(IClientService clientService, ILocalizationService localizationService, ICountryService countryService, IStateProvinceService stateprovinceService, IBranchOfficeService officeService, IGenericAttributeService attributeService, IUserActivityService userActivityService, IEncryptionService encryptionService, IWorkContext workContext, ICacheManager cacheManager ) { this.clientService = clientService; this.localizationService = localizationService; this.officeService = officeService; this.userActivityService = userActivityService; this.encryptionService = encryptionService; this.cacheManager = cacheManager; this.countryService = countryService; this.stateprovinceService = stateprovinceService; this.workContext = workContext; this.attributeService = attributeService; }
public ClientController(IMapper mapper, IClientService ClientService) { _ClientService = ClientService; _mapper = mapper; }
public ProductController(IErrorService errorService, IClientService clientService, IProductService productService) : base(errorService, clientService) { _productService = productService; }
public LemmaDictionary(IClientService clientService) { _clientService = clientService; }
public ClientController(IErrorService errorService, IClientService clientService) : base(errorService) { this._clientService = clientService; }
public EmployeeController(IAuthTokenService tokenService, IEmployeeService employeeService, IClientService clientService, IAuthService <Employee> auth) : base(tokenService, employeeService, clientService, auth) { _employeeService = employeeService; _clientService = clientService; }
/// <summary>Constructs a new Delete request.</summary> public DeleteRequest(IClientService service, string id) : base(service) { this.Id = id; this.InitParameters(); }
/// <summary>Constructs a new resource.</summary> public PlaylistsResource(IClientService service) { this.service = service; }
public TestResumableUpload(IClientService service, string path, string method, Stream stream, string contentType, int chunkSize) : base(service, path, method, stream, contentType) { this.chunkSize = chunkSize; }
public TestResumableUploadWithParameters(IClientService service, string path, string method, Stream stream, string contentType, int chunkSize) : base(service, path, method, stream, contentType, chunkSize) { }
public static string CreateClient(string sessionId, string ipaddress, DateTime time, IClientService clientService) { string clientId = Guid.NewGuid().ToString(); try { AddClient(sessionId, clientId, ipaddress, time, clientService); hostwcfclientinfoList(wcfClientDic.Values.ToList()); return(clientId); } catch (Exception ex) { throw new FaultException(ex.Source + ":创建客户端运行环境失败!"); } }
private static void AddClient(string sessionId, string clientId, string ipaddress, DateTime time, IClientService clientService) { WCFClientInfo info = new WCFClientInfo(); info.clientId = clientId; info.ipAddress = ipaddress; info.startTime = time; info.clientServiceCallBack = clientService; info.IsConnect = true; lock (wcfClientDic) { wcfClientDic.Add(clientId, info); } ShowHostMsg(Color.Blue, DateTime.Now, "客户端[" + ipaddress + "]已连接WCF服务主机"); }
public ClientHub(IClientService clientService, ILogger logger) { fClientService = clientService; fLogger = logger; }
public ClientsController(IClientService clientService, IApiErrorResources errorResources) { _clientService = clientService; _errorResources = errorResources; }
public CustomerController(IAuthTokenService tokenService, ICustomerService customerService, IClientService clientService, IAuthService <Customer> auth) : base(tokenService, customerService, clientService, auth) { _customerService = customerService; _clientService = clientService; }
/// <summary> /// Constructor /// </summary> /// <param name="clientService"></param> /// <param name="softwareProfileService"></param> public SubscriptionWebService(IClientService clientService, ISoftwareProfileService softwareProfileService) { this.clientService = clientService; this.softwareProfileService = softwareProfileService; }
public ClientsController(IClientService clientService, IMapper mapper) { _clientService = clientService; _mapper = mapper; }
public FormMainAdministrator(IMainService service, IResourceService serviceR, IClientService serviceC) { InitializeComponent(); this.service = service; this.serviceR = serviceR; this.serviceC = serviceC; }
public ClientController(IClientService clientService, IApiScopeService apiScopeService, IIdentityResourceService identityResourceService) { ClientService = clientService ?? throw new System.ArgumentNullException(nameof(clientService)); ApiScopeService = apiScopeService ?? throw new System.ArgumentNullException(nameof(apiScopeService)); IdentityResourceService = identityResourceService ?? throw new ArgumentNullException(nameof(identityResourceService)); }
/// <summary>Constructs a new List request.</summary> public ListRequest(IClientService service, string part) : base(service) { this.Part = part; this.InitParameters(); }
public BeforeLaunchStartingEventArgs(IClientService clientService, IConfiguration configuration, StartLaunchRequest startLaunchRequest) : base(clientService, configuration) { StartLaunchRequest = startLaunchRequest; }
protected abstract void ServerSetup(IClientService client);
/// <summary>Constructs a new resource.</summary> public VideoAbuseReportReasonsResource(IClientService service) { this.service = service; }
public LoginWindow() { InitializeComponent(); _mapper = AutoMapperProvider.GetIMapper(); _clientService = ApplicationProvider.GetProxy(); }
public ScBalanceResource(IClientService service) : base(service) { }
public ClientAllowedGrantTypeController(IClientService clientService) { this._clientService = clientService; }
public ClientController(IClientService service) { _service = service; }
/// <summary>Constructs a new downloader with the given client service.</summary> public MediaDownloader(IClientService service) { this.service = service; }
public GetAllClientsCommand(ILogger logger, ITradeTable tradeTable, IClientService clientService) { this.logger = logger; this.tradeTable = tradeTable; this.clientService = clientService; }
public ClientController(IClientService clientService) { this.ClientService = clientService; }
protected AccountController(IAuthTokenService tokenService, IUserService <TAuthUser> accountService, IClientService clientService, IAuthService <TAuthUser> auth) : base(tokenService, accountService, clientService, auth) { _userService = accountService; _clientService = clientService; }