mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-02 06:14:52 +00:00
Bug fixing...
This commit is contained in:
79
Essentials Core/PepperDashEssentialsBase/Global/JobTimer.cs
Normal file
79
Essentials Core/PepperDashEssentialsBase/Global/JobTimer.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static class JobTimer
|
||||
{
|
||||
static CTimer MinuteTimer;
|
||||
|
||||
static List<JobTimerItem> Items = new List<JobTimerItem>();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="act"></param>
|
||||
public static void AddAction(Action act)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="act"></param>
|
||||
public static void AddJobTimerItem(JobTimerItem item)
|
||||
{
|
||||
var existing = Items.FirstOrDefault(i => i.Key == item.Key);
|
||||
if (existing != null)
|
||||
{
|
||||
Items.Remove(existing);
|
||||
}
|
||||
Items.Add(item);
|
||||
}
|
||||
|
||||
static void CheckAndRunTimer()
|
||||
{
|
||||
if (Items.Count > 0 && MinuteTimer == null)
|
||||
{
|
||||
MinuteTimer = new CTimer(o => MinuteTimerCallback(), null, 60000, 60000);
|
||||
}
|
||||
}
|
||||
|
||||
static void MinuteTimerCallback()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class JobTimerItem
|
||||
{
|
||||
public string Key { get; private set; }
|
||||
public Action JobAction { get; private set; }
|
||||
public eJobTimerCycleTypes CycleType { get; private set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public DateTime RunNextAt { get; set; }
|
||||
|
||||
public JobTimerItem(string key, eJobTimerCycleTypes cycle, Action act)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public enum eJobTimerCycleTypes
|
||||
{
|
||||
RunEveryHour,
|
||||
RunEveryHalfHour,
|
||||
RunEveryMinute
|
||||
}
|
||||
}
|
||||
@@ -105,6 +105,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Devices\CodecInterfaces.cs" />
|
||||
<Compile Include="Devices\IHasSharing.cs" />
|
||||
<Compile Include="Global\JobTimer.cs" />
|
||||
<Compile Include="Ramps and Increments\ActionIncrementer.cs" />
|
||||
<Compile Include="Comm and IR\CommFactory.cs" />
|
||||
<Compile Include="Comm and IR\CommunicationExtras.cs" />
|
||||
@@ -163,7 +164,7 @@
|
||||
<Compile Include="Display\MockDisplay.cs" />
|
||||
<Compile Include="Ethernet\EthernetStatistics.cs" />
|
||||
<Compile Include="Fusion\MOVED FusionSystemController.cs" />
|
||||
<Compile Include="Global.cs" />
|
||||
<Compile Include="Global\Global.cs" />
|
||||
<Compile Include="License\EssentialsLicenseManager.cs" />
|
||||
<Compile Include="Feedbacks\BoolOutputLogicals.cs" />
|
||||
<Compile Include="Presets\Interfaces.cs" />
|
||||
|
||||
Reference in New Issue
Block a user