Server/Actions/ActionCecDevicePowerOn.cs
author StephaneLenclud
Thu, 05 Jan 2017 14:54:43 +0100
changeset 275 a4a341accc89
parent 258 e237c2e33545
permissions -rw-r--r--
Published v1.4.2
Fixing issues with Audio Visualizer bitmaps created when form is not visible.
Now reusing Audio Visualizer bitmap for better performance and memory usage.
StephaneLenclud@220
     1
using CecSharp;
StephaneLenclud@220
     2
using SharpLib.Ear;
StephaneLenclud@220
     3
using System;
StephaneLenclud@220
     4
using System.Collections.Generic;
StephaneLenclud@253
     5
using System.Diagnostics;
StephaneLenclud@220
     6
using System.Linq;
StephaneLenclud@220
     7
using System.Runtime.InteropServices;
StephaneLenclud@220
     8
using System.Runtime.Serialization;
StephaneLenclud@220
     9
using System.Text;
StephaneLenclud@220
    10
using System.Threading.Tasks;
StephaneLenclud@220
    11
StephaneLenclud@220
    12
namespace SharpDisplayManager
StephaneLenclud@220
    13
{
StephaneLenclud@220
    14
    [DataContract]
StephaneLenclud@231
    15
    [AttributeObject(Id = "Cec.Device.PowerOn", Name = "CEC Device Power On", Description = "Turns on the specified CEC device on your HDMI bus.")]
StephaneLenclud@220
    16
    public class ActionCecDevicePowerOn : ActionCecDevice
StephaneLenclud@220
    17
    {
StephaneLenclud@220
    18
        /// <summary>
StephaneLenclud@220
    19
        /// 
StephaneLenclud@220
    20
        /// </summary>
StephaneLenclud@220
    21
        /// <returns></returns>
StephaneLenclud@264
    22
        public override string BriefBase()
StephaneLenclud@220
    23
        {
StephaneLenclud@222
    24
            return "CEC Power On " + DeviceName;
StephaneLenclud@220
    25
        }
StephaneLenclud@220
    26
StephaneLenclud@220
    27
        /// <summary>
StephaneLenclud@220
    28
        /// 
StephaneLenclud@220
    29
        /// </summary>
StephaneLenclud@258
    30
        protected override async Task DoExecute()
StephaneLenclud@220
    31
        {
StephaneLenclud@220
    32
            if (Cec.Client.Static == null)
StephaneLenclud@220
    33
            {
StephaneLenclud@253
    34
                Trace.WriteLine("WARNING: No CEC client installed.");
StephaneLenclud@220
    35
                return;
StephaneLenclud@220
    36
            }
StephaneLenclud@220
    37
StephaneLenclud@220
    38
            Cec.Client.Static.Lib.PowerOnDevices(Device);
StephaneLenclud@220
    39
        }
StephaneLenclud@220
    40
    }
StephaneLenclud@220
    41
}