Server/Actions/ActionCecActiveSource.cs
author StephaneLenclud
Tue, 30 Aug 2016 21:14:18 +0200
changeset 261 e2729a990e8b
parent 253 2dae7a163fff
child 264 4a08e1b7ba64
permissions -rw-r--r--
Published v1.2.1.0
Support for Event Trigger through SharpLibDisplay.
     1 using CecSharp;
     2 using SharpLib.Ear;
     3 using System;
     4 using System.Collections.Generic;
     5 using System.Diagnostics;
     6 using System.Linq;
     7 using System.Runtime.Serialization;
     8 using System.Text;
     9 using System.Threading.Tasks;
    10 
    11 namespace SharpDisplayManager
    12 {
    13     [DataContract]
    14     [AttributeObject(Id = "Cec.ActiveSource", Name = "CEC Active Source", Description = "Set this CEC device as active source.")]
    15     class ActionCecActiveSource : ActionCecDeviceType
    16     {
    17         /// <summary>
    18         /// Build a user readable string to describe this action.
    19         /// </summary>
    20         /// <returns></returns>
    21         public override string Brief()
    22         {
    23             return "CEC Active Source to " + DeviceType.ToString();
    24         }
    25 
    26         /// <summary>
    27         /// Set the defined device type as active source.
    28         /// </summary>
    29         protected override async Task DoExecute()
    30         {
    31             if (Cec.Client.Static == null)
    32             {
    33                 Trace.WriteLine("WARNING: No CEC client installed.");
    34                 return;
    35             }
    36 
    37             Cec.Client.Static.Lib.SetActiveSource(DeviceType);
    38         }
    39     }
    40 }