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

Started development v3.4.2

This commit is contained in:
Stanley 2022-08-08 02:07:24 -04:00
parent c16b3fefaf
commit bfb2a72a20
21 changed files with 328 additions and 204 deletions

View file

@ -177,6 +177,9 @@ namespace MSFSPopoutPanelManager.Orchestration
private void HookWinEvent()
{
if (ActiveProfile == null || ActiveProfile.PanelConfigs == null || ActiveProfile.PanelConfigs.Count == 0)
return;
// Setup panel config event hooks
_winEventHook = PInvoke.SetWinEventHook(PInvokeConstant.EVENT_SYSTEM_MOVESIZEEND, PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE, IntPtr.Zero, _winEvent, 0, 0, PInvokeConstant.WINEVENT_OUTOFCONTEXT);
}
@ -193,19 +196,9 @@ namespace MSFSPopoutPanelManager.Orchestration
{
case PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE:
case PInvokeConstant.EVENT_SYSTEM_MOVESIZEEND:
case PInvokeConstant.EVENT_SYSTEM_CAPTURESTART:
case PInvokeConstant.EVENT_SYSTEM_CAPTUREEND:
// check by priority to speed up comparing of escaping constraints
if (hwnd == IntPtr.Zero
|| idObject != 0
|| hWinEventHook != _winEventHook
|| !AllowEdit
|| ActiveProfile == null
|| ActiveProfile.PanelConfigs == null
|| ActiveProfile.PanelConfigs.Count == 0)
{
if (hwnd == IntPtr.Zero || idObject != 0 || hWinEventHook != _winEventHook || !AllowEdit)
return;
}
HandleEventCallback(hwnd, iEvent);
break;
@ -234,7 +227,6 @@ namespace MSFSPopoutPanelManager.Orchestration
WindowActionManager.MoveWindow(panelConfig.PanelHandle, panelConfig.PanelType, panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height);
break;
case PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE:
// Detect if window is maximized, if so, save settings
WINDOWPLACEMENT wp = new WINDOWPLACEMENT();
wp.length = System.Runtime.InteropServices.Marshal.SizeOf(wp);
PInvoke.GetWindowPlacement(hwnd, ref wp);

View file

@ -33,7 +33,7 @@ namespace MSFSPopoutPanelManager.Orchestration
private AppSetting AppSetting { get { return AppSettingData == null ? null : AppSettingData.AppSetting; } }
public event EventHandler OnPopOutStarted;
public event EventHandler OnPopOutCompleted;
public event EventHandler<bool> OnPopOutCompleted;
public event EventHandler<TouchPanelOpenEventArg> OnTouchPanelOpened;
public void ManualPopOut()
@ -188,7 +188,7 @@ namespace MSFSPopoutPanelManager.Orchestration
if (panelConfigs.Count == 0)
{
OnPopOutCompleted?.Invoke(this, null);
OnPopOutCompleted?.Invoke(this, false);
StatusMessageWriter.WriteMessage("No panels have been found. Please select at least one in-game panel.", StatusMessageType.Error, false);
return;
}
@ -204,19 +204,21 @@ namespace MSFSPopoutPanelManager.Orchestration
}
}
if (panelConfigs.Count > 0 || ActiveProfile.PanelConfigs.Count > 0)
if (panelConfigs.Count > 0)
{
if (ActiveProfile.PanelConfigs.Count > 0)
{
LoadAndApplyPanelConfigs(panelConfigs);
ActiveProfile.PanelConfigs = new ObservableCollection<PanelConfig>(panelConfigs);
StatusMessageWriter.WriteMessage("Panels have been popped out succesfully and saved panel settings have been applied.", StatusMessageType.Info, true);
OnPopOutCompleted?.Invoke(this, null);
OnPopOutCompleted?.Invoke(this, false);
}
else
{
ActiveProfile.PanelConfigs = new ObservableCollection<PanelConfig>(panelConfigs);
StatusMessageWriter.WriteMessage("Panels have been popped out succesfully.", StatusMessageType.Info, true);
OnPopOutCompleted?.Invoke(this, null);
OnPopOutCompleted?.Invoke(this, true);
}
}
}

View file

