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

Update load custom view logic

This commit is contained in:
hawkeye 2023-08-14 00:35:14 -04:00
parent 365fc637e0
commit 0862d5ef2d
15 changed files with 65 additions and 31 deletions

View file

@ -11,9 +11,9 @@
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl> <PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.DomainModel</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.DomainModel</RootNamespace>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Version>4.0.2.0</Version> <Version>4.0.2.1</Version>
<AssemblyVersion>4.0.2.0</AssemblyVersion> <AssemblyVersion>4.0.2.1</AssemblyVersion>
<FileVersion>4.0.2.0</FileVersion> <FileVersion>4.0.2.1</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType> <DebugType>Embedded</DebugType>
<Configurations>Debug;Release;Local</Configurations> <Configurations>Debug;Release;Local</Configurations>

View file

@ -14,9 +14,9 @@
<RootNamespace>MSFSPopoutPanelManager.MainApp</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.MainApp</RootNamespace>
<ApplicationIcon>logo.ico</ApplicationIcon> <ApplicationIcon>logo.ico</ApplicationIcon>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Version>4.0.2.0</Version> <Version>4.0.2.1</Version>
<AssemblyVersion>4.0.2.0</AssemblyVersion> <AssemblyVersion>4.0.2.1</AssemblyVersion>
<FileVersion>4.0.2.0</FileVersion> <FileVersion>4.0.2.1</FileVersion>
<DebugType>embedded</DebugType> <DebugType>embedded</DebugType>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages> <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<!-- Publishing options --> <!-- Publishing options -->

View file

@ -33,6 +33,8 @@ namespace MSFSPopoutPanelManager.Orchestration
public int CockpitCameraZoom { get; set; } public int CockpitCameraZoom { get; set; }
public int CameraViewTypeAndIndex1 { get; set; }
public bool PlaneInParkingSpot { get; set; } public bool PlaneInParkingSpot { get; set; }
public bool IsSimulatorStarted { get; set; } public bool IsSimulatorStarted { get; set; }

View file

@ -80,6 +80,10 @@ namespace MSFSPopoutPanelManager.Orchestration
var cockpitCameraZoom = Convert.ToInt32(e.Find(d => d.PropertyName == SimDataDefinitions.PropName.CockpitCameraZoom).Value); var cockpitCameraZoom = Convert.ToInt32(e.Find(d => d.PropertyName == SimDataDefinitions.PropName.CockpitCameraZoom).Value);
if (cockpitCameraZoom != _flightSimData.CockpitCameraZoom) if (cockpitCameraZoom != _flightSimData.CockpitCameraZoom)
_flightSimData.CockpitCameraZoom = cockpitCameraZoom; _flightSimData.CockpitCameraZoom = cockpitCameraZoom;
var cameraViewTypeAndIndex1 = Convert.ToInt32(e.Find(d => d.PropertyName == SimDataDefinitions.PropName.CameraViewTypeAndIndex1).Value);
if (cameraViewTypeAndIndex1 != _flightSimData.CameraViewTypeAndIndex1)
_flightSimData.CameraViewTypeAndIndex1 = cameraViewTypeAndIndex1;
}; };
_simConnectProvider.OnSimConnectDataHudBarRefreshed += (sender, e) => _simConnectProvider.OnSimConnectDataHudBarRefreshed += (sender, e) =>

View file

@ -11,9 +11,9 @@
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl> <PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.Orchestration</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.Orchestration</RootNamespace>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Version>4.0.2.0</Version> <Version>4.0.2.1</Version>
<AssemblyVersion>4.0.2.0</AssemblyVersion> <AssemblyVersion>4.0.2.1</AssemblyVersion>
<FileVersion>4.0.2.0</FileVersion> <FileVersion>4.0.2.1</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType> <DebugType>Embedded</DebugType>
<Configurations>Debug;Release;Local</Configurations> <Configurations>Debug;Release;Local</Configurations>

View file

