public void SetStation(StationEventArgs station) { try { this.SimConnect.ClearDataDefinition(DataIdentifier.SendStationAtIndex + station.Index); // Build data structure to send to P3D this.SimConnect.AddToDataDefinition(DataIdentifier.SendStationAtIndex + station.Index, "Weapon System Station Selected:" + station.Index, // Simulation Variable which is an array, index it with <Variable Name>:<index> "bool", // Units - "bool". Note: use lowercase. SIMCONNECT_DATATYPE.INT32, 0.0f, SimConnect.SIMCONNECT_UNUSED); this.SimConnect.SetDataOnSimObject(DataIdentifier.SendStationAtIndex + station.Index, (uint)SIMCONNECT_SIMOBJECT_TYPE.USER, SIMCONNECT_DATA_SET_FLAG.DEFAULT, station.IsSelected ? 1 : 0); // Cast bool to int when working with type "BOOL" } catch { RecoverFromError(); } }
private void StationSelectionChanged(StationEventArgs stationArgs) { SetStation(stationArgs); }