Server/Actions/ActionCecSendKeypressTvPowerOff.cs
changeset 214 4961ede27e0a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Server/Actions/ActionCecSendKeypressTvPowerOff.cs	Sun Jul 24 20:36:07 2016 +0200
     1.3 @@ -0,0 +1,27 @@
     1.4 +
     1.5 +using CecSharp;
     1.6 +using SharpLib.Ear;
     1.7 +using System;
     1.8 +using System.Collections.Generic;
     1.9 +using System.Linq;
    1.10 +using System.Runtime.Serialization;
    1.11 +using System.Text;
    1.12 +using System.Threading.Tasks;
    1.13 +
    1.14 +namespace SharpDisplayManager
    1.15 +{
    1.16 +    [DataContract]
    1.17 +    [AttributeAction(Id = "Cec.SendKepressTvPowerOff", Name = "CEC Send Keypress TV Power Off", Description = "Send Power Off keypress to your TV.")]
    1.18 +    class ActionCecSendKeypressTvPowerOff : SharpLib.Ear.Action
    1.19 +    {
    1.20 +        public override void Execute()
    1.21 +        {
    1.22 +            if (Cec.Client.Static == null)
    1.23 +            {
    1.24 +                Console.WriteLine("WARNING: No CEC client installed.");
    1.25 +            }
    1.26 +
    1.27 +            Cec.Client.Static.Lib.SendKeypress(CecLogicalAddress.Tv,CecUserControlCode.PowerOffFunction,true);
    1.28 +        }
    1.29 +    }
    1.30 +}