private void button3_Click(object sender, EventArgs e) { if (!(_serialPort.IsOpen)) { // _serialPort.RtsEnable=true; // System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace) // _serialPort.BaudRate = Convert.ToInt32(14400); _serialPort.Open(); scpBus.PlugIn(1); timer3.Enabled = true; button3.Text = "Disconnect"; button14.BackColor = Color.ForestGreen; } else { scpBus.Unplug(1); _serialPort.Close(); timer3.Enabled = false; timer1.Enabled = false; timer2.Enabled = false; button3.Text = "Connect"; button14.BackColor = Color.Red; } }
public void unplug() { Running = false; rThread.Join(); iThread.Join(); ScpBus.Unplug(Index); Device.CloseDevice(); }
private static bool onExitHandler() { running = false; scpBus.Unplug(1); udpSocket.Close(); networkThread.Join(); displayThread.Join(); return(false); }
public static void SetGamepad(bool state) { scp.Unplug(gamepadIndex); scp = new ScpBus(); gamepad = new X360Controller(); if (state) { scp.PlugIn(gamepadIndex); } }
private void unplug_Click(object sender, EventArgs e) { bool result = _scpBus.Unplug((int)controllerNum.Value); status.Text = result.ToString(); if (result) { _controller = new X360Controller(); ResetControls(); } }
/// <summary> /// /// </summary> /// <param name="message">PHONE_ID</param> private void UnplugController(string phoneId) { try { scpBus.Unplug(Controllers[phoneId]); Controllers.Remove(phoneId); } catch (Exception e) { #if DEBUG MessageBox.Show(e.Message); #endif } }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { sendThread.Dispose(); bus.Unplug(1); bus.Dispose(); } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }
public static void Stop(bool remove) { Form1.MainForm.ShowPresetControls(); if (remove) { Input.RemoveKeyListener(OnKeyPress); } if (Form1.MainForm.InvokeRequired) { Form1.MainForm.Invoke(new Action(() => Form1.MainForm.ControllerModeButton.Text = "Start")); } else { Form1.MainForm.ControllerModeButton.Text = "Start"; } m_Bus.Unplug(2); m_Stopwatch.Stop(); m_bStopThread = true; m_Active = false; }
public static void OnProcessExit(object sender, EventArgs e) { scpbus.Unplug(CONTROLLER_NUMBER); Application.ExitThread(); }
public static bool DestroyJoystick(int joystickID) { scp.Unplug(joystickID); Controllers[joystickID - 1] = null; return(true); }