我正在学习WP8开发。我正在尝试将指南针合并到我的应用程序中。我在网上找到了很好的教程,但我对这段代码有一个问题
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Devices.Sensors;
namespace PhoneApp4
{
public partial class CompassScreen : PhoneApplicationPage
{
Compass compass = new Compass();
RotateTransform transform = new RotateTransform();
double TrueHeading;
double ReciprocalHeading;
double HeadingAccuracy;
bool Alphabetic = false; //alpha output setting, default is false
bool Calibrating = false;
// Constructor
public CompassScreen()
{
try
{
InitializeComponent();
compass.CurrentValueChanged += new EventHandler<SensorReadingEventArgs<CompassReading>>(compass_CurrentValueChanged);
compass.Calibrate += new EventHandler<CalibrationEventArgs>(compass_Calibrate);
当我做一个只显示指南针的应用程序时,应用程序工作得很好,如果我想合并到一个只有几个窗口的应用程序中,它不能工作,".CurentValueChanged“和".Calibrate”部分用红色下划线,最后两行。
compass.CurrentValueChanged
compass.Calibrate
你能建议我哪里做错了吗?
谢谢R。
发布于 2015-01-03 06:58:37
根据的说法,这些事件不存在于为Windows8设备精心设计的类中。您可以侦听的唯一事件(相当于CurrentValueChanged)是。
https://stackoverflow.com/questions/27747627
复制相似问题