Example #1
0
        public Task StartAsync(CancellationToken cancellationToken)
        {
            TimerCallback[] callbacks = new TimerCallback[3];
            callbacks[0] = DoWifiWork;
            callbacks[1] = DoLocationWork;
            callbacks[2] = DoSMSWork;

            for (int i = 0; i < callbacks.Length; ++i)
            {
                backgroundTimers[i] = new BackgroundTimer();
                backgroundTimers[i].SetCallback(callbacks[i]);
            }

            return(Task.CompletedTask);
        }
Example #2
0
 public BackgroundService(IConfiguration configuration, IHttpClientFactory clientFactory, IServiceProvider serviceProvider, BackgroundTimer backgroundTimer)
 {
     this.configuration    = configuration;
     this.clientFactory    = clientFactory;
     this.serviceProvider  = serviceProvider;
     this.backgroundTimers = new BackgroundTimer[3];
 }