using System; using Cronos; using Google.Apis.Calendar.v3; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using ServiceWorkerCronJobDemo.Services; namespace VestalisQuintet.VQCalendarAttention { public class CalendarAttentionService : CronJobService { private readonly IServiceProvider _serviceProvider; /// <summary> /// Googleカレンダー用の認証情報 /// </summary> private string _credentialsFilePath; public CalendarAttentionService(CronExpression expression, TimeZoneInfo timeZoneInfo, IServiceProvider serviceProvider, string credentialsFilePath) : base(expression, timeZoneInfo) { _serviceProvider = serviceProvider; _credentialsFilePath = credentialsFilePath; } public override async Task DoWork(CancellationToken cancellationToken) { // ここにCronジョブで実行する処理を実装します。 Console.WriteLine("Cron job executed at: " + DateTimeOffset.Now); await Task.CompletedTask; } } }