2024-11-29 15:14:56 +00:00
|
|
|
using Demo.Data.RemoteData.RemoteDataBase;
|
|
|
|
using Demo.Data.Repository;
|
|
|
|
using Demo.Domain.UseCase;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Presence.Desktop.ViewModels;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
2025-04-30 01:13:44 +00:00
|
|
|
using System.Net.Http;
|
2024-11-29 15:14:56 +00:00
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
2025-04-30 01:13:44 +00:00
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using presence_client.ApiClients;
|
|
|
|
using presence_client.ApiClients.Interfaces;
|
|
|
|
using ReactiveUI;
|
2024-11-29 15:14:56 +00:00
|
|
|
|
|
|
|
namespace Presence.Desktop.DI
|
|
|
|
{
|
|
|
|
public static class ServiceColletionExtensions
|
|
|
|
{
|
2025-04-30 01:13:44 +00:00
|
|
|
public static void AddCommonService(this IServiceCollection collection)
|
|
|
|
{
|
2024-11-29 15:14:56 +00:00
|
|
|
collection
|
2025-04-30 01:13:44 +00:00
|
|
|
.AddHttpClient()
|
|
|
|
.AddLogging(logging =>
|
|
|
|
{
|
|
|
|
logging.ClearProviders();
|
|
|
|
logging.AddConsole();
|
|
|
|
})
|
|
|
|
.AddScoped<IGroupApiClient, GroupApiClient>()
|
|
|
|
.AddScoped<IUserApiClient, UserApiClient>()
|
|
|
|
.AddScoped<IPresenceApiClient, PresenceApiClient>()
|
|
|
|
.AddTransient<StartViewModel>()
|
|
|
|
.AddTransient<PresenceViewModel>()
|
|
|
|
.AddTransient<GroupViewModel>();
|
|
|
|
|
|
|
|
collection.AddHttpClient("PresenceApi", client =>
|
|
|
|
{
|
|
|
|
client.BaseAddress = new Uri("http://localhost:5192");
|
|
|
|
client.DefaultRequestHeaders.Accept.Clear();
|
|
|
|
client.DefaultRequestHeaders.Accept.Add(
|
|
|
|
new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
|
|
|
|
});
|
2024-11-29 15:14:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|