1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-21 13:20:11 +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();
Profile.ProfileData = ProfileData;
Profile.FlightSimData = FlightSimData;
PanelSource.ProfileData = ProfileData;
PanelSource.AppSettingData = AppSettingData;

View file

@ -259,6 +259,9 @@ namespace MSFSPopoutPanelManager.Orchestration
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();
panel.PanelHandle = handle;
panel.PanelType = PanelType.CustomPopout;

View file

@ -1,4 +1,5 @@
using MSFSPopoutPanelManager.Shared;
using System.Linq;
namespace MSFSPopoutPanelManager.Orchestration
{
@ -6,12 +7,23 @@ namespace MSFSPopoutPanelManager.Orchestration
{
internal ProfileData ProfileData { get; set; }
internal FlightSimData FlightSimData { get; set; }
public void AddProfile(string profileName, int copyProfileId)
{
if (copyProfileId == -1)
ProfileData.AddProfile(profileName);
else
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()

View file

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

View file

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

View file

@ -153,6 +153,7 @@ namespace MSFSPopoutPanelManager.SimConnectAgent
_simConnect.OnRecvEvent += HandleOnReceiveSystemEvent;
_simConnect.OnRecvSimobjectDataBytype += HandleOnRecvSimobjectDataBytype;
_simConnect.OnRecvEventFilename += HandleOnRecvEventFilename;
_simConnect.OnRecvSystemState += HandleOnRecvSystemState;
// Register simConnect system events
_simConnect.UnsubscribeFromSystemEvent(SimConnectSystemEvent.SIMSTART);
@ -164,26 +165,37 @@ namespace MSFSPopoutPanelManager.SimConnectAgent
_simConnect.UnsubscribeFromSystemEvent(SimConnectSystemEvent.AIRCRAFTLOADED);
_simConnect.SubscribeToSystemEvent(SimConnectSystemEvent.AIRCRAFTLOADED, "AircraftLoaded");
System.Threading.Thread.Sleep(5000);
ReceiveMessage();
AddDataDefinitions();
for (var i = 0; i < 5; i++)
{
System.Threading.Thread.Sleep(1000);
ReceiveMessage();
}
_simConnect.RequestSystemState(SystemStateRequestId.AIRCRAFTPATH, "AircraftLoaded");
Connected = true;
OnConnected?.Invoke(this, null);
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)
{
switch (data.uEventID)
{
case (uint)SimConnectSystemEvent.AIRCRAFTLOADED:
var filePathToken = data.szFileName.Split(@"\");
var aircraftName = filePathToken[filePathToken.Length - 2];
aircraftName = aircraftName.Replace("_", " ").ToUpper();
SimConnectDataDefinitions.Find(s => s.PropName == "AircraftName").Value = aircraftName;
SetActiveAircraftTitle(data.szFileName);
break;
}
}
@ -296,5 +308,14 @@ namespace MSFSPopoutPanelManager.SimConnectAgent
var systemEvent = ((SimConnectSystemEvent)data.uEventID);
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
<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
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"/>
<Label HorizontalAlignment="Left" Margin="0,0,0,0" >
<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>
</Label>
<WrapPanel Orientation="Vertical" Margin="15,0,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>
<Style TargetType="{x:Type Label}">
<Style.Triggers>
@ -58,9 +58,13 @@
<Setter Property="Foreground" Value="LightGreen" ></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding ProfileData.IsAircraftBoundToProfile}" Value="False">
<Setter Property="Foreground" Value="AntiqueWhite" ></Setter>
<Setter Property="Foreground" Value="White" ></Setter>
</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="ToolTip" Value="Aircraft is currently bound to another profile"></Setter>
</DataTrigger>