public static void run() { while (running) { if (Doctor.Connected) { NetCommand command = NetHelper.ReadNetCommand(Doctor); ParseCommand(command); } } if (Doctor != null) { Doctor.Close(); } }
public static void Disconnect() { if (ComPort.IsOpen()) { if (ComPort.Disconnect()) { } else { throw new Exception("Comport was unable to disconnect"); } } if (Doctor != null && Doctor.Connected) { NetHelper.SendNetCommand(Doctor, new NetCommand(NetCommand.CommandType.LOGOUT, Session)); Loggedin = false; running = false; Doctor.Close(); Doctor = null; } }