Server/Actions/ActionCecSendKeypressTvPowerOff.cs
author StephaneLenclud
Tue, 26 Jul 2016 11:51:50 +0200
changeset 219 99c407831232
permissions -rw-r--r--
Basis for action property edition support.
     1 
     2 using CecSharp;
     3 using SharpLib.Ear;
     4 using System;
     5 using System.Collections.Generic;
     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     [AttributeAction(Id = "Cec.SendKepressTvPowerOff", Name = "CEC Send Keypress TV Power Off", Description = "Send Power Off keypress to your TV.")]
    15     class ActionCecSendKeypressTvPowerOff : SharpLib.Ear.Action
    16     {
    17         public override void Execute()
    18         {
    19             if (Cec.Client.Static == null)
    20             {
    21                 Console.WriteLine("WARNING: No CEC client installed.");
    22             }
    23 
    24             Cec.Client.Static.Lib.SendKeypress(CecLogicalAddress.Tv,CecUserControlCode.PowerOffFunction,true);
    25         }
    26     }
    27 }