示例#1
0
 void ISensorEvents.OnDataUpdated(ISensor sensor, ISensorDataReport newData)
 {
     DataReport = SensorReport.FromNativeReport(this, newData);
     if (DataReportChanged != null)
     {
         DataReportChanged.Invoke(this, EventArgs.Empty);
     }
 }
示例#2
0
        internal HResult InternalUpdateData()
        {
            ISensorDataReport iReport;
            HResult           hr = nativeISensor.GetData(out iReport);

            if (hr == HResult.Ok)
            {
                try
                {
                    DataReport = SensorReport.FromNativeReport(this, iReport);
                    if (DataReportChanged != null)
                    {
                        DataReportChanged.Invoke(this, EventArgs.Empty);
                    }
                }
                finally
                {
                    Marshal.ReleaseComObject(iReport);
                }
            }
            return(hr);
        }