mirror of
https://github.com/hawkeye-stan/msfs-popout-panel-manager.git
synced 2024-11-21 13:20:11 +00:00
Add failure condition for loading custom camera view
This commit is contained in:
parent
6a9e1d3520
commit
6d80416f56
4 changed files with 29 additions and 11 deletions
|
@ -158,16 +158,20 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
if (!ActiveProfile.HasCustomPanels)
|
||||
return;
|
||||
|
||||
await StepPreCustomPanelPopOut();
|
||||
if (!await StepPreCustomPanelPopOut())
|
||||
{
|
||||
ActiveProfile.PanelConfigs.Where(p => p.PanelType == PanelType.CustomPopout).ToList().ForEach(p => p.PanelHandle = IntPtr.Zero);
|
||||
return;
|
||||
}
|
||||
|
||||
await StepCustomPanelPopOut(builtInPanelHandles);
|
||||
|
||||
await StepPostCustomPanelPopOut();
|
||||
}
|
||||
|
||||
private async Task StepPreCustomPanelPopOut()
|
||||
private async Task<bool> StepPreCustomPanelPopOut()
|
||||
{
|
||||
await Task.Run(() =>
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
// Set Windowed Display Mode window's configuration if needed
|
||||
if (_appSettingData.ApplicationSetting.WindowedModeSetting.AutoResizeMsfsGameWindow && WindowActionManager.IsMsfsGameInWindowedMode())
|
||||
|
@ -211,17 +215,23 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
ResetCockpitView();
|
||||
}, true);
|
||||
|
||||
WorkflowStepWithMessage.Execute("Loading custom camera view", () =>
|
||||
|
||||
var success = WorkflowStepWithMessage.Execute("Loading custom camera view", () =>
|
||||
{
|
||||
LoadCustomView(AppSetting.PopOutSetting.AutoPanning.KeyBinding);
|
||||
return LoadCustomView(AppSetting.PopOutSetting.AutoPanning.KeyBinding);
|
||||
}, true);
|
||||
|
||||
if (!success)
|
||||
return false;
|
||||
|
||||
WorkflowStepWithMessage.Execute("Setting camera zoom level", () =>
|
||||
{
|
||||
SetCockpitZoomLevel(50);
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -556,7 +566,7 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
|
||||
WorkflowStepWithMessage.Execute("Loading custom camera view", () =>
|
||||
{
|
||||
LoadCustomView(AppSetting.PopOutSetting.AfterPopOutCameraView.KeyBinding);
|
||||
return LoadCustomView(AppSetting.PopOutSetting.AfterPopOutCameraView.KeyBinding);
|
||||
}, true);
|
||||
|
||||
WorkflowStepWithMessage.Execute("Setting camera zoom level", () =>
|
||||
|
@ -586,7 +596,7 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
}
|
||||
}
|
||||
|
||||
private void LoadCustomView(string keybinding)
|
||||
private bool LoadCustomView(string keybinding)
|
||||
{
|
||||
int retry = 10;
|
||||
for(var i = 0; i < retry; i++)
|
||||
|
@ -594,8 +604,10 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
InputEmulationManager.LoadCustomView(keybinding);
|
||||
Thread.Sleep(1000); // wait for flightsimdata to be updated
|
||||
if (_flightSimData.CameraViewTypeAndIndex1 == CAMERA_VIEW_CUSTOM_CAMERA) // custom camera view enum
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void SetCockpitZoomLevel(int zoom)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
## Version 4.0.2
|
||||
* Added new logic to detect when flight session is ready to initiate pop out process for auto pop out panel.
|
||||
* Added new logic (not based on timing) to detect when flight session is ready to initiate pop out process for auto pop out panel. You can also set Auto Pop Out Panel Delay in preferences to 0 seconds if you have a fast PC.
|
||||
|
||||
* Fixed camera logic to save and load custom camera view used by Pop Out Panel Manager. This is to work around camera issue since AAU2. Also, pop out progress messages will now show steps being taken when adjusting camera view.
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace MSFSPopoutPanelManager.Shared
|
|||
{
|
||||
public static class WorkflowStepWithMessage
|
||||
{
|
||||
public static void Execute(string message, Func<bool> function, bool isSubTask = false)
|
||||
public static bool Execute(string message, Func<bool> function, bool isSubTask = false)
|
||||
{
|
||||
if (isSubTask)
|
||||
message = " - " + message;
|
||||
|
@ -16,9 +16,15 @@ namespace MSFSPopoutPanelManager.Shared
|
|||
|
||||
StatusMessageWriter.RemoveLastMessage();
|
||||
if (result)
|
||||
{
|
||||
StatusMessageWriter.WriteOkStatusMessage();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
StatusMessageWriter.WriteFailureStatusMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Execute(string message, Action function, bool isSubTask = false)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<hr/>
|
||||
|
||||
## Version 4.0.2
|
||||
* Added new logic to detect when flight session is ready to initiate pop out process for auto pop out panel.
|
||||
* Added new logic (not based on timing) to detect when flight session is ready to initiate pop out process for auto pop out panel. You can also set Auto Pop Out Panel Delay in preferences to 0 seconds if you have a fast PC.
|
||||
|
||||
* Fixed camera logic to save and load custom camera view used by Pop Out Panel Manager. This is to work around camera issue since AAU2. Also, pop out progress messages will now show steps being taken when adjusting camera view.
|
||||
|
||||
|
|
Loading…
Reference in a new issue