@ -5,6 +5,7 @@ using MSFSPopoutPanelManager.WindowsAgent;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Numerics;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
@ -185,7 +186,7 @@ namespace MSFSPopoutPanelManager.Orchestration
// Remember current game's zoom level to be recall after pop out // Remember current game's zoom level to be recall after pop out
_prePopOutCockpitZoomLevel = _flightSimData.CockpitCameraZoom; _prePopOutCockpitZoomLevel = _flightSimData.CockpitCameraZoom;
InputEmulationManager.LoadCustomView(AppSetting.PopOutSetting.AutoPanning.KeyBinding); LoadCustomView(AppSetting.PopOutSetting.AutoPanning.KeyBinding);
FlightSimOrchestrator.SetCockpitCameraZoomLevel(50); FlightSimOrchestrator.SetCockpitCameraZoomLevel(50);
Thread.Sleep(1000); Thread.Sleep(1000);
StatusMessageWriter.WriteOkStatusMessage(); StatusMessageWriter.WriteOkStatusMessage();
@ -488,7 +489,7 @@ namespace MSFSPopoutPanelManager.Orchestration
FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePopOutCockpitZoomLevel); FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePopOutCockpitZoomLevel);
break; break;
case AfterPopOutCameraViewType.CustomCameraView: case AfterPopOutCameraViewType.CustomCameraView:
InputEmulationManager.LoadCustomView(AppSetting.PopOutSetting.AfterPopOutCameraView.KeyBinding); LoadCustomView(AppSetting.PopOutSetting.AfterPopOutCameraView.KeyBinding);
FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePopOutCockpitZoomLevel); FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePopOutCockpitZoomLevel);
break; break;
} }
@ -498,6 +499,19 @@ namespace MSFSPopoutPanelManager.Orchestration
{ {
return ActiveProfile.PanelConfigs.Count(p => p.IsPopOutSuccess != null && (bool)p.IsPopOutSuccess) != ActiveProfile.PanelConfigs.Count(p => p.IsPopOutSuccess != null); return ActiveProfile.PanelConfigs.Count(p => p.IsPopOutSuccess != null && (bool)p.IsPopOutSuccess) != ActiveProfile.PanelConfigs.Count(p => p.IsPopOutSuccess != null);
} }
private void LoadCustomView(string keybinding)
{
int retry = 5;
for(var i = 0; i < retry; i++)
{
InputEmulationManager.LoadCustomView(keybinding);
Thread.Sleep(500); // wait for flightsimdata to be updated
if (_flightSimData.CameraViewTypeAndIndex1 == 7) // 7 = custom camera view enum
break;
}
}
} }
} }

View file

@ -62,7 +62,7 @@ namespace MSFSPopoutPanelManager.Orchestration
if (AppSetting.PopOutSetting.AutoPanning.IsEnabled) if (AppSetting.PopOutSetting.AutoPanning.IsEnabled)
{ {
_prePanelConfigurationCockpitZoomLevel = _flightSimData.CockpitCameraZoom; _prePanelConfigurationCockpitZoomLevel = _flightSimData.CockpitCameraZoom;
InputEmulationManager.LoadCustomView(AppSetting.PopOutSetting.AutoPanning.KeyBinding); LoadCustomView(AppSetting.PopOutSetting.AutoPanning.KeyBinding);
FlightSimOrchestrator.SetCockpitCameraZoomLevel(50); FlightSimOrchestrator.SetCockpitCameraZoomLevel(50);
WindowActionManager.BringWindowToForeground(ApplicationHandle); WindowActionManager.BringWindowToForeground(ApplicationHandle);
} }
@ -114,7 +114,7 @@ namespace MSFSPopoutPanelManager.Orchestration
FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePanelConfigurationCockpitZoomLevel); FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePanelConfigurationCockpitZoomLevel);
break; break;
case AfterPopOutCameraViewType.CustomCameraView: case AfterPopOutCameraViewType.CustomCameraView:
InputEmulationManager.LoadCustomView(AppSetting.PopOutSetting.AfterPopOutCameraView.KeyBinding); LoadCustomView(AppSetting.PopOutSetting.AfterPopOutCameraView.KeyBinding);
FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePanelConfigurationCockpitZoomLevel); FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePanelConfigurationCockpitZoomLevel);
break; break;
} }
@ -185,5 +185,18 @@ namespace MSFSPopoutPanelManager.Orchestration
_profileData.ActiveProfile.PanelConfigs.Remove(panelConfig); _profileData.ActiveProfile.PanelConfigs.Remove(panelConfig);
} }
private void LoadCustomView(string keybinding)
{
int retry = 5;
for (var i = 0; i < retry; i++)
{
InputEmulationManager.LoadCustomView(keybinding);
Thread.Sleep(500); // wait for flightsimdata to be updated
if (_flightSimData.CameraViewTypeAndIndex1 == 7) // 7 = custom camera view enum
break;
}
}
} }
} }

