protected virtual void OnCompassDataChanged(CompassDataChangedEventArgs e)//このメソッドでイベント発行。 { if (CompassDataChanged != null) { CompassDataChanged(this, e); } }
private void Sensor_CompassDataChanged(object sender, CompassDataChangedEventArgs e) { Dispatcher.BeginInvoke(() => { refreshCompassData(); }); }
void sensor_CompassDataChanged(object sender, CompassDataChangedEventArgs e) { Dispatcher.BeginInvoke(() => { TextBlock_HeadingAccuracy.Text = Sensor.HeadingAccuracy.ToString(); TextBlock_MagneticHeading.Text = Sensor.MagneticHeading.ToString(); TextBlock_TrueHeading.Text = Sensor.TrueHeading.ToString(); TextBlock_IsCompassDataValid.Text = Sensor.IsCompassDataValid.ToString(); }); }
void cmp_CurrentValueChanged(object sender, SensorReadingEventArgs <CompassReading> e) { IsCompassDataValid = cmp.IsDataValid; TrueHeading = e.SensorReading.TrueHeading; MagneticHeading = e.SensorReading.MagneticHeading; HeadingAccuracy = e.SensorReading.HeadingAccuracy; //_rawMagnetometerReading = e.SensorReading.MagnetometerReading; CompassDataChangedEventArgs changedEvent = new CompassDataChangedEventArgs(); OnCompassDataChanged(changedEvent);//イベントを発行する。 }