1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-24 14:50:10 +00:00

Update full screen mode keystroke

This commit is contained in:
hawkeye 2023-08-04 23:40:29 -04:00
parent 5f4aaafb9d
commit 68fce94b4d
6 changed files with 31 additions and 5 deletions

View file

@ -19,6 +19,18 @@
<Window.Resources> <Window.Resources>
<system:Double x:Key="IconSize">22</system:Double> <system:Double x:Key="IconSize">22</system:Double>
<system:Double x:Key="ButtonSize">28</system:Double> <system:Double x:Key="ButtonSize">28</system:Double>
<Style
x:Key="TxtBoxTitle"
BasedOn="{StaticResource MaterialDesignBody1TextBlock}"
TargetType="{x:Type TextBlock}">
<Setter Property="Margin" Value="10,5,10,5" />
<Setter Property="Foreground" Value="White" />
<Style.Triggers>
<DataTrigger Binding="{Binding FlightSimData.IsSimConnectActive}" Value="False">
<Setter Property="Foreground" Value="Red" />
</DataTrigger>
</Style.Triggers>
</Style>
<Style <Style
x:Key="TxtBoxLabel" x:Key="TxtBoxLabel"
BasedOn="{StaticResource MaterialDesignBody1TextBlock}" BasedOn="{StaticResource MaterialDesignBody1TextBlock}"
@ -79,7 +91,7 @@
<TextBlock <TextBlock
Grid.Column="0" Grid.Column="0"
Margin="10,5,0,0" Margin="10,5,0,0"
Style="{StaticResource TxtBoxLabel}" Style="{StaticResource TxtBoxTitle}"
Text="{Binding HudBarTypeText}" /> Text="{Binding HudBarTypeText}" />
<DockPanel Grid.Column="1"> <DockPanel Grid.Column="1">
<Separator Style="{StaticResource VerticalSeparator}" /> <Separator Style="{StaticResource VerticalSeparator}" />

View file

@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
--> -->
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<Configuration>Release</Configuration> <Configuration>Local</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
<PublishDir>..\..\..\publish\master</PublishDir> <PublishDir>..\..\..\publish\master</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>

View file

@ -11,8 +11,11 @@ namespace MSFSPopoutPanelManager.Orchestration
{ {
Setup(); Setup();
InitializeChildPropertyChangeBinding(); InitializeChildPropertyChangeBinding();
IsSimConnectActive = false;
} }
public bool IsSimConnectActive { get; set; }
public string AircraftName { get; set; } public string AircraftName { get; set; }
public bool HasAircraftName public bool HasAircraftName

View file

