1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-10-16 06:00:45 +00:00

Version 3.3

This commit is contained in:
hawkeye 2022-04-18 15:52:39 -04:00
parent d9597cf00b
commit d9ed07937e
13 changed files with 167 additions and 94 deletions

View file

@ -3,14 +3,9 @@
public enum ActionEvent
{
KEY_MASTER_BATTERY_SET,
KEY_ALTERNATOR_ON,
KEY_ALTERNATOR_OFF,
KEY_ALTERNATOR_SET,
KEY_AVIONICS_MASTER_SET,
KEY_AVIONICS_MASTER_1_ON,
KEY_AVIONICS_MASTER_2_ON,
KEY_AVIONICS_MASTER_1_OFF,
KEY_AVIONICS_MASTER_2_OFF
KEY_AVIONICS_MASTER_2_SET
}
}

View file

@ -26,6 +26,8 @@ namespace MSFSPopoutPanelManager.Model
public bool HideTitlebar { get; set; }
public bool FullScreen { get; set; }
[JsonIgnore]
public bool IsCustomPopout { get { return PanelType == PanelType.CustomPopout; } }

View file

@ -11,6 +11,7 @@ namespace MSFSPopoutPanelManager.Model
Height,
AlwaysOnTop,
HideTitlebar,
FullScreen,
Invalid
}

View file

@ -19,6 +19,7 @@ namespace MSFSPopoutPanelManager.Provider
const uint VK_LMENU = 0xA4;
const uint VK_LCONTROL = 0xA2;
const uint VK_SPACE = 0x20;
const uint VK_ENT = 0x0D;
const uint KEY_0 = 0x30;
public static void LeftClick(int x, int y)
@ -106,6 +107,21 @@ namespace MSFSPopoutPanelManager.Provider
PInvoke.keybd_event(Convert.ToByte(VK_LMENU), 0, KEYEVENTF_KEYUP, 0);
}
public static void ToggleFullScreenPanel(IntPtr hwnd)
{
PInvoke.SetForegroundWindow(hwnd);
Thread.Sleep(500);
PInvoke.SetFocus(hwnd);
Thread.Sleep(300);
PInvoke.keybd_event(Convert.ToByte(VK_RMENU), 0, KEYEVENTF_KEYDOWN, 0);
PInvoke.keybd_event(Convert.ToByte(VK_ENT), 0, KEYEVENTF_KEYDOWN, 0);
Thread.Sleep(200);
PInvoke.keybd_event(Convert.ToByte(VK_ENT), 0, KEYEVENTF_KEYUP, 0);
PInvoke.keybd_event(Convert.ToByte(VK_RMENU), 0, KEYEVENTF_KEYUP, 0);
}
public static void LeftClickReadyToFly()
{
var simualatorProcess = DiagnosticManager.GetSimulatorProcess();
@ -132,8 +148,7 @@ namespace MSFSPopoutPanelManager.Provider
LeftClick(x, y);
Thread.Sleep(250);
Debug.WriteLine($"Windows Mode 'Ready to Fly' button coordinate: {x}, {y}");
//Debug.WriteLine($"Windows Mode 'Ready to Fly' button coordinate: {x}, {y}");
// For full screen mode
x = Convert.ToInt32(rectangle.X + (clientRectangle.Width) * 0.93);
@ -144,8 +159,7 @@ namespace MSFSPopoutPanelManager.Provider
LeftClick(x, y);
Thread.Sleep(250);
Debug.WriteLine($"Full Screen Mode 'Ready to Fly' button coordinate: {x} , {y}");
//Debug.WriteLine($"Full Screen Mode 'Ready to Fly' button coordinate: {x} , {y}");
}
}
}

View file

