Intermec PC43d IDL Smart Printing Resource Kit Developer Guide - Page 21

General Guidelines and Best Practices, Limitations on Class Instantiation, Object Lifetime Management

Page 21 highlights

General Guidelines and Best Practices Because the printer is an embedded system that does not support Microsoft .NET Windows.Forms, you need to take certain considerations into account when creating your application. This section lists guidelines for developing your printer application, and includes suggestions for best practices. Limitations on Class Instantiation Classes tied to physical printer components may be instantiated once per component per application, as shown in the next table. A second instantiation of these components in an application raises an exception, or results in undefined or unstable behavior. Maximum Instances of a Class Class Communication.BluetoothListener Communication.IndustrialInterface Communication.SerialPort Communication.TcpListener Communication.USBHost Drawing PrintControl UI.Canvas UI.Keypad UI.LED Maximum Instances One One One per physical serial port One per IP port One per physical USB port One One One One One per physical LED Object Lifetime Management Although common practice in C# applications is to create objects when you need them, and then let the garbage collector clean them up after you no longer need them, some Intermec.Printer classes should be handled differently. Intermec recommends that you instantiate the following classes at application startup, and explicitly dispose them as the application exits: • Drawing • PrintControl • UI.Canvas • UI.Keypad • UI.LED IDL Smart Printing Resource Kit Developer Guide 15

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28

IDL Smart Printing Resource Kit Developer Guide
15
General Guidelines and Best Practices
Because the printer is an embedded system that does not support Microsoft .NET
Windows.Forms, you need to take certain considerations into account when
creating your application. This section lists guidelines for developing your printer
application, and includes suggestions for best practices.
Limitations on Class Instantiation
Classes tied to physical printer components may be instantiated once per
component per application, as shown in the next table. A second instantiation of
these components in an application raises an exception, or results in undefined or
unstable behavior.
Object Lifetime Management
Although common practice in C# applications is to create objects when you need
them, and then let the garbage collector clean them up after you no longer need
them, some Intermec.Printer classes should be handled differently. Intermec
recommends that you instantiate the following classes at application startup, and
explicitly dispose them as the application exits:
Drawing
PrintControl
UI.Canvas
UI.Keypad
UI.LED
Maximum Instances of a Class
Class
Maximum Instances
Communication.BluetoothListener
One
Communication.IndustrialInterface
One
Communication.SerialPort
One per physical serial port
Communication.TcpListener
One per IP port
Communication.USBHost
One per physical USB port
Drawing
One
PrintControl
One
UI.Canvas
One
UI.Keypad
One
UI.LED
One per physical LED