1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-21 21:30:12 +00:00

Started development v3.4.2

This commit is contained in:
Stanley 2022-08-02 11:51:28 -04:00
parent d7a8ddfa8f
commit f996863bd8
8 changed files with 74 additions and 13 deletions

View file

@ -68,6 +68,7 @@ namespace MSFSPopoutPanelManager.Orchestration
ProfileData.ReadProfiles(); ProfileData.ReadProfiles();
Profile.ProfileData = ProfileData; Profile.ProfileData = ProfileData;
Profile.FlightSimData = FlightSimData;
PanelSource.ProfileData = ProfileData; PanelSource.ProfileData = ProfileData;
PanelSource.AppSettingData = AppSettingData; PanelSource.AppSettingData = AppSettingData;

View file

@ -259,6 +259,9 @@ namespace MSFSPopoutPanelManager.Orchestration
return null; return null;
} }
// Fix SU10+ bug where pop out window after separation is huge
WindowActionManager.MoveWindow(handle, PanelType.CustomPopout, -8, 0, 800, 600);
var panel = new PanelConfig(); var panel = new PanelConfig();
panel.PanelHandle = handle; panel.PanelHandle = handle;
panel.PanelType = PanelType.CustomPopout; panel.PanelType = PanelType.CustomPopout;

View file

@ -1,4 +1,5 @@
using MSFSPopoutPanelManager.Shared; using MSFSPopoutPanelManager.Shared;
using System.Linq;
namespace MSFSPopoutPanelManager.Orchestration namespace MSFSPopoutPanelManager.Orchestration
{ {
@ -6,12 +7,23 @@ namespace MSFSPopoutPanelManager.Orchestration
{ {
internal ProfileData ProfileData { get; set; } internal ProfileData ProfileData { get; set; }
internal FlightSimData FlightSimData { get; set; }
public void AddProfile(string profileName, int copyProfileId) public void AddProfile(string profileName, int copyProfileId)
{ {
if (copyProfileId == -1) if (copyProfileId == -1)
ProfileData.AddProfile(profileName); ProfileData.AddProfile(profileName);
else else
ProfileData.AddProfile(profileName, copyProfileId); ProfileData.AddProfile(profileName, copyProfileId);
// Automatically bind aircraft
var boundProfile = ProfileData.Profiles.FirstOrDefault(p => p.BindingAircrafts.Any(p => p == FlightSimData.CurrentMsfsAircraft));
if (boundProfile == null && FlightSimData.HasCurrentMsfsAircraft)
{
ProfileData.ActiveProfile.BindingAircrafts.Add(FlightSimData.CurrentMsfsAircraft);
ProfileData.WriteProfiles();
ProfileData.RefreshProfile();
}
} }
public void DeleteActiveProfile() public void DeleteActiveProfile()

View file

@ -9,6 +9,8 @@ namespace MSFSPopoutPanelManager.Shared
{ {
#if DEBUG || DEBUGTOUCHPANEL #if DEBUG || DEBUGTOUCHPANEL
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "MSFS Pop Out Panel Manager Debug"); return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "MSFS Pop Out Panel Manager Debug");
#elif RELEASETOUCHPANEL
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "MSFS Pop Out Panel Manager Touch Panel");
#else #else
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "MSFS Pop Out Panel Manager"); return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "MSFS Pop Out Panel Manager");
#endif #endif
@ -18,6 +20,8 @@ namespace MSFSPopoutPanelManager.Shared
{ {
#if DEBUG || DEBUGTOUCHPANEL #if DEBUG || DEBUGTOUCHPANEL
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"MSFS Pop Out Panel Manager Debug\LogFiles\error.log"); return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"MSFS Pop Out Panel Manager Debug\LogFiles\error.log");
#elif RELEASETOUCHPANEL
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"MSFS Pop Out Panel Manager Touch Panel\LogFiles\error.log");
#else #else
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"MSFS Pop Out Panel Manager\LogFiles\error.log"); return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"MSFS Pop Out Panel Manager\LogFiles\error.log");
#endif #endif
@ -27,6 +31,8 @@ namespace MSFSPopoutPanelManager.Shared
{ {
#if DEBUG || DEBUGTOUCHPANEL #if DEBUG || DEBUGTOUCHPANEL
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"MSFS Pop Out Panel Manager Debug\LogFiles\debug.log"); return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"MSFS Pop Out Panel Manager Debug\LogFiles\debug.log");
#elif RELEASETOUCHPANEL
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"MSFS Pop Out Panel Manager Touch Panel\LogFiles\debug.log");
#else #else
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"MSFS Pop Out Panel Manager\LogFiles\debug.log"); return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"MSFS Pop Out Panel Manager\LogFiles\debug.log");
#endif #endif
@ -36,6 +42,8 @@ namespace MSFSPopoutPanelManager.Shared
{ {
#if DEBUG || DEBUGTOUCHPANEL #if DEBUG || DEBUGTOUCHPANEL
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"MSFS Pop Out Panel Manager Debug\LogFiles\info.log"); return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"MSFS Pop Out Panel Manager Debug\LogFiles\info.log");
#elif RELEASETOUCHPANEL
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"MSFS Pop Out Panel Manager Touch Panel\LogFiles\info.log");
#else #else
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"MSFS Pop Out Panel Manager\LogFiles\info.log"); return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"MSFS Pop Out Panel Manager\LogFiles\info.log");
#endif #endif

View file

@ -55,5 +55,10 @@ namespace MSFSPopoutPanelManager.SimConnectAgent
PAUSED, PAUSED,
VIEW, VIEW,
NONE NONE
}; }
public enum SystemStateRequestId
{
AIRCRAFTPATH
}
} }

View file

@ -153,6 +153,7 @@ namespace MSFSPopoutPanelManager.SimConnectAgent
_simConnect.OnRecvEvent += HandleOnReceiveSystemEvent; _simConnect.OnRecvEvent += HandleOnReceiveSystemEvent;
_simConnect.OnRecvSimobjectDataBytype += HandleOnRecvSimobjectDataBytype; _simConnect.OnRecvSimobjectDataBytype += HandleOnRecvSimobjectDataBytype;
_simConnect.OnRecvEventFilename += HandleOnRecvEventFilename; _simConnect.OnRecvEventFilename += HandleOnRecvEventFilename;
_simConnect.OnRecvSystemState += HandleOnRecvSystemState;
// Register simConnect system events // Register simConnect system events
_simConnect.UnsubscribeFromSystemEvent(SimConnectSystemEvent.SIMSTART); _simConnect.UnsubscribeFromSystemEvent(SimConnectSystemEvent.SIMSTART);
@ -164,26 +165,37 @@ namespace MSFSPopoutPanelManager.SimConnectAgent
_simConnect.UnsubscribeFromSystemEvent(SimConnectSystemEvent.AIRCRAFTLOADED); _simConnect.UnsubscribeFromSystemEvent(SimConnectSystemEvent.AIRCRAFTLOADED);
_simConnect.SubscribeToSystemEvent(SimConnectSystemEvent.AIRCRAFTLOADED, "AircraftLoaded"); _simConnect.SubscribeToSystemEvent(SimConnectSystemEvent.AIRCRAFTLOADED, "AircraftLoaded");
System.Threading.Thread.Sleep(5000);
ReceiveMessage();
AddDataDefinitions(); AddDataDefinitions();
for (var i = 0; i < 5; i++)
{
System.Threading.Thread.Sleep(1000);
ReceiveMessage();
}
_simConnect.RequestSystemState(SystemStateRequestId.AIRCRAFTPATH, "AircraftLoaded");
Connected = true; Connected = true;
OnConnected?.Invoke(this, null); OnConnected?.Invoke(this, null);
StatusMessageWriter.WriteMessage("MSFS is connected", StatusMessageType.Info, false); StatusMessageWriter.WriteMessage("MSFS is connected", StatusMessageType.Info, false);
} }
private void HandleOnRecvSystemState(SimConnect sender, SIMCONNECT_RECV_SYSTEM_STATE data)
{
switch ((SystemStateRequestId)Enum.Parse(typeof(SystemStateRequestId), data.dwRequestID.ToString()))
{
case SystemStateRequestId.AIRCRAFTPATH:
SetActiveAircraftTitle(data.szString);
break;
}
}
private void HandleOnRecvEventFilename(SimConnect sender, SIMCONNECT_RECV_EVENT_FILENAME data) private void HandleOnRecvEventFilename(SimConnect sender, SIMCONNECT_RECV_EVENT_FILENAME data)
{ {
switch (data.uEventID) switch (data.uEventID)
{ {
case (uint)SimConnectSystemEvent.AIRCRAFTLOADED: case (uint)SimConnectSystemEvent.AIRCRAFTLOADED:
var filePathToken = data.szFileName.Split(@"\"); SetActiveAircraftTitle(data.szFileName);
var aircraftName = filePathToken[filePathToken.Length - 2];
aircraftName = aircraftName.Replace("_", " ").ToUpper();
SimConnectDataDefinitions.Find(s => s.PropName == "AircraftName").Value = aircraftName;
break; break;
} }
} }
@ -296,5 +308,14 @@ namespace MSFSPopoutPanelManager.SimConnectAgent
var systemEvent = ((SimConnectSystemEvent)data.uEventID); var systemEvent = ((SimConnectSystemEvent)data.uEventID);
OnReceiveSystemEvent?.Invoke(this, systemEvent); OnReceiveSystemEvent?.Invoke(this, systemEvent);
} }
private void SetActiveAircraftTitle(string aircraftFilePath)
{
var filePathToken = aircraftFilePath.Split(@"\");
var aircraftName = filePathToken[filePathToken.Length - 2];
aircraftName = aircraftName.Replace("_", " ").ToUpper();
SimConnectDataDefinitions.Find(s => s.PropName == "AircraftName").Value = aircraftName;
}
} }
} }

View file

@ -1,6 +1,13 @@
# Version History # Version History
<hr/> <hr/>
## Version 3.4.2
* Major change in how profile is being bound to aircraft. A profile is no longer bound to a livery but instead it is bound to an aircraft so you do not have to manual activate binding for individual livery for the same plane. This has been a long awaited request.
* Auto assign aircraft binding when profile is initially created if the active aircraft has no previous profile binding specify.
* Implemented work around for SU10+ issue where after panel separation, the panel's size is huge which blocked most of the game window for lower resolution screen and prevented Pop Out Panel Manager from popping out the next panel.
## Version 3.4.1 ## Version 3.4.1
This release is solely focused on addressing issues regarding touch panel capabilities as well as making improvements to touch feature. Panels I used for testing are This release is solely focused on addressing issues regarding touch panel capabilities as well as making improvements to touch feature. Panels I used for testing are

View file

@ -45,12 +45,12 @@
<Separator Margin="5,10,5,5"/> <Separator Margin="5,10,5,5"/>
<Label HorizontalAlignment="Left" Margin="0,0,0,0" > <Label HorizontalAlignment="Left" Margin="0,0,0,0" >
<TextBlock TextWrapping="WrapWithOverflow"> <TextBlock TextWrapping="WrapWithOverflow">
2. Bind active aircraft to the selected profile to automatically activate profile and automatically pop out panels when a flight session starts. 2. Bind active aircraft to the selected profile to automatically activate profile and pop out panels when flight session starts.
</TextBlock> </TextBlock>
</Label> </Label>
<WrapPanel Orientation="Vertical" Margin="15,0,0,0" HorizontalAlignment="Left"> <WrapPanel Orientation="Vertical" Margin="15,0,0,0" HorizontalAlignment="Left">
<WrapPanel Orientation="Horizontal" Margin="5,5,0,0" HorizontalAlignment="Left"> <WrapPanel Orientation="Horizontal" Margin="5,5,0,0" HorizontalAlignment="Left">
<Label Content="{c:Binding 'FlightSimData.CurrentMsfsAircraft == null ? &quot;Active aircraft is unavailable&quot; : FlightSimData.CurrentMsfsAircraft'}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" FontStyle="Italic" FontSize="16" Width="447"> <Label Content="{c:Binding 'FlightSimData.CurrentMsfsAircraft == null ? &quot;Aircraft information is currently unavailable&quot; : FlightSimData.CurrentMsfsAircraft'}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" FontStyle="Italic" FontSize="16" Width="447">
<Label.Style> <Label.Style>
<Style TargetType="{x:Type Label}"> <Style TargetType="{x:Type Label}">
<Style.Triggers> <Style.Triggers>
@ -58,9 +58,13 @@
<Setter Property="Foreground" Value="LightGreen" ></Setter> <Setter Property="Foreground" Value="LightGreen" ></Setter>
</DataTrigger> </DataTrigger>
<DataTrigger Binding="{Binding ProfileData.IsAircraftBoundToProfile}" Value="False"> <DataTrigger Binding="{Binding ProfileData.IsAircraftBoundToProfile}" Value="False">
<Setter Property="Foreground" Value="AntiqueWhite" ></Setter> <Setter Property="Foreground" Value="White" ></Setter>
</DataTrigger> </DataTrigger>
<DataTrigger Binding="{c:Binding '!ProfileData.IsAllowedAddAircraftBinding and !ProfileData.IsAllowedDeleteAircraftBinding'}" Value="True"> <DataTrigger Binding="{c:Binding 'FlightSimData.CurrentMsfsAircraft == null'}" Value="True">
<Setter Property="Foreground" Value="AntiqueWhite" ></Setter>
<Setter Property="ToolTip" Value="No aircraft has been loaded by the game yet"></Setter>
</DataTrigger>
<DataTrigger Binding="{c:Binding 'FlightSimData.CurrentMsfsAircraft != null and !ProfileData.IsAllowedAddAircraftBinding and !ProfileData.IsAllowedDeleteAircraftBinding'}" Value="True">
<Setter Property="Foreground" Value="Red" ></Setter> <Setter Property="Foreground" Value="Red" ></Setter>
<Setter Property="ToolTip" Value="Aircraft is currently bound to another profile"></Setter> <Setter Property="ToolTip" Value="Aircraft is currently bound to another profile"></Setter>
</DataTrigger> </DataTrigger>