// Disconnect from printer private void Disconnect(ReqPkt pkt) { if (null != this.ijp) { ijp.Disconnect(); ijp.Dispose(); ijp = null; ComOn = IJPOnlineStatus.Offline; } }
// Connect to printer private void Connect(ReqPkt pkt) { Disconnect(pkt); ijp = new IJP() { IPAddress = pkt.IpAddress, Timeout = pkt.TimeOut, Retry = pkt.Retries }; ijp.Connect(); ComOn = ijp.GetComPort(); // Be sure com is on if (ComOn == IJPOnlineStatus.Offline) { ijp.SetComPort(IJPOnlineStatus.Online); ComOn = IJPOnlineStatus.Online; } }