private void GetSDKVersions() { GraphicCode graphics; MagneticStripCode printer; try { graphics = new GraphicCode(); printer = new MagneticStripCode(); graphicsSDKVersion = graphics.GetSDKGraphicsVersion(); magneticPrinterSDKVersion = printer.GetSDKPrinterVersion(); lblGraphicsVersion.Text = "Graphics Version: " + graphicsSDKVersion; lblPrinterVersion.Text = "Magnetic Printer Version: " + magneticPrinterSDKVersion; } catch (Exception e) { MessageBox.Show(e.ToString(), "Broc Screwed up the SDK Version Grabber"); } finally { graphics = null; printer = null; } }
private void GetSDKVersions() { GraphicCode graphics; //creates graphics variable from the GraphicsCode.cs class try { graphics = new GraphicCode(); //creates new GraphicCode object and stores in graphics graphicsSDKVersion = graphics.GetSDKGraphicsVersion(); //calls the getSDKGraphicsVersion method of graphics object to determine graphics major, minor and engine level DLL versions and stores results in graphicsSDKVersion printerSDKVersion = graphics.GetSDKPrinterVersion(); //calls the getSDKPrinterVersion method of graphics object to determine printer major, minor, and engine level DLL version and stores results in printerSDKVersion lblGraphicsVersion.Text = "Graphics Version: " + graphicsSDKVersion; //displays the information stored in graphisSDKVersion in lblGraphicsVersion on About tab lblPrinterVersion.Text = "Printer Version: " + printerSDKVersion; //displays the information stored in printerSDKVersion in lblPrinterVersion on About tab } catch (Exception e) { //exception handler MessageBox.Show(e.ToString(), "SDK Version Grabber had errors. Please contact an administrator."); //catches and displays resulting errors to prevent program crash } finally { //finally block runs whether there is an exception or not graphics = null; //sets graphics object to null after it has been used to obtain graphics and printer verion information } }