Sets the active wheel device for this Actions class. The name of the wheel device to set as active. A self-reference to this Actions class. If a device with this name exists but is not a wheel.
(string name)
| 112 | /// <returns>A self-reference to this Actions class.</returns> |
| 113 | /// <exception cref="InvalidOperationException">If a device with this name exists but is not a wheel.</exception> |
| 114 | [MemberNotNull(nameof(activeWheel))] |
| 115 | public Actions SetActiveWheel(string name) |
| 116 | { |
| 117 | InputDevice? device = FindDeviceById(name); |
| 118 | |
| 119 | this.activeWheel = device switch |
| 120 | { |
| 121 | null => new WheelInputDevice(name), |
| 122 | WheelInputDevice wheelDevice => wheelDevice, |
| 123 | _ => throw new InvalidOperationException($"Device under the name \"{name}\" is not a wheel. Actual input type: {device.DeviceKind}"), |
| 124 | }; |
| 125 | |
| 126 | return this; |
| 127 | } |
| 128 | |
| 129 | private InputDevice? FindDeviceById(string? name) |
| 130 | { |
no outgoing calls