private bool RegisterToSimConnect(SimvarRequest _oSimvarRequest) { if (m_oSimConnect != null) { /// Define a data structure m_oSimConnect.AddToDataDefinition(_oSimvarRequest.eDef, _oSimvarRequest.sName, _oSimvarRequest.sUnits, SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED); /// IMPORTANT: Register it with the simconnect managed wrapper marshaller /// If you skip this step, you will only receive a uint in the .dwData field. m_oSimConnect.RegisterDataDefineStruct <double>(_oSimvarRequest.eDef); return(true); } else { return(false); } }
private void AddRequest(string _sOverrideSimvarRequest, string _sOverrideUnitRequest) { Console.WriteLine("AddRequest"); string sNewSimvarRequest = _sOverrideSimvarRequest != null ? _sOverrideSimvarRequest : ((m_iIndexRequest == 0) ? m_sSimvarRequest : (m_sSimvarRequest + ":" + m_iIndexRequest)); string sNewUnitRequest = _sOverrideUnitRequest != null ? _sOverrideUnitRequest : m_sUnitRequest; SimvarRequest oSimvarRequest = new SimvarRequest { eDef = (DEFINITION)m_iCurrentDefinition, eRequest = (REQUEST)m_iCurrentRequest, sName = sNewSimvarRequest, sUnits = sNewUnitRequest }; oSimvarRequest.bPending = !RegisterToSimConnect(oSimvarRequest); oSimvarRequest.bStillPending = oSimvarRequest.bPending; lSimvarRequests.Add(oSimvarRequest); ++m_iCurrentDefinition; ++m_iCurrentRequest; }