@ -19,7 +19,8 @@
FullScreen,
TouchEnabled,
DisableGameRefocus,
RowHeader,
None,
Invalid,
RowHeader
}
}

View file

@ -20,6 +20,7 @@ namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
private bool _isUsedArduino;
private CommandAction _lastCommandAction;
private int _repeatCommandActionCount;
private bool _isExecutingCommand;
private SimConnectEncoderAction _currentSimConnectEncoderAction;
private System.Timers.Timer _actionExecutionTimer;
@ -63,6 +64,8 @@ namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
if (_isSimConnected && actionData.Action != null)
{
_isExecutingCommand = true;
try
{
if (actionData.Action == "NO_ACTION") return;
@ -106,13 +109,17 @@ namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
Task.Run(() =>
{
Thread.Sleep(500);
InputEmulationManager.LeftClickGameWindow();
if (!_isExecutingCommand)
{
InputEmulationManager.RefocusGameWindow();
}
});
}
break;
}
ExecuteCommand(commandAction);
_isExecutingCommand = false;
}
catch (Exception ex)
{
@ -203,11 +210,5 @@ namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
break;
}
}
private void RefocusMsfs()
{
Thread.Sleep(250);
InputEmulationManager.LeftClickGameWindow();
}
}
}

View file

@ -14,6 +14,7 @@ namespace MSFSPopoutPanelManager.UserDataAgent
MinimizeToTray = false;
AlwaysOnTop = true;
UseAutoPanning = true;
MinimizeAfterPopOut = false;
AutoPanningKeyBinding = "0";
StartMinimized = false;
AutoDisableTrackIR = true;
@ -22,6 +23,7 @@ namespace MSFSPopoutPanelManager.UserDataAgent
UseLeftRightControlToPopOut = false;
IsEnabledTouchPanelServer = false;
AfterPopOutCameraView = new AfterPopOutCameraView();
AfterPopOutCameraView.PropertyChanged += (source, e) =>
{
@ -54,6 +56,8 @@ namespace MSFSPopoutPanelManager.UserDataAgent
public bool UseAutoPanning { get; set; }
public bool MinimizeAfterPopOut { get; set; }
public string AutoPanningKeyBinding { get; set; }
public bool StartMinimized { get; set; }

View file

@ -8,7 +8,9 @@
* Implemented work around for SU10+ issue where after panel separation, the panel's size is huge which blocked most of the game window for lower resolution screen and prevented Pop Out Panel Manager from popping out the next panel.
* Implement key binding to move and resize pop out
* Implement key binding to move and resize pop outs.
* Added setting to minimize pop out manager after panels have been popped out.
Known issue:

View file

@ -191,5 +191,18 @@ namespace MSFSPopoutPanelManager.WindowsAgent
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 RefocusGameWindow()
{
var simualatorProcess = WindowProcessManager.GetSimulatorProcess();
if (simualatorProcess == null)
return;
var rectangle = WindowActionManager.GetWindowRect(simualatorProcess.Handle);
var clientRectangle = WindowActionManager.GetClientRect(simualatorProcess.Handle);
PInvoke.SetCursorPos(rectangle.X + clientRectangle.Width / 2, rectangle.Y + clientRectangle.Height / 2);
}
}
}

View file

@ -16,9 +16,6 @@ namespace MSFSPopoutPanelManager.WindowsAgent
public const int SW_MINIMIZE = 6;
public const int SW_RESTORE = 9;
public const uint EVENT_SYSTEM_CAPTURESTART = 0x0008;
public const uint EVENT_SYSTEM_CAPTUREEND = 0x0009;
public const uint EVENT_SYSTEM_MOVESIZESTART = 0x000A;
public const uint EVENT_SYSTEM_MOVESIZEEND = 0x000B;
public const uint EVENT_OBJECT_LOCATIONCHANGE = 0x800B;

View file

@ -45,8 +45,7 @@ namespace MSFSPopoutPanelManager.WindowsAgent
{
ProcessId = process.Id,
ProcessName = process.ProcessName,
Handle = process.MainWindowHandle,
MainModule = process.MainModule
Handle = process.MainWindowHandle
};
}
}
@ -62,7 +61,5 @@ namespace MSFSPopoutPanelManager.WindowsAgent
public string ProcessName { get; set; }
public IntPtr Handle { get; set; }
public ProcessModule MainModule { get; set; }
}
}

