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:
parent
f4fd8a7551
commit
e20d512ef8
3 changed files with 11 additions and 12 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue