Removing JSON type converter from ear manager.
Using bindings for some application settings.
3 using System.Collections.Generic;
6 using System.Runtime.Serialization;
8 using System.Threading;
9 using System.Threading.Tasks;
11 namespace SharpDisplayManager
16 [AttributeObject(Id = "Display.Message", Name = "Display Message", Description = "Shows a message on your internal display.")]
17 class ActionDisplayMessage : SharpLib.Ear.Action
20 [AttributeObjectProperty(
21 Id = "Display.Message.Duration",
22 Name = "Duration (ms)",
23 Description = "Specifies the number of milliseconds this message should be displayed.",
24 Minimum = "1", //Otherwise time throws an exception
28 public int DurationInMilliseconds { get; set; } = 5000;
32 [AttributeObjectProperty(
33 Id = "Display.Message.PrimaryText",
34 Name = "Primary Text",
35 Description = "The primary text of this message."
37 public string PrimaryText { get; set; } = "Your message";
40 [AttributeObjectProperty(
41 Id = "Display.Message.SecondaryText",
42 Name = "Secondary Text",
43 Description = "The secondary text of this message."
45 public string SecondaryText { get; set; } = "";
51 /// <returns></returns>
52 public override string Brief()
54 string brief = Name + ": " + PrimaryText;
55 if (!string.IsNullOrEmpty(SecondaryText))
57 brief += " - " + SecondaryText;
60 brief += " ( " + DurationInMilliseconds.ToString() + " ms )";
68 protected override void DoExecute()
74 /// Just launch our idle client.
76 private void StartMessageClient()
78 Thread clientThread = new Thread(SharpDisplayClientMessage.Program.MainWithParams);
79 SharpDisplayClientMessage.StartParams myParams =
80 new SharpDisplayClientMessage.StartParams(PrimaryText, SecondaryText, DurationInMilliseconds);
81 clientThread.Start(myParams);