View file

@ -0,0 +1,46 @@
<mah:MetroWindow x:Class="MSFSPopoutPanelManager.WpfApp.PanelConfigurationInstructionDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
mc:Ignorable="d"
Title="Keyboard Shortcuts"
Height="700"
Width="900"
ResizeMode="NoResize"
Background="Transparent">
<Grid Margin="20,10,20,0">
<WrapPanel>
<TextBlock Margin="0,10,0,10">To configure a panel, first click on the arrow to the left of the panel name. When panel is selected, the arrow will turn red.</TextBlock>
<TextBlock>
<Run Foreground="LightSkyBlue">Up Arrow</Run> - Move panel up by 10 pixels<LineBreak/>
<Run Foreground="LightSkyBlue">Down Arrow</Run> - Move panel down by 10 pixels<LineBreak/>
<Run Foreground="LightSkyBlue">Left Arrow</Run> - Move panel left by 10 pixels<LineBreak/>
<Run Foreground="LightSkyBlue">Right Arrow</Run> - Move panel right by 10 pixels<LineBreak/><LineBreak/>
<Run Foreground="LightSkyBlue">Shift + Up Arrow</Run> - Move panel up by 1 pixel<LineBreak/>
<Run Foreground="LightSkyBlue">Shift + Down Arrow</Run> - Move panel down by 1 pixel<LineBreak/>
<Run Foreground="LightSkyBlue">Shift + Left Arrow</Run> - Move panel left by 1 pixel<LineBreak/>
<Run Foreground="LightSkyBlue">Shift + Right Arrow</Run> - Move panel right by 1 pixel<LineBreak/><LineBreak/>
<Run Foreground="LightSkyBlue">Ctrl + Up Arrow</Run> - Decrease height by 10 pixels<LineBreak/>
<Run Foreground="LightSkyBlue">Ctrl + Down Arrow</Run> - Increase height by 10 pixels<LineBreak/>
<Run Foreground="LightSkyBlue">Ctrl + Left Arrow</Run> - Decrease width by 10 pixels<LineBreak/>
<Run Foreground="LightSkyBlue">Ctrl + Right Arrow</Run> - Increase width by 10 pixels<LineBreak/><LineBreak/>
<Run Foreground="LightSkyBlue">Shift + Ctrl + Up Arrow</Run> - Decrease height by 1 pixel<LineBreak/>
<Run Foreground="LightSkyBlue">Shift + Ctrl + Down Arrow</Run> - Increase height by 1 pixel<LineBreak/>
<Run Foreground="LightSkyBlue">Shift + Ctrl + Left Arrow</Run> - Decrease width by 1 pixel<LineBreak/>
<Run Foreground="LightSkyBlue">Shift + Ctrl + Right Arrow</Run> - Increase width by 1 pixel<LineBreak/>
</TextBlock>
<TextBlock Margin="0,10,0,10">To change value for X-Pos, Y-Pos, width, or height individually, first click on grid cell of the property you want to change.</TextBlock>
<TextBlock>
<Run Foreground="LightSkyBlue">Up Arrow</Run> - Increase value by 10 pixels<LineBreak/>
<Run Foreground="LightSkyBlue">Down Arrow</Run> - Decrease value by 10 pixels<LineBreak/>
<Run Foreground="LightSkyBlue">Shift + Up Arrow</Run> - Increase value by 1 pixel<LineBreak/>
<Run Foreground="LightSkyBlue">Shift + Down Arrow</Run> - Decrease value by 1 pixel<LineBreak/>
</TextBlock>
</WrapPanel>
</Grid>
</mah:MetroWindow>

View file

@ -0,0 +1,12 @@
using MahApps.Metro.Controls;
namespace MSFSPopoutPanelManager.WpfApp
{
public partial class PanelConfigurationInstructionDialog : MetroWindow
{
public PanelConfigurationInstructionDialog()
{
InitializeComponent();
}
}
}

View file

