using System; using System.Diagnostics; using ComputeSharp.SwapChain.Core.Services; using Microsoft.Extensions.DependencyInjection; namespace ComputeSharp.SwapChain.Uwp.Services; /// /// Extensions for the type. /// public static class ServiceCollectionExtensions { /// /// Adds the correct registration to the given instance. /// /// The input instance to use to register services. /// The same instance as . public static IServiceCollection AddAnalyticsService(this IServiceCollection services) { if (Guid.TryParse(ServiceTokens.AppService, out _) && !Debugger.IsAttached) { _ = services.AddSingleton(new AppCenterService(ServiceTokens.AppService)); } else { _ = services.AddSingleton(new DebugAnalyticsService()); } return services; } }