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>
<RootNamespace>MSFSPopoutPanelManager.DomainModel</RootNamespace>
<Platforms>x64</Platforms>
<Version>4.0.2.0</Version>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<FileVersion>4.0.2.0</FileVersion>
<Version>4.0.2.1</Version>
<AssemblyVersion>4.0.2.1</AssemblyVersion>
<FileVersion>4.0.2.1</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType>
<Configurations>Debug;Release;Local</Configurations>

View file

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

View file

@ -33,6 +33,8 @@ namespace MSFSPopoutPanelManager.Orchestration
public int CockpitCameraZoom { get; set; }
public int CameraViewTypeAndIndex1 { get; set; }
public bool PlaneInParkingSpot { 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);
if (cockpitCameraZoom != _flightSimData.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) =>

View file

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

View file

@ -5,6 +5,7 @@ using MSFSPopoutPanelManager.WindowsAgent;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
@ -185,7 +186,7 @@ namespace MSFSPopoutPanelManager.Orchestration
// Remember current game's zoom level to be recall after pop out
_prePopOutCockpitZoomLevel = _flightSimData.CockpitCameraZoom;
InputEmulationManager.LoadCustomView(AppSetting.PopOutSetting.AutoPanning.KeyBinding);
LoadCustomView(AppSetting.PopOutSetting.AutoPanning.KeyBinding);
FlightSimOrchestrator.SetCockpitCameraZoomLevel(50);
Thread.Sleep(1000);
StatusMessageWriter.WriteOkStatusMessage();
@ -488,7 +489,7 @@ namespace MSFSPopoutPanelManager.Orchestration
FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePopOutCockpitZoomLevel);
break;
case AfterPopOutCameraViewType.CustomCameraView:
InputEmulationManager.LoadCustomView(AppSetting.PopOutSetting.AfterPopOutCameraView.KeyBinding);
LoadCustomView(AppSetting.PopOutSetting.AfterPopOutCameraView.KeyBinding);
FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePopOutCockpitZoomLevel);
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);
}
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)
{
_prePanelConfigurationCockpitZoomLevel = _flightSimData.CockpitCameraZoom;
InputEmulationManager.LoadCustomView(AppSetting.PopOutSetting.AutoPanning.KeyBinding);
LoadCustomView(AppSetting.PopOutSetting.AutoPanning.KeyBinding);
FlightSimOrchestrator.SetCockpitCameraZoomLevel(50);
WindowActionManager.BringWindowToForeground(ApplicationHandle);
}
@ -114,7 +114,7 @@ namespace MSFSPopoutPanelManager.Orchestration
FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePanelConfigurationCockpitZoomLevel);
break;
case AfterPopOutCameraViewType.CustomCameraView:
InputEmulationManager.LoadCustomView(AppSetting.PopOutSetting.AfterPopOutCameraView.KeyBinding);
LoadCustomView(AppSetting.PopOutSetting.AfterPopOutCameraView.KeyBinding);
FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePanelConfigurationCockpitZoomLevel);
break;
}
@ -185,5 +185,18 @@ namespace MSFSPopoutPanelManager.Orchestration
_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.
* 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>
<RootNamespace>MSFSPopoutPanelManager.Shared</RootNamespace>
<Platforms>x64</Platforms>
<Version>4.0.2.0</Version>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<FileVersion>4.0.2.0</FileVersion>
<Version>4.0.2.1</Version>
<AssemblyVersion>4.0.2.1</AssemblyVersion>
<FileVersion>4.0.2.1</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType>
<Configurations>Debug;Release;Local</Configurations>

View file

@ -462,13 +462,6 @@ namespace MSFSPopoutPanelManager.SimConnectAgent
aircraftName = aircraftName.Replace("_", " ").ToUpper();
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.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.CameraViewTypeAndIndex1, VariableName = "CAMERA VIEW TYPE AND INDEX:1", SimConnectUnit = "Enum", DataType = DataType.Float64 });
return definitions;
}
@ -76,6 +77,7 @@ namespace MSFSPopoutPanelManager.SimConnectAgent
public static string CameraState = "CameraState";
public static string AircraftName = "AircraftName";
public static string CockpitCameraZoom = "CockpitCameraZoom";
public static string CameraViewTypeAndIndex1 = "CameraViewTypeAndIndex1";
// Hud Bar data
public static string ElevatorTrim = "ElevatorTrim";

View file

@ -11,9 +11,9 @@
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.SimConnectAgent</RootNamespace>
<Platforms>x64</Platforms>
<Version>4.0.2.0</Version>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<FileVersion>4.0.2.0</FileVersion>
<Version>4.0.2.1</Version>
<AssemblyVersion>4.0.2.1</AssemblyVersion>
<FileVersion>4.0.2.1</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType>
<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.
* Updated logic to verify custom camera view has been loaded before starting pop out process.
## Version 4.0.1.2
* 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...");
// First center view to make sure recalling custom camera works on the first press
CenterView();
var hwnd = WindowProcessManager.SimulatorProcess.Handle;
PInvoke.SetForegroundWindow(hwnd);
Thread.Sleep(200);
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>
<RootNamespace>MSFSPopoutPanelManager.WindowsAgent</RootNamespace>
<Platforms>x64</Platforms>
<Version>4.0.2.0</Version>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<FileVersion>4.0.2.0</FileVersion>
<Version>4.0.2.1</Version>
<AssemblyVersion>4.0.2.1</AssemblyVersion>
<FileVersion>4.0.2.1</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType>
<Configurations>Debug;Release;Local</Configurations>