mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-13 04:26:49 +00:00
Removes essentials-framework as a submodule and brings the files back into the main repo
This commit is contained in:
parent
2cd68d40dc
commit
48c6bb78bc
362 changed files with 54624 additions and 5 deletions
|
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Shades
|
||||
{
|
||||
/// <summary>
|
||||
/// Class that contains the shades to be controlled in a room
|
||||
/// </summary>
|
||||
public class ShadeController : Device, IShades
|
||||
{
|
||||
ShadeControllerConfigProperties Config;
|
||||
|
||||
public List<ShadeBase> Shades { get; private set; }
|
||||
|
||||
public ShadeController(string key, string name, ShadeControllerConfigProperties config)
|
||||
: base(key, name)
|
||||
{
|
||||
Config = config;
|
||||
|
||||
Shades = new List<ShadeBase>();
|
||||
}
|
||||
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
foreach (var shadeConfig in Config.Shades)
|
||||
{
|
||||
var shade = DeviceManager.GetDeviceForKey(shadeConfig.Key) as ShadeBase;
|
||||
|
||||
if (shade != null)
|
||||
{
|
||||
AddShade(shade);
|
||||
}
|
||||
}
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
void AddShade(ShadeBase shade)
|
||||
{
|
||||
Shades.Add(shade);
|
||||
}
|
||||
}
|
||||
|
||||
public class ShadeControllerConfigProperties
|
||||
{
|
||||
public List<ShadeConfig> Shades { get; set; }
|
||||
|
||||
|
||||
public class ShadeConfig
|
||||
{
|
||||
public string Key { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue