1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-25 15:20:10 +00:00

Version 3.4 in progress

This commit is contained in:
hawkeye 2022-04-25 11:26:28 -04:00
parent f4fd8a7551
commit e20d512ef8
3 changed files with 11 additions and 12 deletions

View file

@ -6,6 +6,8 @@
KEY_ALTERNATOR_SET, KEY_ALTERNATOR_SET,
KEY_AVIONICS_MASTER_SET, KEY_AVIONICS_MASTER_SET,
KEY_AVIONICS_MASTER_2_SET KEY_AVIONICS_MASTER_2_SET,
LIGHT_POTENTIOMETER_2_SET
} }
} }

View file

@ -19,7 +19,7 @@ namespace MSFSPopoutPanelManager.FsConnector
public event EventHandler<EventArgs<dynamic>> OnReceivedData; public event EventHandler<EventArgs<dynamic>> OnReceivedData;
public event EventHandler OnConnected; public event EventHandler OnConnected;
public event EventHandler OnDisconnected; public event EventHandler OnDisconnected;
public event EventHandler<EventArgs<Tuple<SimConnectSystemEvent, uint>>> OnReceiveSystemEvent; public event EventHandler<EventArgs<SimConnectSystemEvent>> OnReceiveSystemEvent;
public dynamic SimData { get; set; } public dynamic SimData { get; set; }
@ -183,9 +183,7 @@ namespace MSFSPopoutPanelManager.FsConnector
private void HandleOnReceiveEvent(SimConnect sender, SIMCONNECT_RECV_EVENT data) private void HandleOnReceiveEvent(SimConnect sender, SIMCONNECT_RECV_EVENT data)
{ {
var systemEvent = ((SimConnectSystemEvent)data.uEventID); var systemEvent = ((SimConnectSystemEvent)data.uEventID);
var tuple = new Tuple<SimConnectSystemEvent, uint>(systemEvent, data.uEventID); OnReceiveSystemEvent?.Invoke(this, new EventArgs<SimConnectSystemEvent>(systemEvent));
OnReceiveSystemEvent?.Invoke(this, new EventArgs<Tuple<SimConnectSystemEvent, uint>>(tuple));
} }
} }
} }

View file

@ -115,15 +115,14 @@ namespace MSFSPopoutPanelManager.Provider
OnSimConnectDataRefreshed?.Invoke(this, new EventArgs<dynamic>(e.Value)); OnSimConnectDataRefreshed?.Invoke(this, new EventArgs<dynamic>(e.Value));
} }
private void HandleReceiveSystemEvent(object sender, EventArgs<Tuple<SimConnectSystemEvent, uint>> e) private void HandleReceiveSystemEvent(object sender, EventArgs<SimConnectSystemEvent> e)
{ {
var systemEvent = e.Value.Item1; var systemEvent = e.Value;
var dwData = e.Value.Item2;
Debug.WriteLine($"SimConnectSystemEvent Received: {systemEvent} dwData: {dwData}"); Debug.WriteLine($"SimConnectSystemEvent Received: {systemEvent}");
// to detect flight start at the "Ready to Fly" screen, it has a SIMSTART follows by a VIEW event // to detect flight start at the "Ready to Fly" screen, it has a SIMSTART follows by a VIEW event
if (_lastSystemEvent == SimConnectSystemEvent.SIMSTART && systemEvent == SimConnectSystemEvent.VIEW && dwData == 4) if (_lastSystemEvent == SimConnectSystemEvent.SIMSTART && systemEvent == SimConnectSystemEvent.VIEW)
{ {
_isSimActive = true; _isSimActive = true;
_lastSystemEvent = SimConnectSystemEvent.NONE; _lastSystemEvent = SimConnectSystemEvent.NONE;
@ -132,8 +131,8 @@ namespace MSFSPopoutPanelManager.Provider
} }
// look for pair of events denoting sim ended after sim is active // look for pair of events denoting sim ended after sim is active
if ((_isSimActive && _lastSystemEvent == SimConnectSystemEvent.SIMSTOP && systemEvent == SimConnectSystemEvent.VIEW && dwData == 4) || if ((_isSimActive && _lastSystemEvent == SimConnectSystemEvent.SIMSTOP && systemEvent == SimConnectSystemEvent.VIEW) ||
(_isSimActive && _lastSystemEvent == SimConnectSystemEvent.SIMSTOP && systemEvent == SimConnectSystemEvent.SIMSTART && dwData == 1)) (_isSimActive && _lastSystemEvent == SimConnectSystemEvent.SIMSTOP && systemEvent == SimConnectSystemEvent.SIMSTART))
{ {
_isSimActive = false; _isSimActive = false;
_lastSystemEvent = SimConnectSystemEvent.NONE; _lastSystemEvent = SimConnectSystemEvent.NONE;