/// <summary> /// Initializes a new instance of the <see cref="GorgonInputDevice"/> class. /// </summary> /// <param name="owner">The control that owns this device.</param> /// <param name="deviceName">Name of the input device.</param> /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="owner"/> parameter is NULL (or Nothing in VB.NET).</exception> protected internal GorgonInputDevice(GorgonInputFactory owner, string deviceName) : base(deviceName) { if (owner == null) { throw new ArgumentNullException("owner"); } AllowExclusiveMode = true; DeviceFactory = owner; UUID = Guid.Empty.ToString(); }
/// <summary> /// Initializes a new instance of the <see cref="GorgonPointingDevice"/> class. /// </summary> /// <param name="owner">The control that owns this device.</param> /// <param name="deviceName">Name of the input device.</param> /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="owner"/> parameter is NULL (or Nothing in VB.NET).</exception> protected GorgonPointingDevice(GorgonInputFactory owner, string deviceName) : base(owner, deviceName) { _position = PointF.Empty; Button = PointingDeviceButtons.None; _positionConstraint = RectangleF.Empty; _wheelConstraint = Point.Empty; ResetCursor(); ShowCursor(); DoubleClickDelay = SystemInformation.DoubleClickTime; DoubleClickRange = new PointF(SystemInformation.DoubleClickSize.Width, SystemInformation.DoubleClickSize.Height); }
/// <summary> /// Function to return a new input device factory object. /// </summary> /// <param name="plugInType">Type name of the input device factory plug-in.</param> /// <returns>The input device factory object.</returns> /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="plugInType"/> parameter was NULL (Nothing in VB.Net).</exception> /// <exception cref="System.ArgumentException">Thrown when the <paramref name="plugInType"/> parameter is empty.</exception> /// <exception cref="System.InvalidCastException">Thrown when the input plug-in was not found or was not the correct type.</exception> /// <exception cref="GorgonLibrary.GorgonException">Thrown when the input factory could not be created.</exception> public static GorgonInputFactory CreateInputFactory(string plugInType) { if (plugInType == null) { throw new ArgumentNullException("plugInType"); } if (string.IsNullOrWhiteSpace(plugInType)) { throw new ArgumentException(Resources.GORINP_PARAMETER_EMPTY, "plugInType"); } var plugIn = Gorgon.PlugIns.FirstOrDefault( item => string.Equals(item.Name, plugInType, StringComparison.OrdinalIgnoreCase)) as GorgonInputPlugIn; if (plugIn == null) { throw new InvalidCastException(string.Format(Resources.GORINP_PLUGIN_NOT_FOUND, plugInType)); } GorgonInputFactory factory = plugIn.GetFactory(); if (factory == null) { throw new GorgonException(GorgonResult.CannotCreate, string.Format(Resources.GORINP_CANNOT_CREATE, plugInType)); } // Enumerate the devices. factory.EnumerateDevices(); Gorgon.AddTrackedObject(factory); return(factory); }
/// <summary> /// Initializes a new instance of the <see cref="GorgonCustomHID"/> class. /// </summary> /// <param name="owner">The control that owns this device.</param> /// <param name="deviceName">Name of the input device.</param> /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="owner"/> parameter is NULL (or Nothing in VB.NET).</exception> protected GorgonCustomHID(GorgonInputFactory owner, string deviceName) : base(owner, deviceName) { Data = new GorgonCustomHIDPropertyCollection(); }
/// <summary> /// Initializes a new instance of the <see cref="GorgonJoystick"/> class. /// </summary> /// <param name="owner">The control that owns this device.</param> /// <param name="deviceName">Name of the input device.</param> /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="owner"/> parameter is NULL (or Nothing in VB.NET).</exception> protected GorgonJoystick(GorgonInputFactory owner, string deviceName) : base(owner, deviceName) { Direction = new JoystickAxisDirections(); }