@ -6,7 +6,7 @@
xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
mc:Ignorable="d"
Title="Preferences"
Height="670"
Height="700"
Width="900"
ResizeMode="NoResize"
Background="Transparent">
@ -65,30 +65,31 @@
<TreeViewItem Header="Touch Settings" Selected="TreeViewItem_Selected" Margin="0,0,0,10"></TreeViewItem>
<TreeViewItem Header="MSFS Touch Panel Settings" Selected="TreeViewItem_Selected" Margin="0,0,0,10" Visibility="{Binding Path=AppSettingData.AppSetting.IsEnabledTouchPanelServer, Converter={StaticResource VisibleIfTrueConverter}, Mode=OneWay}"></TreeViewItem>
</TreeView>
<WrapPanel DockPanel.Dock="Right" Margin="20,10,20,0">
<WrapPanel DockPanel.Dock="Right" Margin="20,10,0,0">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<WrapPanel Orientation="Vertical" Visibility="{Binding ApplicationSettingsVisible, Converter={StaticResource VisibleIfTrueConverter}, Mode=OneWay}">
<WrapPanel Orientation="Vertical" Width="Auto" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Width="Auto" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Always on Top</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<CheckBox IsChecked="{Binding AppSettingData.AppSetting.AlwaysOnTop, Mode=TwoWay}">
<AccessText>Pin the application on top of all open windows.</AccessText>
</CheckBox>
</WrapPanel>
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Auto Start</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<CheckBox IsChecked="{Binding AppSettingData.AppSetting.AutoStart, Mode=TwoWay}" >
<AccessText TextWrapping="Wrap">Enable auto start application when MSFS starts. This adds a XML config entry in EXE.xml file.</AccessText>
</CheckBox>
</WrapPanel>
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Minimize to Tray</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<CheckBox IsChecked="{Binding AppSettingData.AppSetting.MinimizeToTray, Mode=TwoWay}" >
<AccessText TextWrapping="Wrap">Minimize the application to system tray.</AccessText>
</CheckBox>
</WrapPanel>
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Start Minimized</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<CheckBox IsChecked="{Binding AppSettingData.AppSetting.StartMinimized, Mode=TwoWay}" >
@ -96,9 +97,10 @@
</CheckBox>
</WrapPanel>
</WrapPanel>
</ScrollViewer>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<WrapPanel Orientation="Vertical" Visibility="{Binding PopOutSettingsVisible, Converter={StaticResource VisibleIfTrueConverter}, Mode=OneWay}">
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<WrapPanel Orientation="Vertical">
<TextBlock Style="{StaticResource TextBlockHeading}">Enable Auto Panning</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
@ -131,8 +133,16 @@
</WrapPanel>
</WrapPanel>
</WrapPanel>
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Minimize Pop Out Panel Manager After Pop Out</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<WrapPanel>
<CheckBox IsChecked="{Binding AppSettingData.AppSetting.MinimizeAfterPopOut, Mode=TwoWay}">
<AccessText Margin="10,0,0,0" Width="510">Minimize Pop Out Panel Manager after pop out. When creating a new profile and during initial pop out, this setting has no effect.</AccessText>
</CheckBox>
</WrapPanel>
</WrapPanel>
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<WrapPanel Orientation="Vertical">
<TextBlock Style="{StaticResource TextBlockHeading}">Enable Return to Predefined Camera View After Pop Out</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
@ -178,7 +188,7 @@
</WrapPanel>
</WrapPanel>
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">On Screen Message Dialog Duration</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<WrapPanel>
@ -187,7 +197,7 @@
</WrapPanel>
</WrapPanel>
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Use Left Control + Right Control to Pop Out Panel (SU 10+ option)</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<WrapPanel>
@ -198,9 +208,10 @@
</WrapPanel>
</WrapPanel>
</WrapPanel>
</ScrollViewer>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<WrapPanel Orientation="Vertical" Visibility="{Binding AutoPopOutSettingsVisible, Converter={StaticResource VisibleIfTrueConverter}, Mode=OneWay}">
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Enable Auto Pop Out Panels</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<CheckBox IsChecked="{Binding AppSettingData.AppSetting.AutoPopOutPanels, Mode=TwoWay}" >
@ -217,9 +228,11 @@
</AccessText>
</WrapPanel>
</WrapPanel>
</ScrollViewer>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<WrapPanel Orientation="Vertical" Visibility="{Binding TrackIRSettingsVisible, Converter={StaticResource VisibleIfTrueConverter}, Mode=OneWay}">
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Auto Disable Track IR</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<CheckBox IsChecked="{Binding AppSettingData.AppSetting.AutoDisableTrackIR, Mode=TwoWay}" >
@ -227,9 +240,11 @@
</CheckBox>
</WrapPanel>
</WrapPanel>
</ScrollViewer>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<WrapPanel Orientation="Vertical" Visibility="{Binding TouchSettingsVisible, Converter={StaticResource VisibleIfTrueConverter}, Mode=OneWay}">
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Refocus Game Window</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<CheckBox IsChecked="{Binding AppSettingData.AppSetting.TouchScreenSettings.RefocusGameWindow, Mode=TwoWay}" >
@ -240,7 +255,7 @@
<AccessText Margin="10,0,0,0" Width="490">Amount of time in milliseconds to wait for touch inactivity before input focus goes back to game window.</AccessText>
</WrapPanel>
</WrapPanel>
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Touch Down Touch Up Delay</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<WrapPanel>
@ -254,9 +269,10 @@
</WrapPanel>
</WrapPanel>
</WrapPanel>
</ScrollViewer>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<WrapPanel Orientation="Vertical" Visibility="{Binding MSFSTouchPanelSettingsVisible, Converter={StaticResource VisibleIfTrueConverter}, Mode=OneWay}">
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Enable Touch Panel Integration (Experimental Feature - Unsupported)</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<CheckBox IsChecked="{Binding AppSettingData.AppSetting.TouchPanelSettings.EnableTouchPanelIntegration, Mode=TwoWay}" >
@ -268,21 +284,21 @@
<TextBlock FontStyle="Italic">
Restart is require for all changes below to take effect.
</TextBlock>
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Enable Use of Arduino</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<CheckBox IsChecked="{Binding AppSettingData.AppSetting.TouchPanelSettings.UseArduino, Mode=TwoWay}" >
<AccessText TextWrapping="Wrap">Use of Arduino encoders to control touch panel.</AccessText>
</CheckBox>
</WrapPanel>
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Enable Sound</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<CheckBox IsChecked="{Binding AppSettingData.AppSetting.TouchPanelSettings.EnableSound, Mode=TwoWay}" >
<AccessText TextWrapping="Wrap">Enable playing of button click sound when using touch panel.</AccessText>
</CheckBox>
</WrapPanel>
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Data Refresh Interval</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<WrapPanel>
@ -290,7 +306,7 @@
<AccessText Margin="10,0,0,0" Width="490">Time interval for touch panel to refresh SimConnect data. (Default: 200 miliseconds)</AccessText>
</WrapPanel>
</WrapPanel>
<WrapPanel Orientation="Vertical" Margin="0,0,0,20">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Map Refresh Interval</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/>
<WrapPanel>
@ -300,7 +316,7 @@
</WrapPanel>
</WrapPanel>
</WrapPanel>
</ScrollViewer>
<WrapPanel Orientation="Vertical" Visibility="Visible">
</WrapPanel>
</WrapPanel>

