Fixing EAR event edition.
EAR HID event now displays 'Press a key' if not valid.
1 using Ear = SharpLib.Ear;
4 using System.Collections.Generic;
7 using System.Runtime.Serialization;
9 using System.Threading;
10 using System.Threading.Tasks;
12 namespace SharpDisplayManager
17 [AttributeObject(Id = "Display.Message", Name = "Display Message", Description = "Shows a message on your internal display.")]
18 class ActionDisplayMessage : Ear.Action
21 [AttributeObjectProperty(
22 Id = "Display.Message.Duration",
23 Name = "Duration (ms)",
24 Description = "Specifies the number of milliseconds this message should be displayed.",
25 Minimum = "1", //Otherwise time throws an exception
29 public int DurationInMilliseconds { get; set; } = 5000;
33 [AttributeObjectProperty(
34 Id = "Display.Message.PrimaryText",
35 Name = "Primary Text",
36 Description = "The primary text of this message."
38 public string PrimaryText { get; set; } = "Your message";
41 [AttributeObjectProperty(
42 Id = "Display.Message.SecondaryText",
43 Name = "Secondary Text",
44 Description = "The secondary text of this message."
46 public string SecondaryText { get; set; } = "";
52 /// <returns></returns>
53 public override string Brief()
55 string brief = Name + ": " + PrimaryText;
56 if (!string.IsNullOrEmpty(SecondaryText))
58 brief += " - " + SecondaryText;
61 brief += " ( " + DurationInMilliseconds.ToString() + " ms )";
69 protected override void DoExecute()
75 /// Just launch our idle client.
77 private void StartMessageClient()
79 Thread clientThread = new Thread(SharpDisplayClientMessage.Program.MainWithParams);
80 SharpDisplayClientMessage.StartParams myParams =
81 new SharpDisplayClientMessage.StartParams(PrimaryText, SecondaryText, DurationInMilliseconds);
82 clientThread.Start(myParams);