mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 13:15:03 +00:00
feat: Adds LevelControlLists to BasicConfig and LevelControlListItem class
This commit is contained in:
@@ -25,6 +25,9 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
[JsonProperty("destinationLists")]
|
[JsonProperty("destinationLists")]
|
||||||
public Dictionary<string, Dictionary<string, DestinationListItem>> DestinationLists { get; set; }
|
public Dictionary<string, Dictionary<string, DestinationListItem>> DestinationLists { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("levelControlLists")]
|
||||||
|
public Dictionary<string, Dictionary<string, LevelControlListItem>> LevelControlLists { get; set; }
|
||||||
|
|
||||||
[JsonProperty("tieLines")]
|
[JsonProperty("tieLines")]
|
||||||
public List<TieLineConfig> TieLines { get; set; }
|
public List<TieLineConfig> TieLines { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public class LevelControlListItem
|
||||||
|
{
|
||||||
|
[JsonProperty("deviceKey")]
|
||||||
|
public string DeviceKey { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public IBasicVolumeWithFeedback LevelControl
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_levelControl == null)
|
||||||
|
_levelControl = DeviceManager.GetDeviceForKey(DeviceKey) as IBasicVolumeWithFeedback;
|
||||||
|
return _levelControl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IBasicVolumeWithFeedback _levelControl;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name from the device if it implements IKeyName or else returns the Name property
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("preferredName")]
|
||||||
|
public string PreferredName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(Name)) return Name;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (LevelControl is IKeyName namedLevelControl)
|
||||||
|
{
|
||||||
|
if (namedLevelControl == null)
|
||||||
|
return "---";
|
||||||
|
return namedLevelControl.Name;
|
||||||
|
}
|
||||||
|
else return "---";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A name that will override the items's name on the UI
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates if the item should be included in the user accessible list
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("includeInUserList")]
|
||||||
|
public bool IncludeInUserList { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to specify the order of the items in the source list when displayed
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("order")]
|
||||||
|
public int Order { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates if the item is a level, mute , or both
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("type")]
|
||||||
|
public eLevelControlType Type { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum eLevelControlType
|
||||||
|
{
|
||||||
|
Level = 0,
|
||||||
|
Mute = 1,
|
||||||
|
LevelAndMute = 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user