Optical drive eject action now functional.
2 using System.Collections.Generic;
5 using System.Threading.Tasks;
6 using System.Runtime.Serialization;
7 using System.Windows.Forms;
8 using Ear = SharpLib.Ear;
9 using Hid = SharpLib.Hid;
11 namespace SharpDisplayManager
14 [Ear.AttributeObject(Id = "Event.Hid.Keyboard", Name = "HID Keyboard", Description = "Corresponding HID message received.")]
15 public class EventHidKeyboard : Ear.Event
17 public EventHidKeyboard()
22 [Ear.AttributeObjectProperty
24 Id = "HID.Keyboard.Key",
26 Description = "The virtual key code."
28 public Keys Key { get; set; }
31 [Ear.AttributeObjectProperty
33 Id = "HID.Keyboard.IsKeyUp",
35 Description = "Key up if set, key down otherwise."
37 public bool IsKeyUp { get; set; } = true;
40 [Ear.AttributeObjectProperty
42 Id = "HID.Keyboard.HasModifierShift",
44 Description = "Shift modifier applied."
46 public bool HasModifierShift { get; set; } = false;
49 [Ear.AttributeObjectProperty
51 Id = "HID.Keyboard.HasModifierControl",
53 Description = "Control modifier applied."
55 public bool HasModifierControl { get; set; } = false;
58 [Ear.AttributeObjectProperty
60 Id = "HID.Keyboard.HasModifierAlt",
62 Description = "Alt modifier applied."
64 public bool HasModifierAlt { get; set; } = false;
67 [Ear.AttributeObjectProperty
69 Id = "HID.Keyboard.HasModifierWindows",
71 Description = "Windows modifier applied."
73 public bool HasModifierWindows { get; set; } = false;
78 /// Make sure we distinguish between various configuration of this event
80 /// <returns></returns>
81 public override string Brief()
83 string brief = Name + ": " + Key.ToString();
99 if (HasModifierControl)
104 if (HasModifierShift)
109 if (HasModifierWindows)
120 /// <param name="obj"></param>
121 /// <returns></returns>
122 public override bool Equals(object obj)
124 if (obj is EventHidKeyboard)
126 EventHidKeyboard e = (EventHidKeyboard)obj;
128 && e.IsKeyUp == IsKeyUp
129 && e.HasModifierAlt == HasModifierAlt
130 && e.HasModifierControl == HasModifierControl
131 && e.HasModifierShift == HasModifierShift
132 && e.HasModifierWindows == HasModifierWindows;