View file

@ -4,3 +4,6 @@
* Added workaround fix when using camera zoom setting with value other than 50 in MSFS general options will cause Pop Out Panel Manager pop out to fail. This is an existing MSFS bug where saving and loading of custom camera view is currently broken for zoom level other than 50. * Added workaround fix when using camera zoom setting with value other than 50 in MSFS general options will cause Pop Out Panel Manager pop out to fail. This is an existing MSFS bug where saving and loading of custom camera view is currently broken for zoom level other than 50.
* Fixed issue where full screen mode for pop out panel does not work on certain aircraft configuration. * Fixed issue where full screen mode for pop out panel does not work on certain aircraft configuration.
* Updated logic to verify custom camera view has been loaded before starting pop out process.

View file

@ -11,9 +11,9 @@
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl> <PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.Shared</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.Shared</RootNamespace>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Version>4.0.2.0</Version> <Version>4.0.2.1</Version>
<AssemblyVersion>4.0.2.0</AssemblyVersion> <AssemblyVersion>4.0.2.1</AssemblyVersion>
<FileVersion>4.0.2.0</FileVersion> <FileVersion>4.0.2.1</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType> <DebugType>Embedded</DebugType>
<Configurations>Debug;Release;Local</Configurations> <Configurations>Debug;Release;Local</Configurations>

View file

@ -462,13 +462,6 @@ namespace MSFSPopoutPanelManager.SimConnectAgent
aircraftName = aircraftName.Replace("_", " ").ToUpper(); aircraftName = aircraftName.Replace("_", " ").ToUpper();
OnActiveAircraftChanged?.Invoke(this, aircraftName); OnActiveAircraftChanged?.Invoke(this, aircraftName);
//var def = _simConnectDataDefinitions.Find(s => s.PropName == SimDataDefinitions.PropName.AircraftName);
//if(def != null)
//{
// def.Value = aircraftName;
// OnReceivedData?.Invoke(this, _simConnectDataDefinitions);
//}
} }
} }
} }

View file