@ -1,6 +1,5 @@
using MSFSPopoutPanelManager.Model;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
@ -51,37 +50,47 @@ namespace MSFSPopoutPanelManager.Provider
if (panelConfig != null)
{
switch (panelConfigItem.PanelConfigProperty)
if (panelConfigItem.PanelConfigProperty == PanelConfigPropertyName.FullScreen)
{
case PanelConfigPropertyName.PanelName:
var name = panelConfig.PanelName;
if (name.IndexOf("(Custom)") == -1)
name = name + " (Custom)";
PInvoke.SetWindowText(panelConfig.PanelHandle, name);
break;
case PanelConfigPropertyName.Left:
case PanelConfigPropertyName.Top:
PInvoke.MoveWindow(panelConfig.PanelHandle, panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height, true);
break;
case PanelConfigPropertyName.Width:
case PanelConfigPropertyName.Height:
if (panelConfig.HideTitlebar)
WindowManager.ApplyHidePanelTitleBar(panelConfig.PanelHandle, false);
InputEmulationManager.ToggleFullScreenPanel(panelConfig.PanelHandle);
panelConfig.HideTitlebar = false;
panelConfig.AlwaysOnTop = false;
}
else if (panelConfigItem.PanelConfigProperty == PanelConfigPropertyName.PanelName)
{
var name = panelConfig.PanelName;
if (name.IndexOf("(Custom)") == -1)
name = name + " (Custom)";
PInvoke.SetWindowText(panelConfig.PanelHandle, name);
}
else if(!panelConfig.FullScreen)
{
switch (panelConfigItem.PanelConfigProperty)
{
case PanelConfigPropertyName.Left:
case PanelConfigPropertyName.Top:
PInvoke.MoveWindow(panelConfig.PanelHandle, panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height, true);
break;
case PanelConfigPropertyName.Width:
case PanelConfigPropertyName.Height:
if (panelConfig.HideTitlebar)
WindowManager.ApplyHidePanelTitleBar(panelConfig.PanelHandle, false);
int orignalLeft = panelConfig.Left;
PInvoke.MoveWindow(panelConfig.PanelHandle, panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height, true);
MSFSBugPanelShiftWorkaround(panelConfig.PanelHandle, orignalLeft, panelConfig.Top, panelConfig.Width, panelConfig.Height);
int orignalLeft = panelConfig.Left;
PInvoke.MoveWindow(panelConfig.PanelHandle, panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height, true);
MSFSBugPanelShiftWorkaround(panelConfig.PanelHandle, orignalLeft, panelConfig.Top, panelConfig.Width, panelConfig.Height);
if (panelConfig.HideTitlebar)
WindowManager.ApplyHidePanelTitleBar(panelConfig.PanelHandle, true);
if (panelConfig.HideTitlebar)
WindowManager.ApplyHidePanelTitleBar(panelConfig.PanelHandle, true);
break;
case PanelConfigPropertyName.AlwaysOnTop:
WindowManager.ApplyAlwaysOnTop(panelConfig.PanelHandle, panelConfig.AlwaysOnTop, new Rectangle(panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height));
break;
case PanelConfigPropertyName.HideTitlebar:
WindowManager.ApplyHidePanelTitleBar(panelConfig.PanelHandle, panelConfig.HideTitlebar);
break;
break;
case PanelConfigPropertyName.AlwaysOnTop:
WindowManager.ApplyAlwaysOnTop(panelConfig.PanelHandle, panelConfig.AlwaysOnTop, new Rectangle(panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height));
break;
case PanelConfigPropertyName.HideTitlebar:
WindowManager.ApplyHidePanelTitleBar(panelConfig.PanelHandle, panelConfig.HideTitlebar);
break;
}
}
_userProfileManager.WriteUserProfiles();
@ -98,6 +107,11 @@ namespace MSFSPopoutPanelManager.Provider
if (index > -1)
{
var panelConfig = UserProfile.PanelConfigs[index];
// Cannot apply any other settings if panel is full screen mode
if (panelConfig.FullScreen)
return;
int orignalLeft = panelConfig.Left;
switch (panelConfigItem.PanelConfigProperty)

View file

@ -3,7 +3,6 @@ using MSFSPopoutPanelManager.Shared;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
@ -236,23 +235,34 @@ namespace MSFSPopoutPanelManager.Provider
Thread.Sleep(500);
}
// Apply locations
PInvoke.ShowWindow(panel.PanelHandle, PInvokeConstant.SW_RESTORE);
Thread.Sleep(250);
PInvoke.MoveWindow(panel.PanelHandle, panel.Left, panel.Top, panel.Width, panel.Height, false);
Thread.Sleep(1000);
// Apply always on top
if (panel.AlwaysOnTop)
// Apply full screen (cannot combine with always on top or hide title bar
if (panel.FullScreen)
{
WindowManager.ApplyAlwaysOnTop(panel.PanelHandle, true, new Rectangle(panel.Left, panel.Top, panel.Width, panel.Height));
WindowManager.MoveWindow(panel.PanelHandle, panel.Left, panel.Top);
Thread.Sleep(1000);
InputEmulationManager.ToggleFullScreenPanel(panel.PanelHandle);
Thread.Sleep(1000);
}
// Apply hide title bar
if (panel.HideTitlebar)
else
{
WindowManager.ApplyHidePanelTitleBar(panel.PanelHandle, true);
// Apply locations
PInvoke.ShowWindow(panel.PanelHandle, PInvokeConstant.SW_RESTORE);
Thread.Sleep(250);
PInvoke.MoveWindow(panel.PanelHandle, panel.Left, panel.Top, panel.Width, panel.Height, false);
Thread.Sleep(1000);
// Apply always on top
if (panel.AlwaysOnTop)
{
WindowManager.ApplyAlwaysOnTop(panel.PanelHandle, true, new Rectangle(panel.Left, panel.Top, panel.Width, panel.Height));
Thread.Sleep(1000);
}
// Apply hide title bar
if (panel.HideTitlebar)
{
WindowManager.ApplyHidePanelTitleBar(panel.PanelHandle, true);
}
}
PInvoke.ShowWindow(panel.PanelHandle, PInvokeConstant.SW_RESTORE);

View file

@ -69,11 +69,9 @@ namespace MSFSPopoutPanelManager.Provider
Thread.Sleep(100);
_simConnector.TransmitActionEvent(ActionEvent.KEY_ALTERNATOR_SET, 1);
Thread.Sleep(100);
_simConnector.TransmitActionEvent(ActionEvent.KEY_AVIONICS_MASTER_1_ON, 1);
Thread.Sleep(100);
_simConnector.TransmitActionEvent(ActionEvent.KEY_AVIONICS_MASTER_2_ON, 1);
Thread.Sleep(100);
_simConnector.TransmitActionEvent(ActionEvent.KEY_AVIONICS_MASTER_SET, 1);
Thread.Sleep(100);
_simConnector.TransmitActionEvent(ActionEvent.KEY_AVIONICS_MASTER_2_SET, 1);
}
}
@ -81,9 +79,7 @@ namespace MSFSPopoutPanelManager.Provider
{
if(_isPowerOnForPopOut)
{
_simConnector.TransmitActionEvent(ActionEvent.KEY_AVIONICS_MASTER_1_OFF, 1);
Thread.Sleep(100);
_simConnector.TransmitActionEvent(ActionEvent.KEY_AVIONICS_MASTER_2_OFF, 1);
_simConnector.TransmitActionEvent(ActionEvent.KEY_AVIONICS_MASTER_2_SET, 0);
Thread.Sleep(100);
_simConnector.TransmitActionEvent(ActionEvent.KEY_AVIONICS_MASTER_SET, 0);
Thread.Sleep(100);

View file

@ -76,6 +76,8 @@ namespace MSFSPopoutPanelManager.WpfApp
var messageBoxMessage = "Application has encountered a critical error and will be closed.\nPlease see the file 'error.log' for information.";
var messageBoxButtons = MessageBoxButton.OK;
if (MessageBox.Show(messageBoxMessage, messageBoxTitle, messageBoxButtons) == MessageBoxResult.OK)
{
Application.Current.Shutdown();

View file

@ -91,10 +91,10 @@
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTemplateColumn Header="Panel Name" Width="280" >
<DataGridTemplateColumn Header="Panel Name" Width="250" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Name="PanelName" Width="380" BorderThickness="0" TextAlignment="Left" Text="{Binding Path=PanelName, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
<TextBox Name="PanelName" Width="250" BorderThickness="0" TextAlignment="Left" Text="{Binding Path=PanelName, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
SourceUpdated="GridData_SourceUpdated" IsReadOnly="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='DataContext.DataStore.ActiveUserProfile.IsLocked or !DataContext.DataStore.AllowEdit'}" IsEnabled="{Binding Path=IsCustomPopout, Mode=OneWay}">
<TextBox.Style>
<Style TargetType="TextBox">
@ -117,51 +117,82 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="X-Pos" Width="100">
<DataGridTemplateColumn Header="X-Pos" Width="90">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Name="Left" Width="100" BorderThickness="0" Text="{Binding Path=Left, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
SourceUpdated="GridData_SourceUpdated" Style="{StaticResource TextBoxColumnFocus}" IsReadOnly="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='DataContext.DataStore.ActiveUserProfile.IsLocked or !DataContext.DataStore.AllowEdit'}" />
<TextBox Name="Left" Width="90" BorderThickness="0"
Text="{Binding Path=Left, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
SourceUpdated="GridData_SourceUpdated"
Style="{StaticResource TextBoxColumnFocus}"
IsReadOnly="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='DataContext.DataStore.ActiveUserProfile.IsLocked or !DataContext.DataStore.AllowEdit'}"
IsHitTestVisible="{c:Binding Path='!FullScreen'}"/> </DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Y-Pos" Width="90">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Name="Top" Width="90" BorderThickness="0"
Text="{Binding Path=Top, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
SourceUpdated="GridData_SourceUpdated"
Style="{StaticResource TextBoxColumnFocus}"
IsReadOnly="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='DataContext.DataStore.ActiveUserProfile.IsLocked or !DataContext.DataStore.AllowEdit'}"
IsHitTestVisible="{c:Binding Path='!FullScreen'}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Y-Pos" Width="100">
<DataGridTemplateColumn Header="Width" Width="90">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Name="Top" Width="100" BorderThickness="0" Text="{Binding Path=Top, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
SourceUpdated="GridData_SourceUpdated" Style="{StaticResource TextBoxColumnFocus}" IsReadOnly="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='DataContext.DataStore.ActiveUserProfile.IsLocked or !DataContext.DataStore.AllowEdit'}" />
<TextBox Name="Width" Width="90" BorderThickness="0"
Text="{Binding Path=Width, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
SourceUpdated="GridData_SourceUpdated"
Style="{StaticResource TextBoxColumnFocus}"
IsReadOnly="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='DataContext.DataStore.ActiveUserProfile.IsLocked or !DataContext.DataStore.AllowEdit'}"
IsHitTestVisible="{c:Binding Path='!FullScreen'}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Width" Width="100">
<DataGridTemplateColumn Header="Height" Width="90">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Name="Width" Width="100" BorderThickness="0" Text="{Binding Path=Width, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
SourceUpdated="GridData_SourceUpdated" Style="{StaticResource TextBoxColumnFocus}" IsReadOnly="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='DataContext.DataStore.ActiveUserProfile.IsLocked or !DataContext.DataStore.AllowEdit'}" />
<TextBox Name="Height" Width="90" BorderThickness="0"
Text="{Binding Path=Height, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
SourceUpdated="GridData_SourceUpdated"
Style="{StaticResource TextBoxColumnFocus}"
IsReadOnly="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='DataContext.DataStore.ActiveUserProfile.IsLocked or !DataContext.DataStore.AllowEdit'}"
IsHitTestVisible="{c:Binding Path='!FullScreen'}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Height" Width="100">
<DataGridTemplateColumn Header="Always on Top" Width="90">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Name="Height" Width="100" BorderThickness="0" Text="{Binding Path=Height, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
SourceUpdated="GridData_SourceUpdated" Style="{StaticResource TextBoxColumnFocus}" IsReadOnly="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='DataContext.DataStore.ActiveUserProfile.IsLocked or !DataContext.DataStore.AllowEdit'}" />
<CheckBox Name="AlwaysOnTop" Width="90" Margin="40 0 0 0"
SourceUpdated="GridData_SourceUpdated"
IsChecked="{Binding Path=AlwaysOnTop, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='!DataContext.DataStore.ActiveUserProfile.IsLocked and DataContext.DataStore.AllowEdit'}"
IsHitTestVisible="{c:Binding Path='!FullScreen'}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Always on Top" Width="100">
<DataGridTemplateColumn Header="Hide Title Bar" Width="90">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox Name="AlwaysOnTop" Width="100" Margin="40 0 0 0" IsChecked="{Binding Path=AlwaysOnTop, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
SourceUpdated="GridData_SourceUpdated" IsEnabled="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='!DataContext.DataStore.ActiveUserProfile.IsLocked and DataContext.DataStore.AllowEdit'}"/>
<CheckBox Name="HideTitlebar" Width="90" Margin="40 0 0 0"
SourceUpdated="GridData_SourceUpdated"
IsChecked="{Binding Path=HideTitlebar, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='!DataContext.DataStore.ActiveUserProfile.IsLocked and DataContext.DataStore.AllowEdit'}"
IsHitTestVisible="{c:Binding Path='!FullScreen'}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Hide Title Bar" Width="100">
<DataGridTemplateColumn Header="Full Screen Mode" Width="90">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox Name="HideTitlebar" Width="100" Margin="40 0 0 0" IsChecked="{Binding Path=HideTitlebar, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
SourceUpdated="GridData_SourceUpdated" IsEnabled="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='!DataContext.DataStore.ActiveUserProfile.IsLocked and DataContext.DataStore.AllowEdit'}"/>
<CheckBox Name="FullScreen" Width="90" Margin="40 0 0 0"
SourceUpdated="GridData_SourceUpdated"
IsChecked="{Binding Path=FullScreen, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='!DataContext.DataStore.ActiveUserProfile.IsLocked and DataContext.DataStore.AllowEdit'}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

View file

@ -65,6 +65,9 @@ namespace MSFSPopoutPanelManager.WpfApp
case "Hide Titlebar":
selectedProperty = PanelConfigPropertyName.HideTitlebar;
break;
case "Full Screen Mode":
selectedProperty = PanelConfigPropertyName.FullScreen;
break;
}
_panelConfigurationViewModel.SelectedPanelConfigItem = new PanelConfigItem() { PanelIndex = panelConfig.PanelIndex, PanelConfigProperty = selectedProperty };

View file

@ -62,8 +62,12 @@
<Button Content="+" ToolTip="Add Profile" HorizontalAlignment="Left" Margin="10,0,0,0" Width="40" Click="AddProfile_Click" />
<Button Content="-" ToolTip="Delete Profile" HorizontalAlignment="Left" Margin="10,0,0,0" Width="40" Click="DeleteProfile_Click" Style="{StaticResource ProfileSelectedDependency}"/>
</WrapPanel>
<Separator Margin="5,10,5,10"/>
<Label Content="2. Optional: Bind active aircraft livery to profile to automatically pop out panels." HorizontalAlignment="Left" Margin="0,0,0,0" />
<Separator Margin="5,10,5,5"/>
<Label HorizontalAlignment="Left" Margin="0,0,0,0" >
<TextBlock TextWrapping="WrapWithOverflow">
2. Bind active aircraft livery to the selected profile to automatically activate profile and to automatically pop out panels when a flight session starts.
</TextBlock>
</Label>
<WrapPanel Orientation="Vertical" Margin="15,0,0,0" HorizontalAlignment="Left">
<WrapPanel Orientation="Horizontal" Margin="5,5,0,0" HorizontalAlignment="Left">
<Label Content="{c:Binding Path='DataStore.CurrentMsfsPlaneTitle == null ? &quot;Active aircraft livery is unavailable&quot; : DataStore.CurrentMsfsPlaneTitle'}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" FontStyle="Italic" Width="450">
@ -84,14 +88,14 @@
</Style>
</Label.Style>
</Label>
<Button Content="+" ToolTip="Add Bidning" Margin="10,0,0,0" Width="40" Click="AddBinding_Click" Style="{StaticResource ProfileAddPlaneBindingDependency}"/>
<Button Content="+" ToolTip="Add Binding" Margin="10,0,0,0" Width="40" Click="AddBinding_Click" Style="{StaticResource ProfileAddPlaneBindingDependency}"/>
<Button Content="-" ToolTip="Delete Binding" Margin="10,0,0,0" Width="40" Click="DeleteBinding_Click" Style="{StaticResource ProfileDeletePlaneBindingDependency}"/>
</WrapPanel>
<CheckBox Margin="10,5,0,0" IsChecked="{Binding Path=DataStore.ActiveUserProfile.PowerOnRequiredForColdStart}" IsEnabled="{Binding Path=DataStore.HasActiveUserProfileId}" Command="{Binding Path=SetPowerOnRequiredCommand}">
<TextBlock Text="Power on required to pop out panels on cold start" TextWrapping="Wrap" Margin="5,0,0,3"/>
</CheckBox>
</WrapPanel>
<Separator Margin="5,10,5,10"/>
<Separator Margin="5,10,5,5"/>
<Label Content="3. Identify pop out panel locations in the game by clicking on them." Margin="0,0,0,0" />
<WrapPanel Orientation="Vertical" Margin="20,0,0,0" HorizontalAlignment="Left">
<WrapPanel Orientation="Horizontal">
@ -112,7 +116,7 @@
<Button Content="Save Auto Panning Camera" HorizontalAlignment="Left" Margin="20,0,0,0" IsEnabled="{c:Binding Path='DataStore.HasActiveUserProfileId and DataStore.IsFlightActive'}" Width="215" Click="SaveAutoPanningCamera_Click" Style="{StaticResource ProfileSelectedDependency}"/>
</WrapPanel>
</WrapPanel>
<Separator Margin="5,10,5,10"/>
<Separator Margin="5,10,5,5"/>
<Label Content="4. Start the pop out process for selected panels." Margin="0,0,0,0" />
<Button Content="Start Pop Out" HorizontalAlignment="Left" Margin="20,5,0,0" Width="130" IsEnabled="{c:Binding Path='DataStore.HasActiveUserProfileId and DataStore.IsFlightActive'}" Command="{Binding Path=StartPopOutCommand}" Style="{StaticResource ProfileSelectedDependency}"/>
</WrapPanel>

View file

@ -94,15 +94,17 @@ namespace MSFSPopoutPanelManager.WpfApp
private void AddBinding_Click(object sender, RoutedEventArgs e)
{
ConfirmationDialog dialog = new ConfirmationDialog("Confirm Add Binding", $"Are you sure you want to bind the aircraft livery below to the active profile? \n{_panelSelectionViewModel.DataStore.CurrentMsfsPlaneTitle}");
dialog.Owner = Application.Current.MainWindow;
dialog.Topmost = true;
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
//ConfirmationDialog dialog = new ConfirmationDialog("Confirm Add Binding", $"Are you sure you want to bind the aircraft livery below to the active profile? \n{_panelSelectionViewModel.DataStore.CurrentMsfsPlaneTitle}");
//dialog.Owner = Application.Current.MainWindow;
//dialog.Topmost = true;
//dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
if ((bool)dialog.ShowDialog())
{
_panelSelectionViewModel.AddProfileBindingCommand.Execute(null);
}
//if ((bool)dialog.ShowDialog())
//{
// _panelSelectionViewModel.AddProfileBindingCommand.Execute(null);
//}
_panelSelectionViewModel.AddProfileBindingCommand.Execute(null);
}
private void DeleteBinding_Click(object sender, RoutedEventArgs e)

View file

@ -130,6 +130,7 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
OnAlwaysOnTopChanged(this, new EventArgs<bool>(DataStore.AppSetting.AlwaysOnTop));
// Activate auto pop out panels
_simConnectManager.OnFlightStopped += HandleOnFlightStopped;
if (DataStore.AppSetting.AutoPopOutPanels)
ActivateAutoPanelPopOut();
@ -234,14 +235,12 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
private void ActivateAutoPanelPopOut()
{
_simConnectManager.OnFlightStarted += HandleOnFlightStarted;
_simConnectManager.OnFlightStopped += HandleOnFlightStopped;
}
private void DeativateAutoPanelPopOut()
{
DataStore.IsEnteredFlight = false;
_simConnectManager.OnFlightStarted -= HandleOnFlightStarted;
_simConnectManager.OnFlightStopped -= HandleOnFlightStopped;
}
private void HandleOnFlightStarted(object sender, EventArgs e)