mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-08 01:04:56 +00:00
Combining repos
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static class IAttachVideoStatusExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the VideoStatusOutputs for the device
|
||||
/// </summary>
|
||||
/// <param name="attachDev"></param>
|
||||
/// <returns>Attached VideoStatusOutputs or the default if none attached</returns>
|
||||
public static VideoStatusOutputs GetVideoStatuses(this IAttachVideoStatus attachedDev)
|
||||
{
|
||||
// See if this device is connected to a status-providing port
|
||||
var tl = TieLineCollection.Default.FirstOrDefault(t =>
|
||||
t.SourcePort.ParentDevice == attachedDev
|
||||
&& t.DestinationPort is RoutingInputPortWithVideoStatuses);
|
||||
if (tl != null)
|
||||
{
|
||||
// if so, and it's got status, return it -- or null
|
||||
var port = tl.DestinationPort as RoutingInputPortWithVideoStatuses;
|
||||
if (port != null)
|
||||
return port.VideoStatus;
|
||||
}
|
||||
return VideoStatusOutputs.NoStatus;
|
||||
}
|
||||
|
||||
public static bool HasVideoStatuses(this IAttachVideoStatus attachedDev)
|
||||
{
|
||||
return TieLineCollection.Default.FirstOrDefault(t =>
|
||||
t.SourcePort.ParentDevice == attachedDev
|
||||
&& t.DestinationPort is RoutingInputPortWithVideoStatuses) != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user