View file

@ -10,7 +10,8 @@
Height="450"
Width="800"
WindowStyle="None"
AllowsTransparency="True">
AllowsTransparency="True"
Closing="Window_Closing">
<Window.Background>
<SolidColorBrush Color="#FFF0F0F0" Opacity="0.01" />
</Window.Background>

View file

@ -38,6 +38,11 @@ namespace MSFSPopoutPanelManager.WpfApp
{
webView.Source = new Uri($"{Constants.WEB_HOST_URI}/{_planeId.ToLower()}/{_panelId.ToLower()}");
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
webView.Dispose();
}
}
internal static class WindowExtensions

View file

@ -1,6 +1,7 @@
<UserControl x:Class="MSFSPopoutPanelManager.WpfApp.UserControlPanelConfiguration"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@ -36,10 +37,14 @@
<WrapPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="19,10,0,0" HorizontalAlignment="Left">
<Label Content="Panel Locations and Settings -" Margin="0,0,0,0" HorizontalAlignment="Left"/>
<Label Content="{Binding ProfileData.ActiveProfile.ProfileName}" Margin="0,0,0,0" HorizontalAlignment="Left"/>
<controls:Tile Foreground="LightSkyBlue" Background="Transparent" HorizontalAlignment="Right" VerticalAlignment="Center" Width="30" Height="30"
controls:ControlsHelper.MouseOverBorderBrush="{DynamicResource MahApps.Brushes.Button.Border}" Margin="565,0,0,0" Click="Instruction_Click" >
<iconPacks:PackIconMaterial Width="22" Height="22" Kind="Information" VerticalAlignment="Center"></iconPacks:PackIconMaterial>
</controls:Tile>
<DataGrid Name="PanelConfigGrid" HorizontalAlignment="Center" Width="882" Height="430" Margin="0 10 0 0" AutoGenerateColumns="False" CanUserResizeColumns="False" HorizontalScrollBarVisibility="Disabled"
CanUserReorderColumns="False" CanUserResizeRows="False" HorizontalGridLinesBrush="#B9B9B9" VerticalGridLinesBrush="#B9B9B9" GridLinesVisibility="Horizontal" SelectionUnit="Cell"
BorderThickness="1" CanUserAddRows="False" CanUserSortColumns="False" KeyboardNavigation.TabNavigation="None" KeyboardNavigation.IsTabStop="False"
ItemsSource="{Binding ProfileData.ActiveProfile.PanelConfigs}" HeadersVisibility="Column" KeyboardNavigation.DirectionalNavigation="Local">
ItemsSource="{Binding ProfileData.ActiveProfile.PanelConfigs}" HeadersVisibility="Column" KeyboardNavigation.DirectionalNavigation="Local" MouseDown="PanelConfigGrid_MouseDown">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="{x:Null}" />

