mirror of
https://github.com/hawkeye-stan/msfs-popout-panel-manager.git
synced 2024-12-28 07:11:59 +00:00
Remove wait for ready to fly button logic
This commit is contained in:
parent
0862d5ef2d
commit
859e68893e
4 changed files with 44 additions and 47 deletions
|
@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Configuration>Local</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
<PublishDir>..\..\..\publish\master</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
|
|
|
@ -5,7 +5,6 @@ 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;
|
||||
|
@ -14,9 +13,6 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
{
|
||||
public class PanelPopOutOrchestrator : ObservableObject
|
||||
{
|
||||
// This will be replaced by a signal from Ready to Fly Skipper into webserver in version 4.0
|
||||
private const int READY_TO_FLY_BUTTON_APPEARANCE_DELAY = 2000;
|
||||
|
||||
private ProfileData _profileData;
|
||||
private AppSettingData _appSettingData;
|
||||
private FlightSimData _flightSimData;
|
||||
|
@ -88,8 +84,6 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
|
||||
StepPopoutPrep();
|
||||
|
||||
await StepReadyToFlyDelay(isAutoPopOut);
|
||||
|
||||
// *** THIS MUST BE DONE FIRST. Get the built-in panel list to be configured later
|
||||
List<IntPtr> builtInPanelHandles = WindowActionManager.GetWindowsByPanelType(new List<PanelType>() { PanelType.BuiltInPopout });
|
||||
|
||||
|
@ -122,25 +116,6 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
PanelSourceOrchestrator.CloseAllPanelSource();
|
||||
}
|
||||
|
||||
private async Task StepReadyToFlyDelay(bool isAutoPopOut)
|
||||
{
|
||||
if (!isAutoPopOut)
|
||||
return;
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
StatusMessageWriter.WriteMessage("Waiting on ready to fly button delay", StatusMessageType.Info);
|
||||
|
||||
// Match the delay for Ready to Fly button to disappear
|
||||
Thread.Sleep(READY_TO_FLY_BUTTON_APPEARANCE_DELAY);
|
||||
|
||||
// Extra wait for cockpit view to appear and align
|
||||
Thread.Sleep(AppSetting.AutoPopOutSetting.ReadyToFlyDelay * 1000);
|
||||
|
||||
StatusMessageWriter.WriteOkStatusMessage();
|
||||
});
|
||||
}
|
||||
|
||||
private async Task StepAddCutomPanels(List<IntPtr> builtInPanelHandles)
|
||||
{
|
||||
if (!ActiveProfile.HasCustomPanels)
|
||||
|
@ -187,8 +162,7 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
// Remember current game's zoom level to be recall after pop out
|
||||
_prePopOutCockpitZoomLevel = _flightSimData.CockpitCameraZoom;
|
||||
LoadCustomView(AppSetting.PopOutSetting.AutoPanning.KeyBinding);
|
||||
FlightSimOrchestrator.SetCockpitCameraZoomLevel(50);
|
||||
Thread.Sleep(1000);
|
||||
SetCockpitZoomLevel(50);
|
||||
StatusMessageWriter.WriteOkStatusMessage();
|
||||
}
|
||||
});
|
||||
|
@ -246,7 +220,7 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
|
||||
// Return to custom camera view if set
|
||||
var task = Task.Run(() => {
|
||||
FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePopOutCockpitZoomLevel);
|
||||
//SetCockpitZoomLevel(_prePopOutCockpitZoomLevel);
|
||||
ReturnToAfterPopOutCameraView();
|
||||
});
|
||||
});
|
||||
|
@ -485,12 +459,11 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
{
|
||||
case AfterPopOutCameraViewType.CockpitCenterView:
|
||||
InputEmulationManager.CenterView();
|
||||
Thread.Sleep(500);
|
||||
FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePopOutCockpitZoomLevel);
|
||||
SetCockpitZoomLevel(_prePopOutCockpitZoomLevel);
|
||||
break;
|
||||
case AfterPopOutCameraViewType.CustomCameraView:
|
||||
LoadCustomView(AppSetting.PopOutSetting.AfterPopOutCameraView.KeyBinding);
|
||||
FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePopOutCockpitZoomLevel);
|
||||
SetCockpitZoomLevel(_prePopOutCockpitZoomLevel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -502,16 +475,30 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
|
||||
private void LoadCustomView(string keybinding)
|
||||
{
|
||||
int retry = 5;
|
||||
int retry = 20;
|
||||
for(var i = 0; i < retry; i++)
|
||||
{
|
||||
InputEmulationManager.LoadCustomView(keybinding);
|
||||
Thread.Sleep(500); // wait for flightsimdata to be updated
|
||||
|
||||
Thread.Sleep(750); // wait for flightsimdata to be updated
|
||||
if (_flightSimData.CameraViewTypeAndIndex1 == 7) // 7 = custom camera view enum
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetCockpitZoomLevel(int zoom)
|
||||
{
|
||||
int retry = 10;
|
||||
for (var i = 0; i < retry; i++)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"zoom {i}");
|
||||
|
||||
FlightSimOrchestrator.SetCockpitCameraZoomLevel(zoom);
|
||||
Thread.Sleep(500); // wait for flightsimdata to be updated
|
||||
|
||||
if (_flightSimData.CockpitCameraZoom == zoom)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
{
|
||||
_prePanelConfigurationCockpitZoomLevel = _flightSimData.CockpitCameraZoom;
|
||||
LoadCustomView(AppSetting.PopOutSetting.AutoPanning.KeyBinding);
|
||||
FlightSimOrchestrator.SetCockpitCameraZoomLevel(50);
|
||||
SetCockpitZoomLevel(50);
|
||||
WindowActionManager.BringWindowToForeground(ApplicationHandle);
|
||||
}
|
||||
});
|
||||
|
@ -101,8 +101,7 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
if (!AppSetting.PopOutSetting.AfterPopOutCameraView.IsEnabled)
|
||||
{
|
||||
InputEmulationManager.CenterView();
|
||||
Thread.Sleep(500);
|
||||
FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePanelConfigurationCockpitZoomLevel);
|
||||
SetCockpitZoomLevel(_prePanelConfigurationCockpitZoomLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -110,12 +109,11 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
{
|
||||
case AfterPopOutCameraViewType.CockpitCenterView:
|
||||
InputEmulationManager.CenterView();
|
||||
Thread.Sleep(500);
|
||||
FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePanelConfigurationCockpitZoomLevel);
|
||||
SetCockpitZoomLevel(_prePanelConfigurationCockpitZoomLevel);
|
||||
break;
|
||||
case AfterPopOutCameraViewType.CustomCameraView:
|
||||
LoadCustomView(AppSetting.PopOutSetting.AfterPopOutCameraView.KeyBinding);
|
||||
FlightSimOrchestrator.SetCockpitCameraZoomLevel(_prePanelConfigurationCockpitZoomLevel);
|
||||
SetCockpitZoomLevel(_prePanelConfigurationCockpitZoomLevel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -188,15 +186,27 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
|
||||
private void LoadCustomView(string keybinding)
|
||||
{
|
||||
int retry = 5;
|
||||
int retry = 20;
|
||||
for (var i = 0; i < retry; i++)
|
||||
{
|
||||
InputEmulationManager.LoadCustomView(keybinding);
|
||||
Thread.Sleep(500); // wait for flightsimdata to be updated
|
||||
|
||||
Thread.Sleep(750); // wait for flightsimdata to be updated
|
||||
if (_flightSimData.CameraViewTypeAndIndex1 == 7) // 7 = custom camera view enum
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetCockpitZoomLevel(int zoom)
|
||||
{
|
||||
int retry = 10;
|
||||
for (var i = 0; i < retry; i++)
|
||||
{
|
||||
FlightSimOrchestrator.SetCockpitCameraZoomLevel(zoom);
|
||||
Thread.Sleep(500); // wait for flightsimdata to be updated
|
||||
|
||||
if (_flightSimData.CockpitCameraZoom == zoom)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,6 +102,9 @@ namespace MSFSPopoutPanelManager.WindowsAgent
|
|||
PInvoke.keybd_event(Convert.ToByte(VK_SPACE), 0, KEYEVENTF_KEYUP, 0);
|
||||
PInvoke.keybd_event(Convert.ToByte(VK_RCONTROL), 0, KEYEVENTF_KEYUP, 0);
|
||||
Thread.Sleep(200);
|
||||
|
||||
// Wait for center view to complete
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
|
||||
public static void SaveCustomView(string keybinding)
|
||||
|
@ -145,9 +148,6 @@ namespace MSFSPopoutPanelManager.WindowsAgent
|
|||
PInvoke.keybd_event(Convert.ToByte(customViewKey), 0, KEYEVENTF_KEYUP, 0);
|
||||
PInvoke.keybd_event(Convert.ToByte(VK_LMENU), 0, KEYEVENTF_KEYUP, 0);
|
||||
Thread.Sleep(200);
|
||||
|
||||
// Small delay to let load custom view finish
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
|
||||
public static void ToggleFullScreenPanel(IntPtr hwnd)
|
||||
|
|
Loading…
Reference in a new issue