public string GetSDKPrinterVersion() { ZBRPrinter printer = null; int major, minor, engLevel; string pVersion = ""; try { printer = new ZBRPrinter(); printer.GetSDKVer(out major, out minor, out engLevel); if (major > 0 || minor > 0 || engLevel > 0) { pVersion = major.ToString() + "." + minor.ToString() + "." + engLevel.ToString(); } } catch (Exception e) { MessageBox.Show(e.ToString()); } finally { printer = null; } return pVersion; }
public string GetSDKPrinterVersion() { // method called on FrmMain.cs in order to obtain printer version ZBRPrinter printer = null; //creates printer variable from the ZBRPrinter.cs class initialized to null int major, minor, engLevel; //integers to hold major, minor, and engine level DLL values of the ZBRPrinter class string pVersion = ""; //creates pVersion string initialized to an empty string, used to hold final printer version numerical data try { printer = new ZBRPrinter(); //creates new ZBRPrinter object and stores in printer printer.GetSDKVer(out major, out minor, out engLevel); //calls to the getSDKVer method of printer, passing major, minor, and engine level variables by reference if (major > 0 || minor > 0 || engLevel > 0) { //if major, minor, or engine levels have values that's greater than their default values of 0... pVersion = major.ToString() + "." + minor.ToString() + "." + engLevel.ToString(); //convert all three values to string, concatenated with a period seperating each, and store the whole string value in pVersion variable - it will appear in label on About page } } catch (Exception e) { //exception handler MessageBox.Show(e.ToString()); } finally { //finally block runs whether there is an exception or not printer = null; //sets printer object to null after it has been used } return pVersion; //return resulting printer DLL version string }