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

Attempt to fix pop out issue

This commit is contained in:
hawkeye 2023-09-10 12:19:41 -04:00
parent 11b3134994
commit 004cf3d8ab
9 changed files with 40 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.8</Version>
<AssemblyVersion>4.0.2.8</AssemblyVersion>
<FileVersion>4.0.2.8</FileVersion>
<Version>4.0.2.9</Version>
<AssemblyVersion>4.0.2.9</AssemblyVersion>
<FileVersion>4.0.2.9</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.8</Version>
<AssemblyVersion>4.0.2.8</AssemblyVersion>
<FileVersion>4.0.2.8</FileVersion>
<Version>4.0.2.9</Version>
<AssemblyVersion>4.0.2.9</AssemblyVersion>
<FileVersion>4.0.2.9</FileVersion>
<DebugType>embedded</DebugType>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<!-- Publishing options -->

View file

@ -38,6 +38,9 @@ namespace MSFSPopoutPanelManager.Orchestration
FlightSim.OnSimulatorExited += (sender, e) => { ApplicationClose(); Environment.Exit(0); };
Keyboard.PanelPopOutOrchestrator = PanelPopOut;
// Delete all existing cache version of app
Help.DeleteAppCache();
}
public ProfileOrchestrator Profile { get; set; }

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.8</Version>
<AssemblyVersion>4.0.2.8</AssemblyVersion>
<FileVersion>4.0.2.8</FileVersion>
<Version>4.0.2.9</Version>
<AssemblyVersion>4.0.2.9</AssemblyVersion>
<FileVersion>4.0.2.9</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType>
<Configurations>Debug;Release;Local</Configurations>

View file

@ -249,9 +249,7 @@ namespace MSFSPopoutPanelManager.Orchestration
WorkflowStepWithMessage.Execute(panelConfig.PanelName, () =>
{
panelConfig.IsSelectedPanelSource = true;
PanelSourceOrchestrator.ShowPanelSourceNonEdit(panelConfig);
ExecuteCustomPopout(panelConfig, builtInPanelHandles, index++);
PanelSourceOrchestrator.ClosePanelSourceNonEdit(panelConfig);
ApplyPanelLocation(panelConfig);
panelConfig.IsSelectedPanelSource = false;
@ -434,6 +432,10 @@ namespace MSFSPopoutPanelManager.Orchestration
{
if (panel.PanelType == PanelType.CustomPopout)
{
PanelSourceOrchestrator.ShowPanelSourceNonEdit(panel);
InputEmulationManager.PrepareToPopOutPanel((int)panel.PanelSource.X, (int)panel.PanelSource.Y);
PanelSourceOrchestrator.ClosePanelSourceNonEdit(panel);
// There should only be one handle that is not in both builtInPanelHandles vs latestAceAppWindowsWithCaptionHandles
var handle = TryPopOutCustomPanel(panel.PanelSource, builtInPanelHandles);
@ -467,7 +469,7 @@ namespace MSFSPopoutPanelManager.Orchestration
private IntPtr TryPopOutCustomPanel(PanelSource panelSource, List<IntPtr> builtInPanelHandles)
{
// Try to pop out 5 times before failure with 1/4 second wait in between
// Try to pop out 3 times before failure with 1/2 second wait in between
int count = 0;
do
{
@ -481,10 +483,10 @@ namespace MSFSPopoutPanelManager.Orchestration
if (handle != IntPtr.Zero)
return handle;
Thread.Sleep(250);
Thread.Sleep(500);
count++;
}
while (count < 5);
while (count < 3);
return IntPtr.Zero;
}

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.8</Version>
<AssemblyVersion>4.0.2.8</AssemblyVersion>
<FileVersion>4.0.2.8</FileVersion>
<Version>4.0.2.9</Version>
<AssemblyVersion>4.0.2.9</AssemblyVersion>
<FileVersion>4.0.2.9</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType>
<Configurations>Debug;Release;Local</Configurations>

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.8</Version>
<AssemblyVersion>4.0.2.8</AssemblyVersion>
<FileVersion>4.0.2.8</FileVersion>
<Version>4.0.2.9</Version>
<AssemblyVersion>4.0.2.9</AssemblyVersion>
<FileVersion>4.0.2.9</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType>
<Configurations>Debug;Release;Local</Configurations>

View file

@ -44,25 +44,28 @@ namespace MSFSPopoutPanelManager.WindowsAgent
PInvoke.mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
}
public static void PopOutPanel(int x, int y, bool useSecondaryKeys)
public static void PrepareToPopOutPanel(int x, int y)
{
Debug.WriteLine($"Pop out panel at: {x}/{y} ...");
PInvoke.SetForegroundWindow(WindowProcessManager.SimulatorProcess.Handle);
Thread.Sleep(250);
MoveAppWindowFromLeftClickPoint(x, y);
LeftClick(x, y);
// Left click outside the cirlce area to focus game window
LeftClick(x + 30, y);
// Force cursor reset and focus (doubling to make sure)
LeftClick(x, y);
// Force cursor reset and focus
PInvoke.SetCursorPos(x, y);
Thread.Sleep(500);
}
public static void PopOutPanel(int x, int y, bool useSecondaryKeys)
{
if (useSecondaryKeys)
{
InputSimulator.Keyboard.KeyDown(WindowsInput.Native.VirtualKeyCode.LCONTROL);
InputSimulator.Keyboard.KeyDown(WindowsInput.Native.VirtualKeyCode.RCONTROL);
Thread.Sleep(300);
Thread.Sleep(500);
PInvoke.mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
Thread.Sleep(200);
PInvoke.mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
@ -79,7 +82,7 @@ namespace MSFSPopoutPanelManager.WindowsAgent
else
{
InputSimulator.Keyboard.KeyDown(WindowsInput.Native.VirtualKeyCode.RMENU);
Thread.Sleep(300);
Thread.Sleep(500);
PInvoke.mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
Thread.Sleep(200);
PInvoke.mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
@ -220,6 +223,7 @@ namespace MSFSPopoutPanelManager.WindowsAgent
{
var top = y - applicationRectangle.Height - 50;
WindowActionManager.MoveWindow(appHandle, applicationRectangle.X, top, applicationRectangle.Width, applicationRectangle.Height);
Thread.Sleep(1000);
}
}

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.8</Version>
<AssemblyVersion>4.0.2.8</AssemblyVersion>
<FileVersion>4.0.2.8</FileVersion>
<Version>4.0.2.9</Version>
<AssemblyVersion>4.0.2.9</AssemblyVersion>
<FileVersion>4.0.2.9</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType>
<Configurations>Debug;Release;Local</Configurations>