Server/Actions/ActionCecActiveSource.cs
author StephaneLenclud
Wed, 05 Oct 2016 15:02:09 +0200
changeset 270 5dcd226539d4
parent 258 e237c2e33545
permissions -rw-r--r--
Published v1.3.4.0
Harmony connection retries.
     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 }