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