Removed ITimerProvider

pull/2/head
Mark McDowall 14 years ago
parent 8380c25eaf
commit 030c6fb7b7

@ -78,7 +78,7 @@ namespace NzbDrone.Core
_kernel.Bind<INotificationProvider>().To<NotificationProvider>().InSingletonScope();
_kernel.Bind<ILogProvider>().To<LogProvider>().InSingletonScope();
_kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>().InSingletonScope();
_kernel.Bind<ITimerProvider>().To<TimerProvider>().InSingletonScope();
_kernel.Bind<TimerProvider>().To<TimerProvider>().InSingletonScope();
_kernel.Bind<IRepository>().ToMethod(c => new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations)).InSingletonScope();
_kernel.Bind<IRepository>().ToConstant(logRepository).WhenInjectedInto<SubsonicTarget>().InSingletonScope();
@ -90,7 +90,7 @@ namespace NzbDrone.Core
//Get the Timers going
var config = _kernel.Get<IConfigProvider>();
var timer = _kernel.Get<ITimerProvider>();
var timer = _kernel.Get<TimerProvider>();
timer.SetRssSyncTimer(Convert.ToInt32(config.GetValue("SyncFrequency", "15", true)));
timer.StartRssSyncTimer();
}

@ -190,7 +190,6 @@
<Compile Include="Providers\IPostProcessingProvider.cs" />
<Compile Include="Providers\IRenameProvider.cs" />
<Compile Include="Providers\IRssSyncProvider.cs" />
<Compile Include="Providers\ITimerProvider.cs" />
<Compile Include="Providers\PostProcessingProvider.cs" />
<Compile Include="Providers\QualityProvider.cs" />
<Compile Include="Providers\RenameProvider.cs" />

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Providers
{
public interface ITimerProvider
{
void ResetRssSyncTimer();
void StartRssSyncTimer();
void StopRssSyncTimer();
void SetRssSyncTimer(int minutes);
TimeSpan RssSyncTimeLeft();
DateTime NextRssSyncTime();
void StartMinuteTimer();
void StopMinuteTimer();
}
}

@ -8,7 +8,7 @@ using NzbDrone.Core.Model.Notification;
namespace NzbDrone.Core.Providers
{
public class TimerProvider : ITimerProvider
public class TimerProvider
{
private readonly IRssSyncProvider _rssSyncProvider;
private readonly ISeriesProvider _seriesProvider;
@ -33,15 +33,15 @@ namespace NzbDrone.Core.Providers
_minuteTimer = new Timer(60000);
}
#region ITimerProvider Members
#region TimerProvider Members
public void ResetRssSyncTimer()
public virtual void ResetRssSyncTimer()
{
double interval = _rssSyncTimer.Interval;
_rssSyncTimer.Interval = interval;
}
public void StartRssSyncTimer()
public virtual void StartRssSyncTimer()
{
if (_rssSyncTimer.Interval < 900000) //If Timer is less than 15 minutes, throw an error! This should also be handled when saving the config, though a user could by-pass it by editing the DB directly... TNO (Trust No One)
{
@ -53,35 +53,35 @@ namespace NzbDrone.Core.Providers
_rssSyncTimer.Start();
_rssSyncNextInterval = DateTime.Now.AddMilliseconds(_rssSyncTimer.Interval);
}
public void StopRssSyncTimer()
public virtual void StopRssSyncTimer()
{
_rssSyncTimer.Stop();
}
public void SetRssSyncTimer(int minutes)
public virtual void SetRssSyncTimer(int minutes)
{
long ms = minutes * 60 * 1000;
_rssSyncTimer.Interval = ms;
}
public TimeSpan RssSyncTimeLeft()
public virtual TimeSpan RssSyncTimeLeft()
{
return _rssSyncNextInterval.Subtract(DateTime.Now);
}
public DateTime NextRssSyncTime()
public virtual DateTime NextRssSyncTime()
{
return _rssSyncNextInterval;
}
public void StartMinuteTimer()
public virtual void StartMinuteTimer()
{
_minuteTimer.Elapsed += new ElapsedEventHandler(MinuteTimer_Elapsed);
_minuteTimer.Start();
}
public void StopMinuteTimer()
public virtual void StopMinuteTimer()
{
_minuteTimer.Stop();
}

@ -9,9 +9,9 @@ namespace NzbDrone.Web.Controllers
{
public class SharedController : Controller
{
private ITimerProvider _timerProvider;
private TimerProvider _timerProvider;
public SharedController(ITimerProvider timerProvider)
public SharedController(TimerProvider timerProvider)
{
_timerProvider = timerProvider;
}

Loading…
Cancel
Save