Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        static Platform()
        {
#if !PocketPC
            _hostPlatformID = HostPlatformID.Desktop;
#else
            // Are we running on "Deploy to My Computer" ?
            if (Environment.OSVersion.Platform == PlatformID.WinCE)
            {
                // Determine the platform
                StringBuilder sb = new System.Text.StringBuilder(128);

                // SPI_GETPLATFORMTYPE
                bool success = NativeMethods.GetSystemParameterString(257, (UInt32)(sb.Capacity * System.Runtime.InteropServices.Marshal.SizeOf(typeof(char))), sb, false);

                // compare strings as lowercase
                string str = sb.ToString().ToLower();
                switch (str)
                {
                case "smartphone":
                    _HostPlatformID = HostPlatformID.Smartphone;
                    break;

                case "pocketpc":
                    _HostPlatformID = HostPlatformID.PocketPC;
                    break;

                default:
                    _HostPlatformID = HostPlatformID.WindowsCE;
                    break;
                }
            }
            else
            {
                // Deploy to My Computer runs on the desktop
                _HostPlatformID = HostPlatformID.Desktop;
            }
#endif
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        static Platform()
        {
#if !PocketPC
            _hostPlatformID = HostPlatformID.Desktop;
#else
            // Are we running on "Deploy to My Computer" ?
            if (Environment.OSVersion.Platform == PlatformID.WinCE)
            {
                // Determine the platform
                StringBuilder sb = new System.Text.StringBuilder(128);

                // SPI_GETPLATFORMTYPE
                bool success = NativeMethods.GetSystemParameterString(257, (UInt32)(sb.Capacity * System.Runtime.InteropServices.Marshal.SizeOf(typeof(char))), sb, false);

                // compare strings as lowercase
                string str = sb.ToString().ToLower();
                switch (str)
                {
                    case "smartphone":
                        _HostPlatformID = HostPlatformID.Smartphone;
                        break;
                    case "pocketpc":
                        _HostPlatformID = HostPlatformID.PocketPC;
                        break;
                    default:
                        _HostPlatformID = HostPlatformID.WindowsCE;
                        break;
                }
            }
            else
            {
                // Deploy to My Computer runs on the desktop
                _HostPlatformID = HostPlatformID.Desktop;
            }
#endif
        }