public void Connect() { if (Obs != null && Device != null && _url != null && _port != 0) { if (StatusChanged != null) { StatusChanged(this, EOBSCStatus.Connecting); } connection_start = true; Connecting = true; Device.Connect(); } }
public void Start(String url, String pwd = null) { OBSUrl = url; OBSPwd = pwd; if (Device != null) { if (StatusChanged != null) { StatusChanged(this, EMidiEvent.Connecting); } connection_start = true; Device.Connect(); } }
private void btn_connect_Click(object sender, EventArgs e) { if (Device == null) { //Device if (comboBox_midi_in.SelectedIndex > 0) { var selectedDevice = (InputDeviceItem)comboBox_midi_in.SelectedItem; if (selectedDevice.Type == InputDeviceType.MIDI) { Device = new CObsDeviceMidi(); Device.Input = selectedDevice; if (comboBox_midi_out.SelectedIndex > 0) { Device.Output = (InputDeviceItem)comboBox_midi_out.SelectedItem; } } else if (selectedDevice.Type == InputDeviceType.SERIAL) { Device = new CObsDeviceMidi(); Device.BaudRate = int.Parse(baudrate_combo.SelectedText); Device.Input = selectedDevice; } else { } if (Device != null) { Device.OnData += Device_OnData;; Device.OnStatusChanged += Device_OnStatusChanged; comboBox_midi_in.Enabled = false; comboBox_midi_out.Enabled = false; baudrate_combo.Enabled = false; btn_connect.Enabled = false; btn_disconnect.Enabled = false; Device.Connect(); } } } }