Server/Actions/ActionCecActiveSource.cs
author StephaneLenclud
Thu, 25 Aug 2016 13:12:54 +0200
changeset 254 181323a59047
parent 231 4c706feaf706
child 258 e237c2e33545
permissions -rw-r--r--
Published v1.0.1.0.
Updating Harmony library to v0.5.0
     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 void 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 }