What is the right way to print zpl code using Link-OS (for .NET)

Hello,

I'm looking for right way to print some zpl code using Link-OS .Net. I want to make calibration using "^XA^HR^JUS^XZ" command and then send to printing other zpl code. How to wait for a response from the printer or something like this? Because I need to know when calibration will be finished. Currently, I'm sending zpl code to the printer using this code:

var printer = UsbDiscoverer.GetZebraDriverPrinters().FirstOrDefault(p => p.ToString().Contains(printerName));
if (printer != null)
{
var connection = printer.GetConnection();
try
{
connection.Open();
var bytes = Encoding.UTF8.GetBytes(zpl);
connection.Write(bytes);
}
catch (Exception e)
{
....
}
finally
{
connection.Close();
}
}

I'd very much appreciate if you guys could share some code or advice about my issue.

Thanks.