mirror of
https://github.com/hawkeye-stan/msfs-popout-panel-manager.git
synced 2024-11-22 05:40:11 +00:00
Version 3.3
This commit is contained in:
parent
d9597cf00b
commit
d9ed07937e
13 changed files with 167 additions and 94 deletions
|
@ -3,14 +3,9 @@
|
||||||
public enum ActionEvent
|
public enum ActionEvent
|
||||||
{
|
{
|
||||||
KEY_MASTER_BATTERY_SET,
|
KEY_MASTER_BATTERY_SET,
|
||||||
KEY_ALTERNATOR_ON,
|
|
||||||
KEY_ALTERNATOR_OFF,
|
|
||||||
KEY_ALTERNATOR_SET,
|
KEY_ALTERNATOR_SET,
|
||||||
|
|
||||||
KEY_AVIONICS_MASTER_SET,
|
KEY_AVIONICS_MASTER_SET,
|
||||||
KEY_AVIONICS_MASTER_1_ON,
|
KEY_AVIONICS_MASTER_2_SET
|
||||||
KEY_AVIONICS_MASTER_2_ON,
|
|
||||||
KEY_AVIONICS_MASTER_1_OFF,
|
|
||||||
KEY_AVIONICS_MASTER_2_OFF
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ namespace MSFSPopoutPanelManager.Model
|
||||||
|
|
||||||
public bool HideTitlebar { get; set; }
|
public bool HideTitlebar { get; set; }
|
||||||
|
|
||||||
|
public bool FullScreen { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool IsCustomPopout { get { return PanelType == PanelType.CustomPopout; } }
|
public bool IsCustomPopout { get { return PanelType == PanelType.CustomPopout; } }
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ namespace MSFSPopoutPanelManager.Model
|
||||||
Height,
|
Height,
|
||||||
AlwaysOnTop,
|
AlwaysOnTop,
|
||||||
HideTitlebar,
|
HideTitlebar,
|
||||||
|
FullScreen,
|
||||||
Invalid
|
Invalid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace MSFSPopoutPanelManager.Provider
|
||||||
const uint VK_LMENU = 0xA4;
|
const uint VK_LMENU = 0xA4;
|
||||||
const uint VK_LCONTROL = 0xA2;
|
const uint VK_LCONTROL = 0xA2;
|
||||||
const uint VK_SPACE = 0x20;
|
const uint VK_SPACE = 0x20;
|
||||||
|
const uint VK_ENT = 0x0D;
|
||||||
const uint KEY_0 = 0x30;
|
const uint KEY_0 = 0x30;
|
||||||
|
|
||||||
public static void LeftClick(int x, int y)
|
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);
|
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()
|
public static void LeftClickReadyToFly()
|
||||||
{
|
{
|
||||||
var simualatorProcess = DiagnosticManager.GetSimulatorProcess();
|
var simualatorProcess = DiagnosticManager.GetSimulatorProcess();
|
||||||
|
@ -132,8 +148,7 @@ namespace MSFSPopoutPanelManager.Provider
|
||||||
LeftClick(x, y);
|
LeftClick(x, y);
|
||||||
Thread.Sleep(250);
|
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
|
// For full screen mode
|
||||||
x = Convert.ToInt32(rectangle.X + (clientRectangle.Width) * 0.93);
|
x = Convert.ToInt32(rectangle.X + (clientRectangle.Width) * 0.93);
|
||||||
|
@ -144,8 +159,7 @@ namespace MSFSPopoutPanelManager.Provider
|
||||||
LeftClick(x, y);
|
LeftClick(x, y);
|
||||||
Thread.Sleep(250);
|
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}");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using MSFSPopoutPanelManager.Model;
|
using MSFSPopoutPanelManager.Model;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
@ -51,37 +50,47 @@ namespace MSFSPopoutPanelManager.Provider
|
||||||
|
|
||||||
if (panelConfig != null)
|
if (panelConfig != null)
|
||||||
{
|
{
|
||||||
switch (panelConfigItem.PanelConfigProperty)
|
if (panelConfigItem.PanelConfigProperty == PanelConfigPropertyName.FullScreen)
|
||||||
{
|
{
|
||||||
case PanelConfigPropertyName.PanelName:
|
InputEmulationManager.ToggleFullScreenPanel(panelConfig.PanelHandle);
|
||||||
var name = panelConfig.PanelName;
|
panelConfig.HideTitlebar = false;
|
||||||
if (name.IndexOf("(Custom)") == -1)
|
panelConfig.AlwaysOnTop = false;
|
||||||
name = name + " (Custom)";
|
}
|
||||||
PInvoke.SetWindowText(panelConfig.PanelHandle, name);
|
else if (panelConfigItem.PanelConfigProperty == PanelConfigPropertyName.PanelName)
|
||||||
break;
|
{
|
||||||
case PanelConfigPropertyName.Left:
|
var name = panelConfig.PanelName;
|
||||||
case PanelConfigPropertyName.Top:
|
if (name.IndexOf("(Custom)") == -1)
|
||||||
PInvoke.MoveWindow(panelConfig.PanelHandle, panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height, true);
|
name = name + " (Custom)";
|
||||||
break;
|
PInvoke.SetWindowText(panelConfig.PanelHandle, name);
|
||||||
case PanelConfigPropertyName.Width:
|
}
|
||||||
case PanelConfigPropertyName.Height:
|
else if(!panelConfig.FullScreen)
|
||||||
if (panelConfig.HideTitlebar)
|
{
|
||||||
WindowManager.ApplyHidePanelTitleBar(panelConfig.PanelHandle, false);
|
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;
|
int orignalLeft = panelConfig.Left;
|
||||||
PInvoke.MoveWindow(panelConfig.PanelHandle, panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height, true);
|
PInvoke.MoveWindow(panelConfig.PanelHandle, panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height, true);
|
||||||
MSFSBugPanelShiftWorkaround(panelConfig.PanelHandle, orignalLeft, panelConfig.Top, panelConfig.Width, panelConfig.Height);
|
MSFSBugPanelShiftWorkaround(panelConfig.PanelHandle, orignalLeft, panelConfig.Top, panelConfig.Width, panelConfig.Height);
|
||||||
|
|
||||||
if (panelConfig.HideTitlebar)
|
if (panelConfig.HideTitlebar)
|
||||||
WindowManager.ApplyHidePanelTitleBar(panelConfig.PanelHandle, true);
|
WindowManager.ApplyHidePanelTitleBar(panelConfig.PanelHandle, true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PanelConfigPropertyName.AlwaysOnTop:
|
case PanelConfigPropertyName.AlwaysOnTop:
|
||||||
WindowManager.ApplyAlwaysOnTop(panelConfig.PanelHandle, panelConfig.AlwaysOnTop, new Rectangle(panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height));
|
WindowManager.ApplyAlwaysOnTop(panelConfig.PanelHandle, panelConfig.AlwaysOnTop, new Rectangle(panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height));
|
||||||
break;
|
break;
|
||||||
case PanelConfigPropertyName.HideTitlebar:
|
case PanelConfigPropertyName.HideTitlebar:
|
||||||
WindowManager.ApplyHidePanelTitleBar(panelConfig.PanelHandle, panelConfig.HideTitlebar);
|
WindowManager.ApplyHidePanelTitleBar(panelConfig.PanelHandle, panelConfig.HideTitlebar);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_userProfileManager.WriteUserProfiles();
|
_userProfileManager.WriteUserProfiles();
|
||||||
|
@ -98,6 +107,11 @@ namespace MSFSPopoutPanelManager.Provider
|
||||||
if (index > -1)
|
if (index > -1)
|
||||||
{
|
{
|
||||||
var panelConfig = UserProfile.PanelConfigs[index];
|
var panelConfig = UserProfile.PanelConfigs[index];
|
||||||
|
|
||||||
|
// Cannot apply any other settings if panel is full screen mode
|
||||||
|
if (panelConfig.FullScreen)
|
||||||
|
return;
|
||||||
|
|
||||||
int orignalLeft = panelConfig.Left;
|
int orignalLeft = panelConfig.Left;
|
||||||
|
|
||||||
switch (panelConfigItem.PanelConfigProperty)
|
switch (panelConfigItem.PanelConfigProperty)
|
||||||
|
|
|
@ -3,7 +3,6 @@ using MSFSPopoutPanelManager.Shared;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -236,23 +235,34 @@ namespace MSFSPopoutPanelManager.Provider
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply locations
|
// Apply full screen (cannot combine with always on top or hide title bar
|
||||||
PInvoke.ShowWindow(panel.PanelHandle, PInvokeConstant.SW_RESTORE);
|
if (panel.FullScreen)
|
||||||
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));
|
WindowManager.MoveWindow(panel.PanelHandle, panel.Left, panel.Top);
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
InputEmulationManager.ToggleFullScreenPanel(panel.PanelHandle);
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// Apply hide title bar
|
|
||||||
if (panel.HideTitlebar)
|
|
||||||
{
|
{
|
||||||
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);
|
PInvoke.ShowWindow(panel.PanelHandle, PInvokeConstant.SW_RESTORE);
|
||||||
|
|
|
@ -69,11 +69,9 @@ namespace MSFSPopoutPanelManager.Provider
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
_simConnector.TransmitActionEvent(ActionEvent.KEY_ALTERNATOR_SET, 1);
|
_simConnector.TransmitActionEvent(ActionEvent.KEY_ALTERNATOR_SET, 1);
|
||||||
Thread.Sleep(100);
|
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);
|
_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)
|
if(_isPowerOnForPopOut)
|
||||||
{
|
{
|
||||||
_simConnector.TransmitActionEvent(ActionEvent.KEY_AVIONICS_MASTER_1_OFF, 1);
|
_simConnector.TransmitActionEvent(ActionEvent.KEY_AVIONICS_MASTER_2_SET, 0);
|
||||||
Thread.Sleep(100);
|
|
||||||
_simConnector.TransmitActionEvent(ActionEvent.KEY_AVIONICS_MASTER_2_OFF, 1);
|
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
_simConnector.TransmitActionEvent(ActionEvent.KEY_AVIONICS_MASTER_SET, 0);
|
_simConnector.TransmitActionEvent(ActionEvent.KEY_AVIONICS_MASTER_SET, 0);
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
|
|
|
@ -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 messageBoxMessage = "Application has encountered a critical error and will be closed.\nPlease see the file 'error.log' for information.";
|
||||||
var messageBoxButtons = MessageBoxButton.OK;
|
var messageBoxButtons = MessageBoxButton.OK;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (MessageBox.Show(messageBoxMessage, messageBoxTitle, messageBoxButtons) == MessageBoxResult.OK)
|
if (MessageBox.Show(messageBoxMessage, messageBoxTitle, messageBoxButtons) == MessageBoxResult.OK)
|
||||||
{
|
{
|
||||||
Application.Current.Shutdown();
|
Application.Current.Shutdown();
|
||||||
|
|
|
@ -91,10 +91,10 @@
|
||||||
</Style>
|
</Style>
|
||||||
</DataGrid.CellStyle>
|
</DataGrid.CellStyle>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTemplateColumn Header="Panel Name" Width="280" >
|
<DataGridTemplateColumn Header="Panel Name" Width="250" >
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<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}">
|
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>
|
<TextBox.Style>
|
||||||
<Style TargetType="TextBox">
|
<Style TargetType="TextBox">
|
||||||
|
@ -117,51 +117,82 @@
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTemplateColumn Header="X-Pos" Width="100">
|
<DataGridTemplateColumn Header="X-Pos" Width="90">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBox Name="Left" Width="100" BorderThickness="0" Text="{Binding Path=Left, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
|
<TextBox Name="Left" Width="90" BorderThickness="0"
|
||||||
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'}" />
|
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>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTemplateColumn Header="Y-Pos" Width="100">
|
<DataGridTemplateColumn Header="Width" Width="90">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBox Name="Top" Width="100" BorderThickness="0" Text="{Binding Path=Top, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
|
<TextBox Name="Width" Width="90" BorderThickness="0"
|
||||||
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'}" />
|
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>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTemplateColumn Header="Width" Width="100">
|
<DataGridTemplateColumn Header="Height" Width="90">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBox Name="Width" Width="100" BorderThickness="0" Text="{Binding Path=Width, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
|
<TextBox Name="Height" Width="90" BorderThickness="0"
|
||||||
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'}" />
|
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>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTemplateColumn Header="Height" Width="100">
|
<DataGridTemplateColumn Header="Always on Top" Width="90">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBox Name="Height" Width="100" BorderThickness="0" Text="{Binding Path=Height, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
|
<CheckBox Name="AlwaysOnTop" Width="90" Margin="40 0 0 0"
|
||||||
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'}" />
|
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>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTemplateColumn Header="Always on Top" Width="100">
|
<DataGridTemplateColumn Header="Hide Title Bar" Width="90">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<CheckBox Name="AlwaysOnTop" Width="100" Margin="40 0 0 0" IsChecked="{Binding Path=AlwaysOnTop, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
<CheckBox Name="HideTitlebar" Width="90" Margin="40 0 0 0"
|
||||||
SourceUpdated="GridData_SourceUpdated" IsEnabled="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='!DataContext.DataStore.ActiveUserProfile.IsLocked and DataContext.DataStore.AllowEdit'}"/>
|
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>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTemplateColumn Header="Hide Title Bar" Width="100">
|
<DataGridTemplateColumn Header="Full Screen Mode" Width="90">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<CheckBox Name="HideTitlebar" Width="100" Margin="40 0 0 0" IsChecked="{Binding Path=HideTitlebar, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
<CheckBox Name="FullScreen" Width="90" Margin="40 0 0 0"
|
||||||
SourceUpdated="GridData_SourceUpdated" IsEnabled="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='!DataContext.DataStore.ActiveUserProfile.IsLocked and DataContext.DataStore.AllowEdit'}"/>
|
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>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
|
|
|
@ -65,6 +65,9 @@ namespace MSFSPopoutPanelManager.WpfApp
|
||||||
case "Hide Titlebar":
|
case "Hide Titlebar":
|
||||||
selectedProperty = PanelConfigPropertyName.HideTitlebar;
|
selectedProperty = PanelConfigPropertyName.HideTitlebar;
|
||||||
break;
|
break;
|
||||||
|
case "Full Screen Mode":
|
||||||
|
selectedProperty = PanelConfigPropertyName.FullScreen;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_panelConfigurationViewModel.SelectedPanelConfigItem = new PanelConfigItem() { PanelIndex = panelConfig.PanelIndex, PanelConfigProperty = selectedProperty };
|
_panelConfigurationViewModel.SelectedPanelConfigItem = new PanelConfigItem() { PanelIndex = panelConfig.PanelIndex, PanelConfigProperty = selectedProperty };
|
||||||
|
|
|
@ -62,8 +62,12 @@
|
||||||
<Button Content="+" ToolTip="Add Profile" HorizontalAlignment="Left" Margin="10,0,0,0" Width="40" Click="AddProfile_Click" />
|
<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}"/>
|
<Button Content="-" ToolTip="Delete Profile" HorizontalAlignment="Left" Margin="10,0,0,0" Width="40" Click="DeleteProfile_Click" Style="{StaticResource ProfileSelectedDependency}"/>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
<Separator Margin="5,10,5,10"/>
|
<Separator Margin="5,10,5,5"/>
|
||||||
<Label Content="2. Optional: Bind active aircraft livery to profile to automatically pop out panels." HorizontalAlignment="Left" Margin="0,0,0,0" />
|
<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="Vertical" Margin="15,0,0,0" HorizontalAlignment="Left">
|
||||||
<WrapPanel Orientation="Horizontal" Margin="5,5,0,0" HorizontalAlignment="Left">
|
<WrapPanel Orientation="Horizontal" Margin="5,5,0,0" HorizontalAlignment="Left">
|
||||||
<Label Content="{c:Binding Path='DataStore.CurrentMsfsPlaneTitle == null ? "Active aircraft livery is unavailable" : DataStore.CurrentMsfsPlaneTitle'}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" FontStyle="Italic" Width="450">
|
<Label Content="{c:Binding Path='DataStore.CurrentMsfsPlaneTitle == null ? "Active aircraft livery is unavailable" : DataStore.CurrentMsfsPlaneTitle'}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" FontStyle="Italic" Width="450">
|
||||||
|
@ -84,14 +88,14 @@
|
||||||
</Style>
|
</Style>
|
||||||
</Label.Style>
|
</Label.Style>
|
||||||
</Label>
|
</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}"/>
|
<Button Content="-" ToolTip="Delete Binding" Margin="10,0,0,0" Width="40" Click="DeleteBinding_Click" Style="{StaticResource ProfileDeletePlaneBindingDependency}"/>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
<CheckBox Margin="10,5,0,0" IsChecked="{Binding Path=DataStore.ActiveUserProfile.PowerOnRequiredForColdStart}" IsEnabled="{Binding Path=DataStore.HasActiveUserProfileId}" Command="{Binding Path=SetPowerOnRequiredCommand}">
|
<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"/>
|
<TextBlock Text="Power on required to pop out panels on cold start" TextWrapping="Wrap" Margin="5,0,0,3"/>
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
</WrapPanel>
|
</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" />
|
<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="Vertical" Margin="20,0,0,0" HorizontalAlignment="Left">
|
||||||
<WrapPanel Orientation="Horizontal">
|
<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}"/>
|
<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>
|
||||||
</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" />
|
<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}"/>
|
<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>
|
</WrapPanel>
|
||||||
|
|
|
@ -94,15 +94,17 @@ namespace MSFSPopoutPanelManager.WpfApp
|
||||||
|
|
||||||
private void AddBinding_Click(object sender, RoutedEventArgs e)
|
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}");
|
//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.Owner = Application.Current.MainWindow;
|
||||||
dialog.Topmost = true;
|
//dialog.Topmost = true;
|
||||||
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
//dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||||
|
|
||||||
if ((bool)dialog.ShowDialog())
|
//if ((bool)dialog.ShowDialog())
|
||||||
{
|
//{
|
||||||
_panelSelectionViewModel.AddProfileBindingCommand.Execute(null);
|
// _panelSelectionViewModel.AddProfileBindingCommand.Execute(null);
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
_panelSelectionViewModel.AddProfileBindingCommand.Execute(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteBinding_Click(object sender, RoutedEventArgs e)
|
private void DeleteBinding_Click(object sender, RoutedEventArgs e)
|
||||||
|
|
|
@ -130,6 +130,7 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
|
||||||
OnAlwaysOnTopChanged(this, new EventArgs<bool>(DataStore.AppSetting.AlwaysOnTop));
|
OnAlwaysOnTopChanged(this, new EventArgs<bool>(DataStore.AppSetting.AlwaysOnTop));
|
||||||
|
|
||||||
// Activate auto pop out panels
|
// Activate auto pop out panels
|
||||||
|
_simConnectManager.OnFlightStopped += HandleOnFlightStopped;
|
||||||
if (DataStore.AppSetting.AutoPopOutPanels)
|
if (DataStore.AppSetting.AutoPopOutPanels)
|
||||||
ActivateAutoPanelPopOut();
|
ActivateAutoPanelPopOut();
|
||||||
|
|
||||||
|
@ -234,14 +235,12 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
|
||||||
private void ActivateAutoPanelPopOut()
|
private void ActivateAutoPanelPopOut()
|
||||||
{
|
{
|
||||||
_simConnectManager.OnFlightStarted += HandleOnFlightStarted;
|
_simConnectManager.OnFlightStarted += HandleOnFlightStarted;
|
||||||
_simConnectManager.OnFlightStopped += HandleOnFlightStopped;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeativateAutoPanelPopOut()
|
private void DeativateAutoPanelPopOut()
|
||||||
{
|
{
|
||||||
DataStore.IsEnteredFlight = false;
|
DataStore.IsEnteredFlight = false;
|
||||||
_simConnectManager.OnFlightStarted -= HandleOnFlightStarted;
|
_simConnectManager.OnFlightStarted -= HandleOnFlightStarted;
|
||||||
_simConnectManager.OnFlightStopped -= HandleOnFlightStopped;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleOnFlightStarted(object sender, EventArgs e)
|
private void HandleOnFlightStarted(object sender, EventArgs e)
|
||||||
|
|
Loading…
Reference in a new issue