Am I running on an Emulator or a Device

孤街浪徒 提交于 2019-12-11 04:05:22

问题


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.)


回答1:


Something along these lines you mean?



来源:https://stackoverflow.com/questions/4504431/am-i-running-on-an-emulator-or-a-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!