知道Windows Phone 8应用程序是否在Windows 10上运行电话

问题描述:

有什么方法可以知道Windows Phone 8应用程序是否在Windows 10上运行?知道Windows Phone 8应用程序是否在Windows 10上运行电话

我注册了一个ScheduledActionService,但在应用程序在Win10上运行时崩溃了。

在此先感谢。

Rudy Huyn有一篇博客文章,其中有一个帮助方法,用于检测您的应用是否在使用反射的Windows 10上运行。

using System.Reflection; 
using Windows.ApplicationModel; 

namespace Huyn.Utils 
{ 
    public class Windows10Helper 
    { 
     private static bool? _isWindows10; 
     public static bool IsWindows10() 
     { 
      if (!_isWindows10.HasValue) 
      { 
       _isWindows10 = Package.Current.GetType() 
        .GetRuntimeProperty("Status") != null; 
      } 
      return _isWindows10.Value; 
     } 
    } 
} 

正如一个音符,这只是实际工作,因为状态属性是新到Windows 10。假设微软将不会被更新的Windows 8.1,以支持这个新属性来检测,这应该很好地工作了你的场景。

Source