Support for launch action and WMC HID events.
1 using Ear = SharpLib.Ear;
4 using System.Collections.Generic;
7 using System.Threading.Tasks;
8 using System.Runtime.Serialization;
10 namespace SharpDisplayManager
13 [AttributeObject(Id = "Harmony.Command", Name = "Harmony Command", Description = "Send a command to your Logitech Harmony Hub.")]
14 class ActionHarmonyCommand : Ear.Action
17 [AttributeObjectProperty(
18 Id = "Harmony.Command.DeviceId",
20 Description = "The ID of the device this command is associated with."
22 public string DeviceId { get; set; } = "";
26 [AttributeObjectProperty(
27 Id = "Harmony.Command.FunctionName",
28 Name = "Function Name",
29 Description = "The name of the function defining this command."
31 public string FunctionName { get; set; } = "";
36 /// <returns></returns>
37 public override string Brief()
39 string brief="Harmony: ";
41 if (Program.HarmonyConfig != null)
43 //What if the device ID is not there anymore?
44 brief += Program.HarmonyConfig.DeviceNameFromId(DeviceId);
48 //No config found just show the device ID then.
52 brief += " do " + FunctionName;
60 protected override void DoExecute()
62 //Fire and forget our command
63 //TODO: check if the harmony client connection is opened
64 if (Program.HarmonyClient!=null)
66 Program.HarmonyClient.SendCommandAsync(DeviceId, FunctionName);
70 Console.WriteLine("WARNING: No Harmony client connection.");