public XenaService() { _apiEndpoints = new ApiEndpoints() { Xena = ConfigurationManager.AppSettings["XenaApi"] }; _context = HttpContext.Current; }
public ValidateModsViewModel(IComponentContext components) { _viewController = components.Resolve <IViewController>(); _validate = components.Resolve <IValidate>(); _fileSystemBrowser = components.Resolve <IFileSystemBrowser>(); _nxmHandle = components.Resolve <INxmHandle>(); _apiEndpoints = components.Resolve <IApiEndpoints>(); _downloadClient = components.Resolve <IDownloadClient>(); _apiBase = components.Resolve <IApiBase>(); _installBase = components.Resolve <IInstallBase>(); _viewController.ViewIndexChangedEvent += ViewControllerOnViewIndexChangedEvent; _nxmHandle.RecievedPipedDataEvent += QueueDownload; _downloadClient.DownloadUpdate += DownloadUpdate; }
public ValidateModsViewModel(IComponentContext components) { _viewController = components.Resolve <IViewController>(); _validate = components.Resolve <IValidate>(); _fileSystemBrowser = components.Resolve <IFileSystemBrowser>(); _nxmHandle = components.Resolve <INxmHandle>(); _apiEndpoints = components.Resolve <IApiEndpoints>(); _downloadClient = components.Resolve <IDownloadClient>(); _apiBase = components.Resolve <IApiBase>(); _installBase = components.Resolve <IInstallBase>(); _dialogController = components.Resolve <IDialogController>(); _logger = components.Resolve <ILogger>(); _viewController.ViewIndexChangedEvent += ViewControllerOnViewIndexChangedEvent; _nxmHandle.RecievedPipedDataEvent += QueueDownload; _downloadClient.DownloadUpdate += DownloadUpdate; BindingOperations.EnableCollectionSynchronization(MissingMods, _missingModsLocked); }
// Initialise the API Client public void InitialiseApi() { this.client = new HttpClient(new NativeMessageHandler()) { // Set Authorization DefaultRequestHeaders = { Authorization = new AuthenticationHeaderValue("Bearer", Constants.Token) }, BaseAddress = new Uri(Constants.WebApiEndpoint), }; try { // Connect to the API Endpoints this.API = RestService.For <IApiEndpoints>(this.client); } catch (Exception ex) { Debug.WriteLine("Exception creating ApiWrapper: {0}", ex.Message); throw new Exception(ex.Message, ex); } }
public XenaService(IOptions <ApiEndpoints> apiEndpointsOptions, IHttpClientFactory httpClientFactory, IHttpContextAccessor contextAccessor) { _apiEndpoints = apiEndpointsOptions.Value; _httpClientFactory = httpClientFactory; _context = contextAccessor.HttpContext; }