@ -13,6 +13,7 @@ namespace MSFSPopoutPanelManager.SimConnectAgent
definitions.Add(new SimConnectDataDefinition() { DefinitionId = DATA_DEFINITION.REQUIRED_DEFINITION, RequestId = DATA_REQUEST.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.PlaneInParkingSpot, VariableName = "ATC ON PARKING SPOT", SimConnectUnit = "Bool", DataType = DataType.Float64 }); definitions.Add(new SimConnectDataDefinition() { DefinitionId = DATA_DEFINITION.REQUIRED_DEFINITION, RequestId = DATA_REQUEST.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.PlaneInParkingSpot, VariableName = "ATC ON PARKING SPOT", SimConnectUnit = "Bool", DataType = DataType.Float64 });
definitions.Add(new SimConnectDataDefinition() { DefinitionId = DATA_DEFINITION.REQUIRED_DEFINITION, RequestId = DATA_REQUEST.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.CameraState, VariableName = "CAMERA STATE", SimConnectUnit = "Number", DataType = DataType.Float64 }); definitions.Add(new SimConnectDataDefinition() { DefinitionId = DATA_DEFINITION.REQUIRED_DEFINITION, RequestId = DATA_REQUEST.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.CameraState, VariableName = "CAMERA STATE", SimConnectUnit = "Number", DataType = DataType.Float64 });
definitions.Add(new SimConnectDataDefinition() { DefinitionId = DATA_DEFINITION.REQUIRED_DEFINITION, RequestId = DATA_REQUEST.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.CockpitCameraZoom, VariableName = "COCKPIT CAMERA ZOOM", SimConnectUnit = "Percentage", DataType = DataType.Float64 }); definitions.Add(new SimConnectDataDefinition() { DefinitionId = DATA_DEFINITION.REQUIRED_DEFINITION, RequestId = DATA_REQUEST.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.CockpitCameraZoom, VariableName = "COCKPIT CAMERA ZOOM", SimConnectUnit = "Percentage", DataType = DataType.Float64 });
definitions.Add(new SimConnectDataDefinition() { DefinitionId = DATA_DEFINITION.REQUIRED_DEFINITION, RequestId = DATA_REQUEST.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.CameraViewTypeAndIndex1, VariableName = "CAMERA VIEW TYPE AND INDEX:1", SimConnectUnit = "Enum", DataType = DataType.Float64 });
return definitions; return definitions;
} }
@ -76,6 +77,7 @@ namespace MSFSPopoutPanelManager.SimConnectAgent
public static string CameraState = "CameraState"; public static string CameraState = "CameraState";
public static string AircraftName = "AircraftName"; public static string AircraftName = "AircraftName";
public static string CockpitCameraZoom = "CockpitCameraZoom"; public static string CockpitCameraZoom = "CockpitCameraZoom";
public static string CameraViewTypeAndIndex1 = "CameraViewTypeAndIndex1";
// Hud Bar data // Hud Bar data
public static string ElevatorTrim = "ElevatorTrim"; public static string ElevatorTrim = "ElevatorTrim";

View file

@ -11,9 +11,9 @@
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl> <PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.SimConnectAgent</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.SimConnectAgent</RootNamespace>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Version>4.0.2.0</Version> <Version>4.0.2.1</Version>
<AssemblyVersion>4.0.2.0</AssemblyVersion> <AssemblyVersion>4.0.2.1</AssemblyVersion>
<FileVersion>4.0.2.0</FileVersion> <FileVersion>4.0.2.1</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType> <DebugType>Embedded</DebugType>
<Configurations>Debug;Release;Local</Configurations> <Configurations>Debug;Release;Local</Configurations>

View file

@ -8,6 +8,8 @@
* Fixed issue where full screen mode for pop out panel does not work on certain aircraft configuration. * Fixed issue where full screen mode for pop out panel does not work on certain aircraft configuration.
* Updated logic to verify custom camera view has been loaded before starting pop out process.
## Version 4.0.1.2 ## Version 4.0.1.2
* Hotfix - Fixed issue where using touch panel feature may freeze computer and the application. * Hotfix - Fixed issue where using touch panel feature may freeze computer and the application.

View file

@ -132,8 +132,9 @@ namespace MSFSPopoutPanelManager.WindowsAgent
{ {
Debug.WriteLine("Loading custom view..."); Debug.WriteLine("Loading custom view...");
// First center view to make sure recalling custom camera works on the first press var hwnd = WindowProcessManager.SimulatorProcess.Handle;
CenterView(); PInvoke.SetForegroundWindow(hwnd);
Thread.Sleep(200);
uint customViewKey = (uint)(Convert.ToInt32(keybinding) + KEY_0); uint customViewKey = (uint)(Convert.ToInt32(keybinding) + KEY_0);

View file

@ -11,9 +11,9 @@
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl> <PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.WindowsAgent</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.WindowsAgent</RootNamespace>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Version>4.0.2.0</Version> <Version>4.0.2.1</Version>
<AssemblyVersion>4.0.2.0</AssemblyVersion> <AssemblyVersion>4.0.2.1</AssemblyVersion>
<FileVersion>4.0.2.0</FileVersion> <FileVersion>4.0.2.1</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType> <DebugType>Embedded</DebugType>
<Configurations>Debug;Release;Local</Configurations> <Configurations>Debug;Release;Local</Configurations>