View file

@ -173,7 +173,17 @@ namespace MSFSPopoutPanelManager.WpfApp
break;
}
}
private void Instruction_Click(object sender, RoutedEventArgs e)
{
DialogHelper.PanelConfigurationInstructionDialog();
}
private void PanelConfigGrid_MouseDown(object sender, MouseButtonEventArgs e)
{
_panelConfigurationViewModel.SelectedPanelConfigItem = null;
this.PanelConfigGrid.Focus();
}
}
}

View file

@ -32,7 +32,8 @@
ItemsSource="{Binding Source={StaticResource UserProfilesViewSource}}"
SelectedItem="{Binding Path=ProfileData.ActiveProfile, Mode=OneWay}"
DisplayMemberPath="ProfileName"
SelectedValuePath="ProfileId">
SelectedValuePath="ProfileId"
IsEnabled="{c:Binding 'FlightSimData.IsSimulatorStarted and FlightSimData.HasCurrentMsfsAircraft'}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding ChangeProfileCommand}" CommandParameter="{Binding ElementName=cmbProfile, Path=SelectedValue}" />

View file

@ -8,7 +8,7 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
{
public static bool ConfirmDialog(string title, string message)
{
ConfirmationDialog dialog = new ConfirmationDialog(title, message);
var dialog = new ConfirmationDialog(title, message);
dialog.Owner = Application.Current.MainWindow;
dialog.Topmost = true;
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
@ -18,7 +18,7 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
public static AddProfileDialogResult AddProfileDialog(List<Profile> profiles)
{
AddProfileDialog dialog = new AddProfileDialog(profiles);
var dialog = new AddProfileDialog(profiles);
dialog.Owner = Application.Current.MainWindow;
dialog.Topmost = true;
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
@ -33,7 +33,16 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
public static void PreferencesDialog(PreferencesViewModel preferencesViewModel)
{
PreferencesDialog dialog = new PreferencesDialog(preferencesViewModel);
var dialog = new PreferencesDialog(preferencesViewModel);
dialog.Owner = Application.Current.MainWindow;
dialog.Topmost = true;
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
dialog.ShowDialog();
}
public static void PanelConfigurationInstructionDialog()
{
var dialog = new PanelConfigurationInstructionDialog();
dialog.Owner = Application.Current.MainWindow;
dialog.Topmost = true;
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;

View file

@ -131,12 +131,12 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
});
}
private void HandleOnPopOutCompleted(object sender, EventArgs e)
private void HandleOnPopOutCompleted(object sender, bool isFirstTime)
{
Application.Current.Dispatcher.Invoke(() =>
{
// Restore window state
if (_minimizeForPopOut)
if (_minimizeForPopOut && (isFirstTime || !_orchestrator.AppSettingData.AppSetting.MinimizeAfterPopOut))
{
WindowActionManager.BringWindowToForeground(_orchestrator.ApplicationHandle);
ApplicationWindow.Show();

View file

@ -14,12 +14,18 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
{
_orchestrator = orchestrator;
AddProfileCommand = new DelegateCommand(OnAddProfile);
AddProfileCommand = new DelegateCommand(OnAddProfile, () => FlightSimData.HasCurrentMsfsAircraft && FlightSimData.IsSimulatorStarted)
.ObservesProperty(() => FlightSimData.HasCurrentMsfsAircraft)
.ObservesProperty(() => FlightSimData.IsSimulatorStarted);
DeleteProfileCommand = new DelegateCommand(OnDeleteProfile, () => ProfileData.HasActiveProfile)
.ObservesProperty(() => ProfileData.ActiveProfile);
DeleteProfileCommand = new DelegateCommand(OnDeleteProfile, () => ProfileData.HasActiveProfile && FlightSimData.HasCurrentMsfsAircraft && FlightSimData.IsSimulatorStarted)
.ObservesProperty(() => ProfileData.HasActiveProfile)
.ObservesProperty(() => FlightSimData.HasCurrentMsfsAircraft)
.ObservesProperty(() => FlightSimData.IsSimulatorStarted);
ChangeProfileCommand = new DelegateCommand<object>(OnChangeProfile);
ChangeProfileCommand = new DelegateCommand<object>(OnChangeProfile, (obj) => FlightSimData.HasCurrentMsfsAircraft && FlightSimData.IsSimulatorStarted)
.ObservesProperty(() => FlightSimData.HasCurrentMsfsAircraft)
.ObservesProperty(() => FlightSimData.IsSimulatorStarted);
AddProfileBindingCommand = new DelegateCommand(OnAddProfileBinding, () => ProfileData.HasActiveProfile && FlightSimData.HasCurrentMsfsAircraft && ProfileData.IsAllowedAddAircraftBinding && FlightSimData.IsSimulatorStarted)
.ObservesProperty(() => ProfileData.ActiveProfile)
@ -58,9 +64,12 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
.ObservesProperty(() => ProfileData.ActiveProfile.PanelSourceCoordinates.Count)
.ObservesProperty(() => FlightSimData.IsSimulatorStarted);
OpenTouchPanelBindingCommand = new DelegateCommand(OnOpenTouchPanelBinding, () => ProfileData.HasActiveProfile && AppSettingData.AppSetting.TouchPanelSettings.EnableTouchPanelIntegration)
OpenTouchPanelBindingCommand = new DelegateCommand(OnOpenTouchPanelBinding, () => FlightSimData.HasCurrentMsfsAircraft && FlightSimData.IsSimulatorStarted && ProfileData.HasActiveProfile && AppSettingData.AppSetting.TouchPanelSettings.EnableTouchPanelIntegration)
.ObservesProperty(() => ProfileData.HasActiveProfile)
.ObservesProperty(() => AppSettingData.AppSetting.TouchPanelSettings.EnableTouchPanelIntegration);
.ObservesProperty(() => AppSettingData.AppSetting.TouchPanelSettings.EnableTouchPanelIntegration)
.ObservesProperty(() => FlightSimData.HasCurrentMsfsAircraft)
.ObservesProperty(() => FlightSimData.IsSimulatorStarted);
;
TouchPanelBindingViewModel = new TouchPanelBindingViewModel(_orchestrator);
}

View file

@ -70,6 +70,7 @@
<PackageReference Include="InputSimulatorCore" Version="1.0.5" />
<PackageReference Include="log4net" Version="2.0.14" />
<PackageReference Include="MahApps.Metro" Version="2.4.9" />
<PackageReference Include="MahApps.Metro.IconPacks" Version="4.11.0" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Prism.Core" Version="8.1.97" />