
Untitled
By: a guest on
May 31st, 2012 | syntax:
C# | size: 0.76 KB | hits: 50 | expires: Never
Compass _compass;
public BlankPage()
{
this.InitializeComponent();
_compass = Compass.GetDefault();
if (_compass != null)
{
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromMinutes(10);
timer.Tick += timer_Tick;
timer.Start();
}
}
void timer_Tick(object sender, object e)
{
double last_reading = 0;
CompassReading reading = _compass.GetCurrentReading();
if (reading.HeadingMagneticNorth != last_reading)
{
//różne, rób coś tam
}
else
{
//to samo, rób coś tam
}
last_reading = reading.HeadingMagneticNorth;
}