因此,我有两个 if 语句来检测您使用的是 HTC 8X 还是 8S,通过手机提供的 DeviceName。问题是它似乎忽略了“If”并只运行所有代码......例如,我放置了一行代码(用于调试),一旦它运行每个部分就会显示一个消息框,但是两个消息框都显示了,而不仅仅是 8X,显示它正确检测到我正在 8X 上运行应用程序。这可能只是一个“愚蠢的错误”,但我无法弄清楚......
if (Microsoft.Phone.Info.DeviceStatus.DeviceName == "Windows Phone 8X by HTC") ;
{
//Debugging MSG
MessageBox.Show("8X Works")
//Rating
MainScore.Text = "6.1";
//Subscores
Processor.Text = "5.2";
RAM.Text = "6.5";
Graphics.Text = "8.0";
HardDisk.Text = "5.1";
//Issues
Issues.Text = "0 ISSUES FOUND";
}
if (Microsoft.Phone.Info.DeviceStatus.DeviceName == "Windows Phone 8S by HTC");
{
//Debugging MSG
MessageBox.Show("8S Works")
//Rating
MainScore.Text = "2.8";
//Subscores
Processor.Text = "3.2";
RAM.Text = "2.4";
Graphics.Text = "4.0";
HardDisk.Text = "1.9";
//Issues
Issues.Text = "0 ISSUES FOUND";
}