remove timer service

This commit is contained in:
chsakell
2016-10-04 13:24:33 +03:00
parent e6669deb25
commit fb6127d281
7 changed files with 0 additions and 131 deletions

View File

@@ -1,9 +0,0 @@
using System;
namespace LiveGameFeed.Core.MvcTimer
{
public interface ITimerService
{
event EventHandler TimerElapsed;
}
}

View File

@@ -1,14 +0,0 @@
using System;
namespace LiveGameFeed.Core.MvcTimer
{
public class TimerEventArgs : EventArgs
{
public TimerEventArgs(int value)
{
Value = value;
}
public int Value { get; }
}
}

View File

@@ -1,28 +0,0 @@
using System;
using System.Threading;
using Microsoft.Extensions.Options;
namespace LiveGameFeed.Core.MvcTimer
{
public class TimerService : ITimerService
{
private Timer _timer;
readonly Random _random = new Random();
public event EventHandler TimerElapsed;
public TimerService(IOptions<TimerServiceConfiguration> options)
{
var optionsTimerServiceConfiguration = options;
_timer = new Timer(
OnTimerElapsed,
null,
optionsTimerServiceConfiguration.Value.DueTime,
optionsTimerServiceConfiguration.Value.Period);
}
private void OnTimerElapsed(object sender)
{
TimerElapsed?.Invoke(this, new TimerEventArgs(_random.Next(0, 100)));
}
}
}

View File

@@ -1,9 +0,0 @@
namespace LiveGameFeed.Core.MvcTimer
{
public class TimerServiceConfiguration
{
public int DueTime { get; set; }
public int Period { get; set; }
}
}