Server/Actions/ActionCecActiveSource.cs
author StephaneLenclud
Wed, 31 Aug 2016 17:28:30 +0200
changeset 264 4a08e1b7ba64
parent 258 e237c2e33545
permissions -rw-r--r--
EAR: Actions now support multiple iterations.
     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 BriefBase()
    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 }