/// <summary> /// Destroys Input Object /// </summary> /// <param name="inputObject"></param> public virtual void DestroyInputObject(InputObject inputObject) { if (inputObject != null) { if (this._createdInputObjects.ContainsKey(inputObject)) { (this._createdInputObjects[inputObject]).DestroyInputObject(inputObject); this._createdInputObjects.Remove(inputObject); } } }
/// <summary> /// Returns the type of input requested or raises Exception /// </summary> /// <param name="type"></param> /// <param name="buffermode"></param> /// <returns></returns> /// <exception cref="Exception"></exception> public T CreateInputObject <T>(bool bufferMode, string vendor) where T : InputObject { InputObject obj = null; foreach (InputObjectFactory factory in this._factories) { if (factory.FreeDeviceCount <T>() > 0) { if (vendor == null || vendor == String.Empty || factory.VendorExists <T>(vendor)) { obj = factory.CreateInputObject <T>(this, bufferMode, vendor); if (obj != null) { this._createdInputObjects.Add(obj, factory); break; } } } } if (obj == null) { throw new Exception("No devices match requested type."); } try { obj.Initialize(); } catch (Exception e) { obj.Dispose(); obj = null; throw e; //rethrow } return((T)obj); }
public InputObjectEventArgs(InputObject obj) { this.Device = obj; }
public JoystickEventArgs(InputObject obj, JoystickState state) : base(obj) { this._state = state; }
public KeyEventArgs(InputObject obj, KeyCode key, int text) : base(obj) { this.Key = key; this.Text = text; }
void InputObjectFactory.DestroyInputObject(InputObject obj) { obj.Dispose(); }