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

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