HidEvent.cs
changeset 40 b3e177062849
parent 31 958ed29f977c
child 41 dd603eba46ca
     1.1 --- a/HidEvent.cs	Mon Dec 22 12:46:22 2014 +0100
     1.2 +++ b/HidEvent.cs	Tue Dec 23 21:17:17 2014 +0100
     1.3 @@ -13,7 +13,7 @@
     1.4      /// <summary>
     1.5      /// Represent a HID event.
     1.6      /// </summary>
     1.7 -    class HidEvent
     1.8 +    public class HidEvent
     1.9      {
    1.10          public bool IsValid { get; private set; }
    1.11          public bool IsForeground { get; private set; }
    1.12 @@ -202,6 +202,30 @@
    1.13          }
    1.14  
    1.15  
    1.16 +        public ListViewItem ListViewItem
    1.17 +        {
    1.18 +            get
    1.19 +                {
    1.20 +                //TODO: What to do with multiple usage
    1.21 +                string usage="";
    1.22 +                UsagePage usagePage=(UsagePage)UsagePage;
    1.23 +                switch (usagePage)
    1.24 +                {
    1.25 +                    case Hid.UsagePage.Consumer:
    1.26 +                        usage= ((Hid.UsageTables.ConsumerControl)Usages[0]).ToString();
    1.27 +                        break;
    1.28 +
    1.29 +                    case Hid.UsagePage.WindowsMediaCenterRemoteControl:
    1.30 +                        usage= ((Hid.UsageTables.WindowsMediaCenterRemoteControl)Usages[0]).ToString();
    1.31 +                        break;
    1.32 +                        
    1.33 +                }
    1.34 +
    1.35 +                ListViewItem item = new ListViewItem(new[] { usage, UsagePage.ToString("X2"), UsageCollection.ToString("X2") });
    1.36 +                return item;
    1.37 +                }
    1.38 +        }
    1.39 +
    1.40  
    1.41  
    1.42      }