public InputEvent inputEvent; // DeviceID, key, velocity public ListViewItem入力リスト用(InputDeviceType deviceType, InputEvent inputEvent) { this.割り当て可能 = true; this.deviceType = deviceType; this.inputEvent = inputEvent; switch (deviceType) { case InputDeviceType.Keyboard: this.Text = $"Keyboard, {inputEvent.Key}, '{(Keys)inputEvent.Key}'"; break; case InputDeviceType.GameController: this.Text = $"GamePad, 0x{inputEvent.Key:X8}, '{HID.GetUsageName( (uint)inputEvent.Key )}'"; break; case InputDeviceType.MidiIn: if (inputEvent.押された) { if (255 != inputEvent.Key) { this.Text = $"MidiIn[{inputEvent.DeviceID}], " + $"{inputEvent.Extra}, " + $"{Properties.Resources.TXT_ノートオン}, " + $"Note={inputEvent.Key}, " + $"Velocity={inputEvent.Velocity}"; this.割り当て可能 = true; // 割り当て可 this.ForeColor = System.Drawing.Color.Black; // 黒 } else { // フットペダル this.Text = $"MidiIn[{inputEvent.DeviceID}], " + $"{inputEvent.Extra}, " + $"{Properties.Resources.TXT_コントロールチェンジ}, " + $"Control={inputEvent.Control}(0x{inputEvent.Control:X2}), " + $"Value={inputEvent.Velocity}"; this.割り当て可能 = false; // 割り当て不可 this.ForeColor = System.Drawing.Color.Green; // 緑 } } else if (inputEvent.離された) { this.Text = $"MidiIn[{inputEvent.DeviceID}], " + $"{inputEvent.Extra}, " + $"{Properties.Resources.TXT_ノートオフ}, " + $"Note={inputEvent.Key}, " + $"Velocity={inputEvent.Velocity}"; this.割り当て可能 = false; // 割り当て不可 this.ForeColor = System.Drawing.Color.Gray; // 灰 } break; default: throw new ArgumentException("未対応のデバイスです。"); } }
public SystemConfig.IdKey idKey; // DeviceID, key public ListViewItem割り当て済み入力リスト用(InputDeviceType deviceType, SystemConfig.IdKey idKey) { this.割り当て可能 = true; this.deviceType = deviceType; this.idKey = idKey; switch (deviceType) { case InputDeviceType.Keyboard: this.Text = $"Keyboard, {idKey.key}, '{( (Keys) idKey.key ).ToString()}'"; break; case InputDeviceType.GameController: this.Text = $"GamePad, 0x{idKey.key:X8}, '{HID.GetUsageName( (uint) idKey.key )}'"; break; case InputDeviceType.MidiIn: this.Text = $"MidiIn[{idKey.deviceId}], Note:{idKey.key}"; break; default: throw new ArgumentException("未対応のデバイスです。"); } }