Quantcast
Channel: Random Binary - mark-milec
Viewing all articles
Browse latest Browse all 27

Checking if the backlight is active

$
0
0

When the backlight is inactive on a Symbol 9090G, a keypress activates the backlight, but it also acts as a regular keypress.  This was causing a problem for the users of my application so I needed to check if the backlight was active so I can ignore the keypress if it's inactive.  The solution was easy with the help of the Symbol SDK.

using Symbol.Display; publicclass ScreenHandler {  publicstaticbool IsBacklightOn {    get {      bool returnValue;      StandardDisplay display = null;      foreach (Device device in Device.AvailableDevices) {        if (device.DisplayType == DisplayType.StandardDisplay) {          display = new StandardDisplay(device);        }      }      if (display == null) {        returnValue = false;      } else {        returnValue = display.BacklightState == BacklightState.ON;        display.Dispose();      }      return returnValue;    }  } 
}

 

Update: In the previous version of this code, I wasn't disposing the display object.  That caused me far too many hours of frustration, because after around 25 calls to this method, the barcode scanner would stop scanning.


Viewing all articles
Browse latest Browse all 27

Trending Articles