Checking if the backlight is active

by Mark Milec 4/7/2008 8:54:00 AM

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; 
public class ScreenHandler {
  public static bool 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.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Comments

10/27/2009 9:08:37 PM

cash loans

Hmmm interesting stuff

cash loans us

11/12/2009 1:12:50 PM

payday loans

Interesting ... as always - is your blog making any cash advance ? ;)

payday loans us

11/18/2009 9:17:06 AM

payday loans

I just hope to have understood this the way it was meant

payday loans us

Powered by BlogEngine.NET 1.3.1.0
Theme by Mads Kristensen

About the author

Name of author Mark Milec
Senior Application Developer at Atlas Tube

View Mark Milec's profile on LinkedIn E-mail me Send mail

Calendar

<<  July 2010  >>
MoTuWeThFrSaSu
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar

Pages

    Recent comments

    Archive

    Authors

    Categories

    None


    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2010

    Sign in