1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-25 23:30:10 +00:00
msfs-popout-panel-manager/Orchestration/FlightSimData.cs

94 lines
2.7 KiB
C#
Raw Normal View History

2023-07-12 22:41:31 +00:00
using MSFSPopoutPanelManager.DomainModel.SimConnect;
using MSFSPopoutPanelManager.Shared;
2022-07-23 19:23:32 +00:00
using System;
using System.ComponentModel;
2024-02-29 00:54:25 +00:00
using MSFSPopoutPanelManager.SimConnectAgent;
2022-07-23 19:23:32 +00:00
namespace MSFSPopoutPanelManager.Orchestration
{
public class FlightSimData : ObservableObject
{
2023-07-12 22:41:31 +00:00
public FlightSimData()
{
Setup();
InitializeChildPropertyChangeBinding();
2023-08-05 03:40:29 +00:00
IsSimConnectActive = false;
2023-07-12 22:41:31 +00:00
}
2022-07-23 19:23:32 +00:00
2024-02-28 02:44:21 +00:00
public event EventHandler OnAltAboveGroundChanged;
2023-08-05 03:40:29 +00:00
public bool IsSimConnectActive { get; set; }
2023-07-12 22:41:31 +00:00
public string AircraftName { get; set; }
2022-08-05 03:43:51 +00:00
2024-02-28 02:44:21 +00:00
public bool HasAircraftName => !String.IsNullOrEmpty(AircraftName);
2022-07-23 19:23:32 +00:00
public bool ElectricalMasterBatteryStatus { get; set; }
2023-07-12 22:41:31 +00:00
public bool AvionicsMasterSwitchStatus { get; set; }
public bool TrackIRStatus { get; set; }
2024-02-29 00:54:25 +00:00
public CameraState CameraState { get; set; }
2023-07-12 22:41:31 +00:00
2023-07-30 21:30:47 +00:00
public int CockpitCameraZoom { get; set; }
2024-02-28 02:44:21 +00:00
public int CameraViewTypeAndIndex0 { get; set; }
2023-08-14 04:35:14 +00:00
public int CameraViewTypeAndIndex1 { get; set; }
2024-02-28 02:44:21 +00:00
public int CameraViewTypeAndIndex1Max { get; set; }
public int CameraViewTypeAndIndex2Max { get; set; }
2023-07-12 22:41:31 +00:00
public bool PlaneInParkingSpot { get; set; }
2024-02-28 02:44:21 +00:00
public int PlaneAltAboveGround { get; set; }
2022-07-23 19:23:32 +00:00
public bool IsSimulatorStarted { get; set; }
2023-08-18 21:02:03 +00:00
public bool IsSimConnectDataReceived { get; set; }
2022-07-23 19:23:32 +00:00
2022-08-19 16:03:12 +00:00
public bool IsInCockpit { get; set; }
2022-07-23 19:23:32 +00:00
2024-02-28 02:44:21 +00:00
public bool IsFlightStarted { get; set; }
2023-07-12 22:41:31 +00:00
public IHudBarData HudBarData { get; set; }
[IgnorePropertyChanged]
internal ProfileData ProfileDataRef { get; set; }
public new void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
2022-07-23 19:23:32 +00:00
{
2023-07-12 22:41:31 +00:00
base.OnPropertyChanged(this, new PropertyChangedEventArgs(e.PropertyName));
2022-08-13 06:14:49 +00:00
2023-07-12 22:41:31 +00:00
// Automatic switching of active profile when SimConnect active aircraft change
if (e.PropertyName == "AircraftName")
ProfileDataRef.AutoSwitchProfile();
2024-02-28 02:44:21 +00:00
if(e.PropertyName == "PlaneAltAboveGround")
OnAltAboveGroundChanged?.Invoke(this, EventArgs.Empty);
2023-07-12 22:41:31 +00:00
}
2022-07-23 19:23:32 +00:00
2023-07-12 22:41:31 +00:00
public void Reset()
{
Setup();
2022-07-23 19:23:32 +00:00
}
2023-07-12 22:41:31 +00:00
private void Setup()
2022-07-23 19:23:32 +00:00
{
2023-07-12 22:41:31 +00:00
AircraftName = null;
2022-07-23 19:23:32 +00:00
ElectricalMasterBatteryStatus = false;
2023-07-12 22:41:31 +00:00
AvionicsMasterSwitchStatus = false;
TrackIRStatus = false;
IsInCockpit = false;
PlaneInParkingSpot = false;
2024-02-29 00:54:25 +00:00
CameraState = CameraState.Unknown;
2023-07-12 22:41:31 +00:00
IsSimulatorStarted = false;
2024-02-28 02:44:21 +00:00
PlaneAltAboveGround = 0;
CameraViewTypeAndIndex1Max = 0;
CameraViewTypeAndIndex2Max = 0;
2022-07-23 19:23:32 +00:00
}
}
}