Search code examples
windows-mobilecompact-frameworkemulation

Am I running on an Emulator or a Device


Is there a way (using managed code hopefully) to find out if I am running on an Emulator or an actual physical device?

I am looking for something like this:

public class BarcodeScannerFactory
{
  public override BarcodeScanner GetBarcodeScanner() 
  {
    if (IsARealDevice())    <---------------------------+
       return new SymbolBarcodeScanner();               |
    else                                                |
       return new FakeBarcodeScanner();                 |
  }                                                     |
}                                                       |
                                                        |
// This is the method I need to make    ----------------+

(NOTE: It occurs to me that Windows Phone 7 has been lumped in with most of the tags below. This question however, is intended for Window Mobile 6.5.)


Solution

  • Something along these lines you mean?