private void TestConnectionString() { Task.Run(() => { try { ClearProgress(); connection = ZebraConnectionBuilder.Build(GetConnectionStringForSdk()); PublishProgress("Connection string evaluated as class type " + connection.GetType().Name); connection.Open(); PublishProgress("Connection opened successfully"); if (IsAttemptingStatusConnection()) { ZebraPrinterLinkOs printer = ZebraPrinterFactory.GetLinkOsPrinter(connection); PublishProgress("Created a printer, attempting to retrieve status"); ZebraPrinterStatus status = printer.GetCurrentStatus(); PublishProgress("Is printer ready to print? " + status.isReadyToPrint); } else { ZebraPrinter printer = ZebraPrinterFactory.GetInstance(connection); PublishProgress("Created a printer, attempting to print a config label"); printer.PrintConfigurationLabel(); } PublishProgress("Closing connection"); } catch (ConnectionException) { MessageBoxCreator.ShowError("Connection could not be opened", "Error"); } catch (ZebraPrinterLanguageUnknownException) { MessageBoxCreator.ShowError("Could not create printer", "Error"); } finally { if (connection != null) { try { connection.Close(); } catch (ConnectionException) { } finally { connection = null; SetTestButtonState(true); } } else { SetTestButtonState(true); } } }); }