Ejemplo n.º 1
0
 public Component(string name, string deviceName)
 {
     DeviceName = deviceName;
     Name       = name;
     pressed    = false;
     Pressed   += new PressedDel(ChangeToPressed);
     Released  += new ReleasedDel(ChangeToReleased);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Used to add delegates for pressed to the given device
 /// </summary>
 /// <param name="pressed">The delegate that will be added to the pressed</param>
 /// <param name="device">The device to add it to</param>
 /// <param name="component">The component to add it to</param>
 public void AddPressed(PressedDel pressed, string device, string component)
 {
     if (devices.ContainsKey(device))
     {
         if (devices.ContainsKey(device))
         {
             Component comp = components[devices[device]].Find(com => com.Name == component);
             comp.Pressed += pressed;
         }
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Used to add delegates for pressed to the given device
        /// </summary>
        /// <param name="pressed">The delegate that will be added to the pressed</param>
        /// <param name="device">The device to add it to</param>
        /// <param name="component">The component to add it to</param>
        public void AddPressed(PressedDel pressed, string device, string component)
        {
            string key = string.Format($"{device},{component}");

            if (pressedDels.ContainsKey(key))
            {
                pressedDels[key] += pressed;
            }
            else
            {
                pressedDels.Add(key, pressed);
            }
        }