public MotorController(string portName) { Device = new DS102(); try { Device.Port = Int32.Parse(portName); if (!Device.OpenDS102()) { MessageBox.Show($"Failed to open DS102, please make sure the COM{Device.Port} is available"); Device = null; } } catch (Exception) { Device = null; } }
public void Close() { Device?.CloseDS102(); Device = null; }