private void OnGwStatusChanged(CDeviceObsGw sender, EMidiEvent type) { if (InvokeRequired) { var d = new gwStatusChangedInvoked(OnGwStatusChanged); Invoke(d, new object[] { sender, type }); return; } Console.WriteLine(type); ws_info.Visible = false; if (type == EMidiEvent.Connected || type == EMidiEvent.Connecting || type == EMidiEvent.DeviceReady) { ws_info.Visible = true; LockFormElements(); Program.ChangeTrayIcon(true); if (type == EMidiEvent.Connecting || type == EMidiEvent.DeviceReady) { btn_start.Text = "..."; ws_info.Visible = true; ws_info.Text = type == EMidiEvent.DeviceReady ? "HW Ready ..." : Program.res.GetString("connecting"); } else if (type == EMidiEvent.Connected) { if (sender.Version.OBSStudioVersion != null) { ws_info.Text = "OBS Version: " + sender.Version.OBSStudioVersion.ToString(); ws_info.Text += "\r\nOBS-Websocket Version: " + sender.Version.PluginVersion.ToString(); } btn_start.Text = Program.res.GetString("disconnect"); } } else { if (type == EMidiEvent.WrongPassword) { MessageBox.Show( Program.res.GetString("error_password"), Program.res.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (type == EMidiEvent.Error || type == EMidiEvent.Unknown) { MessageBox.Show( Program.res.GetString("error_connect"), Program.res.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (type == EMidiEvent.DeviceError) { MessageBox.Show( Program.res.GetString("error_wrongdevice"), Program.res.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } btn_start.Text = Program.res.GetString("connect"); UnlockFormElements(); Program.ChangeTrayIcon(false); } }
private void Device_OnStatusChanged(IOBSDevice sender, EMidiEvent eventType) { // if (StatusChanged != null) { StatusChanged(this, eventType); } if (eventType == EMidiEvent.DeviceReady) { Midi.ResetSurface(); connection_start = true; Obs.Connect(_url, _port, _auth); connectionTimer.Enabled = true; } }
private void Device_OnStatusChanged(IOBSDevice sender, EMidiEvent eventType) { if (StatusChanged != null) { StatusChanged(this, eventType); } if (eventType == EMidiEvent.DeviceReady) { MidiObserver.ResetSurface(); connection_start = true; websocket.ConnectAsync(OBSUrl); connectionTimer.Enabled = true; } }
private void Device_OnStatusChanged(IOBSDevice sender, EMidiEvent eventType) { logWindow.Log("Event: " + Enum.GetName(typeof(EMidiEvent), eventType)); if (eventType == EMidiEvent.DeviceDisconnected || eventType == EMidiEvent.DeviceError || eventType == EMidiEvent.Unknown) { comboBox_midi_in.Enabled = true; comboBox_midi_out.Enabled = true; baudrate_combo.Enabled = true; btn_connect.Enabled = true; btn_disconnect.Enabled = true; logWindow.Hide(); } else if (eventType == EMidiEvent.DeviceReady) { btn_disconnect.Enabled = true; logWindow.Show(this); } }