@ -45,6 +45,7 @@ namespace MSFSPopoutPanelManager.Orchestration
_simConnectProvider.OnConnected += (sender, e) => _simConnectProvider.OnConnected += (sender, e) =>
{ {
_flightSimData.IsSimConnectActive = true;
_flightSimData.IsSimulatorStarted = true; _flightSimData.IsSimulatorStarted = true;
WindowProcessManager.GetSimulatorProcess(); // refresh simulator process WindowProcessManager.GetSimulatorProcess(); // refresh simulator process
DetectMsfsExit(); DetectMsfsExit();
@ -52,10 +53,16 @@ namespace MSFSPopoutPanelManager.Orchestration
_simConnectProvider.OnDisconnected += (sender, e) => _simConnectProvider.OnDisconnected += (sender, e) =>
{ {
_flightSimData.IsSimConnectActive = false;
WindowProcessManager.GetSimulatorProcess(); // refresh simulator process WindowProcessManager.GetSimulatorProcess(); // refresh simulator process
_flightSimData.Reset(); _flightSimData.Reset();
}; };
_simConnectProvider.OnException += (sender, e) =>
{
_flightSimData.IsSimConnectActive = false;
};
_simConnectProvider.OnSimConnectDataRequiredRefreshed += (sender, e) => _simConnectProvider.OnSimConnectDataRequiredRefreshed += (sender, e) =>
{ {
var electricalMasterBattery = Convert.ToBoolean(e.Find(d => d.PropertyName == SimDataDefinitions.PropName.ElectricalMasterBattery).Value); var electricalMasterBattery = Convert.ToBoolean(e.Find(d => d.PropertyName == SimDataDefinitions.PropName.ElectricalMasterBattery).Value);

View file

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using static MSFSPopoutPanelManager.SimConnectAgent.SimDataDefinitions; using static MSFSPopoutPanelManager.SimConnectAgent.SimDataDefinitions;
namespace MSFSPopoutPanelManager.SimConnectAgent namespace MSFSPopoutPanelManager.SimConnectAgent
@ -30,6 +31,7 @@ namespace MSFSPopoutPanelManager.SimConnectAgent
public event EventHandler<bool> OnIsInCockpitChanged; public event EventHandler<bool> OnIsInCockpitChanged;
public event EventHandler OnFlightStarted; public event EventHandler OnFlightStarted;
public event EventHandler OnFlightStopped; public event EventHandler OnFlightStopped;
public event EventHandler OnException;
public event EventHandler<List<SimDataItem>> OnSimConnectDataRequiredRefreshed; public event EventHandler<List<SimDataItem>> OnSimConnectDataRequiredRefreshed;
public event EventHandler<List<SimDataItem>> OnSimConnectDataHudBarRefreshed; public event EventHandler<List<SimDataItem>> OnSimConnectDataHudBarRefreshed;
public event EventHandler<string> OnActiveAircraftChanged; public event EventHandler<string> OnActiveAircraftChanged;
@ -252,7 +254,7 @@ namespace MSFSPopoutPanelManager.SimConnectAgent
_hudBarRequestDataTimer = new System.Timers.Timer(); _hudBarRequestDataTimer = new System.Timers.Timer();
_hudBarRequestDataTimer.Interval = MSFS_HUDBAR_DATA_REFRESH_TIMEOUT; _hudBarRequestDataTimer.Interval = MSFS_HUDBAR_DATA_REFRESH_TIMEOUT;
_hudBarRequestDataTimer.Stop(); _hudBarRequestDataTimer.Stop();
_hudBarRequestDataTimer.Elapsed += (sender, e) => { try { _simConnector.RequestHudBarData(); } catch { } }; ; _hudBarRequestDataTimer.Elapsed += (sender, e) => { try { _simConnector.RequestHudBarData(); } catch { } };
if (_isHudBarDataActive) if (_isHudBarDataActive)
SetHudBarConfig(_activeHudBarType); SetHudBarConfig(_activeHudBarType);
@ -270,6 +272,8 @@ namespace MSFSPopoutPanelManager.SimConnectAgent
private void HandleSimException(object source, string e) private void HandleSimException(object source, string e)
{ {
OnException?.Invoke(this, null);
_requiredRequestDataTimer.Stop(); _requiredRequestDataTimer.Stop();
_hudBarRequestDataTimer.Stop(); _hudBarRequestDataTimer.Stop();

View file

@ -157,11 +157,11 @@ namespace MSFSPopoutPanelManager.WindowsAgent
PInvoke.SetFocus(hwnd); PInvoke.SetFocus(hwnd);
Thread.Sleep(300); Thread.Sleep(300);
PInvoke.keybd_event(Convert.ToByte(VK_RMENU), 0, KEYEVENTF_KEYDOWN, 0); PInvoke.keybd_event(Convert.ToByte(VK_LMENU), 0, KEYEVENTF_KEYDOWN, 0);
PInvoke.keybd_event(Convert.ToByte(VK_ENT), 0, KEYEVENTF_KEYDOWN, 0); PInvoke.keybd_event(Convert.ToByte(VK_ENT), 0, KEYEVENTF_KEYDOWN, 0);
Thread.Sleep(200); Thread.Sleep(200);
PInvoke.keybd_event(Convert.ToByte(VK_ENT), 0, KEYEVENTF_KEYUP, 0); PInvoke.keybd_event(Convert.ToByte(VK_ENT), 0, KEYEVENTF_KEYUP, 0);
PInvoke.keybd_event(Convert.ToByte(VK_RMENU), 0, KEYEVENTF_KEYUP, 0); PInvoke.keybd_event(Convert.ToByte(VK_LMENU), 0, KEYEVENTF_KEYUP, 0);
Thread.Sleep(200); Thread.Sleep(200);
} }