using Newtonsoft.Json; using PepperDash.Core; namespace PepperDash.Essentials.Core { /// /// Represents a CameraListItem /// public class CameraListItem { /// /// Key of the camera device /// [JsonProperty("deviceKey")] public string DeviceKey { get; set; } /// /// Returns the source Device for this, if it exists in DeviceManager /// [JsonIgnore] public Device CameraDevice { get { if (_cameraDevice == null) _cameraDevice = DeviceManager.GetDeviceForKey(DeviceKey) as Device; return _cameraDevice; } } Device _cameraDevice; /// /// Gets either the source's Name or this AlternateName property, if /// defined. If source doesn't exist, returns "Missing source" /// [JsonProperty("preferredName")] public string PreferredName { get { if (string.IsNullOrEmpty(Name)) { if (CameraDevice == null) return "---"; return CameraDevice.Name; } return Name; } } /// /// A name that will override the source's name on the UI /// [JsonProperty("name")] public string Name { get; set; } /// /// Specifies and icon for the source list item /// [JsonProperty("icon")] public string Icon { get; set; } /// /// Alternate icon /// [JsonProperty("altIcon", NullValueHandling = NullValueHandling.Ignore)] public string AltIcon { get; set; } /// /// Indicates if the item should be included in the user facing list /// [JsonProperty("includeInUserList")] public bool IncludeInUserList { get; set; } /// /// Used to specify the order of the items in the source list when displayed /// [JsonProperty("order")] public int Order { get; set; } } }