public void WriteDataRef(string dataRef, dynamic newValue, XPlanePluginIcd.DataRefDataType dataRefDataType) { var query = new XPlanePluginIcd.DynamicQuery { DataRef = dataRef, DataType = dataRefDataType, QueryType = XPlanePluginIcd.XplaneQueryType.Write, IntValues = new int[256], FloatValues = new float[256], DoubleValues = new double[256] }; switch (dataRefDataType) { case XPlanePluginIcd.DataRefDataType.XplmTypeInt: query.IntValues[0] = newValue; query.ValueCount = 1; break; case XPlanePluginIcd.DataRefDataType.XplmTypeIntArray: newValue.CopyTo(query.IntValues, 0); query.ValueCount = (byte)newValue.Length; break; case XPlanePluginIcd.DataRefDataType.XplmTypeFloat: query.FloatValues[0] = newValue; query.ValueCount = 1; break; case XPlanePluginIcd.DataRefDataType.XplmTypeFloatArray: newValue.CopyTo(query.FloatValues, 0); query.ValueCount = (byte)newValue.Length; break; case XPlanePluginIcd.DataRefDataType.XplmTypeDouble: query.DoubleValues[0] = newValue; query.ValueCount = 1; break; case XPlanePluginIcd.DataRefDataType.XplmTypeData: query.TextValue = newValue; query.ValueCount = (byte)newValue.Length; break; default: throw new NotSupportedException(); } _sharedMemoryCommand.Write(query); }
/// <summary> /// Called when data is received. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The instance containing the event data.</param> void SharedMemoryResponseDataReceived(object sender, EventArgs<XPlanePluginIcd.DynamicQuery> e) { _response = e.Value; _signal.Set(); }
/// <summary> /// Called when data is received. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The instance containing the event data.</param> void SharedMemoryResponseDataReceived(object sender, EventArgs <XPlanePluginIcd.DynamicQuery> e) { _response = e.Value; _signal.Set(); }