38 lines
973 B
C#
38 lines
973 B
C#
using NetDaemonInterface;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace NetDaemonApps.DeviceLib.UseeLink
|
|
{
|
|
public class SwitchedSocket : SocketBase
|
|
{
|
|
private BackgroundWorker worker;
|
|
|
|
public SwitchedSocket()
|
|
{
|
|
worker = new BackgroundWorker();
|
|
worker.DoWork += Worker_DoWork;
|
|
}
|
|
|
|
private int SwitchOnDelayTime
|
|
{
|
|
get { throw new NotImplementedException(); }
|
|
set { throw new NotImplementedException(); }
|
|
}
|
|
|
|
private void Worker_DoWork(object? sender, DoWorkEventArgs e)
|
|
{
|
|
Thread.Sleep(SwitchOffTime);
|
|
Outputs.ForEach(x => x.TurnOff());
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Steckdose nach Zeit x ms ausschalten.
|
|
/// </summary>
|
|
public int SwitchOffTime { get; set; } = 250;
|
|
}
|
|
} |