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:
parent
f996863bd8
commit
ea098e9033
12 changed files with 211 additions and 56 deletions
|
@ -182,9 +182,7 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
if (AppSetting.TouchPanelSettings.EnableTouchPanelIntegration)
|
||||
{
|
||||
var panelResults = AddMsfsTouchPanels(panelConfigs.Count + 1);
|
||||
if (panelResults == null)
|
||||
return;
|
||||
|
||||
if (panelResults != null)
|
||||
panelConfigs.AddRange(panelResults);
|
||||
}
|
||||
|
||||
|
|
|
@ -325,10 +325,10 @@
|
|||
"encoderUpperCW": "AS1000_MFD_RANGE_INC",
|
||||
"encoderUpperCCW": "AS1000_MFD_RANGE_DEC",
|
||||
"encoderUpperSwitch": "AS1000_MFD_JOYSTICK_PUSH",
|
||||
"joystick1up": "AS1000_MFD_JOYSTICK_UP",
|
||||
"joystick1down": "AS1000_MFD_JOYSTICK_DOWN",
|
||||
"joystick1left": "AS1000_MFD_JOYSTICK_LEFT",
|
||||
"joystick1right": "AS1000_MFD_JOYSTICK_RIGHT",
|
||||
"joystick1up": "AS1000_MFD_JOYSTICK_RIGHT",
|
||||
"joystick1down": "AS1000_MFD_JOYSTICK_LEFT",
|
||||
"joystick1left": "AS1000_MFD_JOYSTICK_UP",
|
||||
"joystick1right": "AS1000_MFD_JOYSTICK_DOWN",
|
||||
"joystick1switch": "AS1000_MFD_JOYSTICK_PUSH",
|
||||
"actionType": "SimEventId"
|
||||
}
|
||||
|
|
|
@ -318,8 +318,8 @@
|
|||
"encoderLowerCW": "98007 (>K:ROTOR_BRAKE)",
|
||||
"encoderLowerCCW": "98008 (>K:ROTOR_BRAKE)",
|
||||
"encoderLowerSwitch": "97901 (>K:ROTOR_BRAKE)",
|
||||
"encoderUpperCW": "98007 (>K:ROTOR_BRAKE)",
|
||||
"encoderUpperCCW": "98008 (>K:ROTOR_BRAKE)",
|
||||
"encoderUpperCW": "25802 (>K:ROTOR_BRAKE)",
|
||||
"encoderUpperCCW": "25801 (>K:ROTOR_BRAKE)",
|
||||
"encoderUpperSwitch": "98101 (>K:ROTOR_BRAKE)",
|
||||
"actionType": "SimVarCode"
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
FullScreen,
|
||||
TouchEnabled,
|
||||
DisableGameRefocus,
|
||||
Invalid
|
||||
Invalid,
|
||||
RowHeader
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
|
|||
private bool _isSimConnected;
|
||||
private ConcurrentQueue<CommandAction> _actionQueue;
|
||||
private bool _isUsedArduino;
|
||||
private CommandAction _lastCommandAction;
|
||||
private int _repeatCommandActionCount;
|
||||
|
||||
private SimConnectEncoderAction _currentSimConnectEncoderAction;
|
||||
private System.Timers.Timer _actionExecutionTimer;
|
||||
|
@ -98,6 +100,7 @@ namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
|
|||
break;
|
||||
default:
|
||||
commandAction = new CommandAction(actionData.Action, actionData.ActionType, Convert.ToUInt16(actionData.ActionValue));
|
||||
|
||||
if (_isUsedArduino)
|
||||
{
|
||||
Task.Run(() =>
|
||||
|
@ -128,6 +131,22 @@ namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
|
|||
|
||||
if (e.Acceleration == 1)
|
||||
{
|
||||
// do manual acceleration
|
||||
if (_lastCommandAction != null && commandAction.Action == _lastCommandAction.Action)
|
||||
_repeatCommandActionCount++;
|
||||
else
|
||||
_repeatCommandActionCount = 0;
|
||||
|
||||
_lastCommandAction = commandAction;
|
||||
|
||||
if (_repeatCommandActionCount > 2)
|
||||
{
|
||||
for (var i = 0; i < 10; i++)
|
||||
_actionQueue.Enqueue(commandAction);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_actionQueue.Enqueue(commandAction);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
|
|||
|
||||
private SimConnect _simConnect;
|
||||
private System.Timers.Timer _connectionTimer;
|
||||
private string _planeId;
|
||||
|
||||
public event EventHandler<string> OnCriticalException;
|
||||
public event EventHandler<List<SimConnectDataDefinition>> OnReceivedData;
|
||||
|
@ -83,6 +84,8 @@ namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
|
|||
// Clear memory cache data to send back to ReactJs app
|
||||
OnReceivedData?.Invoke(this, null);
|
||||
}
|
||||
|
||||
_planeId = planeId;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,9 +167,12 @@ namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
|
|||
_simConnect.UnsubscribeFromSystemEvent(SimConnectSystemEvent.VIEW);
|
||||
_simConnect.SubscribeToSystemEvent(SimConnectSystemEvent.VIEW, "View");
|
||||
|
||||
System.Threading.Thread.Sleep(4000);
|
||||
for (var i = 0; i < 5; i++)
|
||||
{
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
ReceiveMessage();
|
||||
}
|
||||
}
|
||||
|
||||
private void AddDataDefinitions()
|
||||
{
|
||||
|
@ -211,6 +217,9 @@ namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
|
|||
{
|
||||
MobilFlightInitialize();
|
||||
|
||||
if (_planeId != null)
|
||||
ResetSimConnectDataArea(_planeId);
|
||||
|
||||
// MobiFlight wasm event
|
||||
_simConnect.OnRecvClientData -= HandleOnRecvClientData;
|
||||
_simConnect.OnRecvClientData += HandleOnRecvClientData;
|
||||
|
|
|
@ -8,6 +8,12 @@
|
|||
|
||||
* 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
|
||||
|
||||
Known issue:
|
||||
|
||||
* When changing the width or height of a pop up that has Hide Title Bar enable, it will sometime break the Hide Title Bar setting and the only way to fix is to re-pop out the panel.
|
||||
|
||||
## Version 3.4.1
|
||||
|
||||
This release is solely focused on addressing issues regarding touch panel capabilities as well as making improvements to touch feature. Panels I used for testing are
|
||||
|
|
|
@ -12,12 +12,14 @@ namespace MSFSPopoutPanelManager.WindowsAgent
|
|||
|
||||
public static void ApplyHidePanelTitleBar(IntPtr hwnd, bool hideTitleBar)
|
||||
{
|
||||
var currentStyle = PInvoke.GetWindowLong(hwnd, PInvokeConstant.GWL_STYLE).ToInt64();
|
||||
var currentStyle = (uint)PInvoke.GetWindowLong(hwnd, PInvokeConstant.GWL_STYLE);
|
||||
|
||||
if (hideTitleBar)
|
||||
PInvoke.SetWindowLong(hwnd, PInvokeConstant.GWL_STYLE, (uint)(currentStyle & ~(PInvokeConstant.WS_CAPTION | PInvokeConstant.WS_SIZEBOX)));
|
||||
currentStyle &= ~(PInvokeConstant.WS_CAPTION | PInvokeConstant.WS_SIZEBOX);
|
||||
else
|
||||
PInvoke.SetWindowLong(hwnd, PInvokeConstant.GWL_STYLE, (uint)(currentStyle | (PInvokeConstant.WS_CAPTION | PInvokeConstant.WS_SIZEBOX)));
|
||||
currentStyle |= (PInvokeConstant.WS_CAPTION | PInvokeConstant.WS_SIZEBOX);
|
||||
|
||||
PInvoke.SetWindowLong(hwnd, PInvokeConstant.GWL_STYLE, currentStyle);
|
||||
}
|
||||
|
||||
public static void ApplyAlwaysOnTop(IntPtr hwnd, PanelType panelType, bool alwaysOnTop, Rectangle panelRectangle)
|
||||
|
|
|
@ -17,8 +17,8 @@ namespace MSFSPopoutPanelManager.WpfApp
|
|||
InitializeComponent();
|
||||
//this.Topmost = true;
|
||||
this.Title = caption;
|
||||
this.Width = width;
|
||||
this.Height = height;
|
||||
//this.Width = width;
|
||||
//this.Height = height;
|
||||
|
||||
_planeId = planeId;
|
||||
_panelId = panelId;
|
||||
|
|
|
@ -31,13 +31,7 @@
|
|||
</Style>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<UserControl.InputBindings>
|
||||
<KeyBinding Command="{Binding MinusTenPixelCommand}" CommandParameter="-10" Modifiers="Ctrl" Key="OemMinus"/>
|
||||
<KeyBinding Command="{Binding MinusOnePixelCommand}" CommandParameter="-1" Modifiers="Ctrl" Key="OemOpenBrackets" />
|
||||
<KeyBinding Command="{Binding PlusOnePixelCommand}" CommandParameter="1" Modifiers="Ctrl" Key="OemCloseBrackets" />
|
||||
<KeyBinding Command="{Binding PlusTenPixelCommand}" CommandParameter="10" Modifiers="Ctrl" Key="OemPlus" />
|
||||
</UserControl.InputBindings>
|
||||
<Grid>
|
||||
<Grid KeyboardNavigation.DirectionalNavigation="None">
|
||||
<DockPanel>
|
||||
<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"/>
|
||||
|
@ -45,13 +39,13 @@
|
|||
<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}">
|
||||
ItemsSource="{Binding ProfileData.ActiveProfile.PanelConfigs}" HeadersVisibility="Column" KeyboardNavigation.DirectionalNavigation="Local">
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="Background" Value="{x:Null}" />
|
||||
<Setter Property="BorderBrush" Value="{x:Null}" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="False">
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="{x:Null}" />
|
||||
</Trigger>
|
||||
|
@ -89,24 +83,47 @@
|
|||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Header="Panel Name" Width="220" >
|
||||
<DataGridTemplateColumn Header="" Width="30" >
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox Name="PanelName" Width="220" BorderThickness="0" TextAlignment="Left" Text="{Binding PanelName, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
|
||||
SourceUpdated="GridData_SourceUpdated" IsReadOnly="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path=DataContext.ProfileData.ActiveProfile.IsLocked}" IsEnabled="{Binding IsCustomPopOut}">
|
||||
<TextBox Name="PanelName" Width="30" Height="28" BorderThickness="0" TextAlignment="Left"
|
||||
SourceUpdated="GridData_SourceUpdated"
|
||||
IsReadOnly="True"
|
||||
IsHitTestVisible="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='!DataContext.ProfileData.ActiveProfile.IsLocked'}"
|
||||
Text="▶"
|
||||
VerticalAlignment="Center"
|
||||
Padding="5, 3, 0, 0">
|
||||
<TextBox.Style>
|
||||
<Style TargetType="TextBox">
|
||||
<Setter Property="Focusable" Value="True"/>
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="FontFamily" Value="Segoe UI"/>
|
||||
<Setter Property="FontWeight" Value="Normal"/>
|
||||
<Setter Property="Margin" Value="5, 5, 5, 5"/>
|
||||
<Setter Property="Cursor" Value="Arrow"></Setter>
|
||||
<Setter Property="SelectionOpacity" Value="0"></Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsFocused" Value="False">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsFocused" Value="True">
|
||||
<Setter Property="Background" Value="Red" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBox.Style>
|
||||
</TextBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Panel Name" Width="200" >
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox Name="PanelName" Width="220" BorderThickness="0" TextAlignment="Left"
|
||||
Text="{Binding PanelName, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
|
||||
SourceUpdated="GridData_SourceUpdated"
|
||||
Style="{StaticResource TextBoxColumnFocus}"
|
||||
IsReadOnly="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path=DataContext.ProfileData.ActiveProfile.IsLocked}"
|
||||
IsEnabled="{Binding IsCustomPopOut}">
|
||||
</TextBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="X-Pos" Width="70">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
|
@ -200,10 +217,10 @@
|
|||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Touch Enabled" Width="75">
|
||||
<DataGridTemplateColumn Header="Touch Enabled" Width="70">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox Name="TouchEnabled" Width="75" Margin="30 0 0 0"
|
||||
<CheckBox Name="TouchEnabled" Width="70" Margin="25 0 0 0"
|
||||
SourceUpdated="GridData_SourceUpdated"
|
||||
IsChecked="{Binding TouchEnabled, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsEnabled="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='!DataContext.ProfileData.ActiveProfile.IsLocked'}"
|
||||
|
@ -211,10 +228,10 @@
|
|||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Disable Game Refocus" Width="75">
|
||||
<DataGridTemplateColumn Header="Disable Game Refocus" Width="70">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox Name="DisableGameRefocus" Width="75" Margin="30 0 0 0"
|
||||
<CheckBox Name="DisableGameRefocus" Width="70" Margin="25 0 0 0"
|
||||
SourceUpdated="GridData_SourceUpdated"
|
||||
IsChecked="{Binding DisableGameRefocus, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsEnabled="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='!DataContext.ProfileData.ActiveProfile.IsLocked'}"
|
||||
|
@ -226,10 +243,10 @@
|
|||
</DataGrid>
|
||||
</WrapPanel>
|
||||
<WrapPanel DockPanel.Dock="Bottom" Orientation="Horizontal" Margin="20,10,0,0" HorizontalAlignment="Left">
|
||||
<Button Name="MinusTenButton" Content="-10 px" ToolTip="Ctrl -" HorizontalAlignment="Center" Margin="0,0,0,0" Width="75" Command="{Binding MinusTenPixelCommand}" CommandParameter="-10"/>
|
||||
<Button Name="MinusOneButton" Content="-1 px" ToolTip="Ctrl [" HorizontalAlignment="Center" Margin="20,0,0,0" Width="75" Command="{Binding MinusOnePixelCommand}" CommandParameter="-1"/>
|
||||
<Button Name="PlusOneButton" Content="+1 px" ToolTip="Ctrl ]" HorizontalAlignment="Center" Margin="20,0,0,0" Width="75" Command="{Binding PlusOnePixelCommand}" CommandParameter="1"/>
|
||||
<Button Name="PlusTenButton" Content="+10 px" ToolTip="Ctrl +" HorizontalAlignment="Center" Margin="20,0,0,0" Width="75" Command="{Binding PlusTenPixelCommand}" CommandParameter="10"/>
|
||||
<Button Name="MinusTenButton" Content="-10 px" ToolTip="Down Arrow" HorizontalAlignment="Center" Margin="0,0,0,0" Width="75" Command="{Binding ConfigurePanelPixelCommand}" CommandParameter="-10"/>
|
||||
<Button Name="MinusOneButton" Content="-1 px" ToolTip="Shift Down Arrow" HorizontalAlignment="Center" Margin="20,0,0,0" Width="75" Command="{Binding ConfigurePanelPixelCommand}" CommandParameter="-1"/>
|
||||
<Button Name="PlusOneButton" Content="+1 px" ToolTip="Shift Up Arrow" HorizontalAlignment="Center" Margin="20,0,0,0" Width="75" Command="{Binding ConfigurePanelPixelCommand}" CommandParameter="1"/>
|
||||
<Button Name="PlusTenButton" Content="+10 px" ToolTip="Up Arrow" HorizontalAlignment="Center" Margin="20,0,0,0" Width="75" Command="{Binding ConfigurePanelPixelCommand}" CommandParameter="10"/>
|
||||
<Button HorizontalAlignment="Center" Margin="390,0,0,0" Width="130" Command="{Binding LockPanelsCommand}">
|
||||
<Button.Style>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
|
||||
|
|
|
@ -20,6 +20,8 @@ namespace MSFSPopoutPanelManager.WpfApp
|
|||
_panelConfigurationViewModel = panelConfigurationViewModel;
|
||||
this.DataContext = _panelConfigurationViewModel;
|
||||
FocusManager.SetIsFocusScope(this, true);
|
||||
|
||||
PanelConfigGrid.PreviewKeyDown += PanelConfigGrid_KeyDown;
|
||||
}
|
||||
|
||||
private void GridData_SourceUpdated(object sender, DataTransferEventArgs e)
|
||||
|
@ -73,6 +75,9 @@ namespace MSFSPopoutPanelManager.WpfApp
|
|||
case "Disable Game Refocus":
|
||||
selectedProperty = PanelConfigPropertyName.DisableGameRefocus;
|
||||
break;
|
||||
case "":
|
||||
selectedProperty = PanelConfigPropertyName.RowHeader;
|
||||
break;
|
||||
}
|
||||
|
||||
_panelConfigurationViewModel.SelectedPanelConfigItem = new PanelConfigItem() { PanelIndex = panelConfig.PanelIndex, PanelConfigProperty = selectedProperty };
|
||||
|
@ -119,5 +124,56 @@ namespace MSFSPopoutPanelManager.WpfApp
|
|||
|
||||
_panelConfigurationViewModel.NumericDataPointTextBox = null;
|
||||
}
|
||||
|
||||
private void PanelConfigGrid_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
var isControlKeyHeld = (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control;
|
||||
var isShiftKeyHeld = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift;
|
||||
|
||||
switch (_panelConfigurationViewModel.SelectedPanelConfigItem.PanelConfigProperty)
|
||||
{
|
||||
case PanelConfigPropertyName.RowHeader:
|
||||
var multiplier = isShiftKeyHeld ? 1 : 10;
|
||||
switch (e.Key)
|
||||
{
|
||||
case Key.Left:
|
||||
_panelConfigurationViewModel.ConfigurePanelCommand.Execute(new KeyAction(isControlKeyHeld ? "Control-Left" : "Left", multiplier));
|
||||
break;
|
||||
case Key.Right:
|
||||
_panelConfigurationViewModel.ConfigurePanelCommand.Execute(new KeyAction(isControlKeyHeld ? "Control-Right" : "Right", multiplier));
|
||||
break;
|
||||
case Key.Up:
|
||||
_panelConfigurationViewModel.ConfigurePanelCommand.Execute(new KeyAction(isControlKeyHeld ? "Control-Up" : "Up", multiplier));
|
||||
break;
|
||||
case Key.Down:
|
||||
_panelConfigurationViewModel.ConfigurePanelCommand.Execute(new KeyAction(isControlKeyHeld ? "Control-Down" : "Down", multiplier));
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case PanelConfigPropertyName.Top:
|
||||
case PanelConfigPropertyName.Left:
|
||||
case PanelConfigPropertyName.Height:
|
||||
case PanelConfigPropertyName.Width:
|
||||
switch (e.Key)
|
||||
{
|
||||
case Key.Up:
|
||||
if (isShiftKeyHeld)
|
||||
_panelConfigurationViewModel.ConfigurePanelPixelCommand.Execute(1);
|
||||
else
|
||||
_panelConfigurationViewModel.ConfigurePanelPixelCommand.Execute(10);
|
||||
break;
|
||||
case Key.Down:
|
||||
if (isShiftKeyHeld)
|
||||
_panelConfigurationViewModel.ConfigurePanelPixelCommand.Execute(-1);
|
||||
else
|
||||
_panelConfigurationViewModel.ConfigurePanelPixelCommand.Execute(-10);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,26 +19,18 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
|
|||
|
||||
PanelConfigUpdatedCommand = new DelegateCommand<object>(OnPanelConfigUpdated);
|
||||
|
||||
MinusTenPixelCommand = new DelegateCommand<object>(OnDataItemIncDec, (obj) => NumericDataPointTextBox != null && ProfileData.HasActiveProfile && !ProfileData.ActiveProfile.IsLocked).ObservesProperty(() => SelectedPanelConfigItem).ObservesProperty(() => ProfileData.ActiveProfile.IsLocked);
|
||||
ConfigurePanelPixelCommand = new DelegateCommand<object>(OnDataItemIncDec, (obj) => NumericDataPointTextBox != null && ProfileData.HasActiveProfile && !ProfileData.ActiveProfile.IsLocked).ObservesProperty(() => SelectedPanelConfigItem).ObservesProperty(() => ProfileData.ActiveProfile.IsLocked);
|
||||
|
||||
MinusOnePixelCommand = new DelegateCommand<object>(OnDataItemIncDec, (obj) => NumericDataPointTextBox != null && ProfileData.HasActiveProfile && !ProfileData.ActiveProfile.IsLocked).ObservesProperty(() => SelectedPanelConfigItem).ObservesProperty(() => ProfileData.ActiveProfile.IsLocked);
|
||||
|
||||
PlusOnePixelCommand = new DelegateCommand<object>(OnDataItemIncDec, (obj) => NumericDataPointTextBox != null && ProfileData.HasActiveProfile && !ProfileData.ActiveProfile.IsLocked).ObservesProperty(() => SelectedPanelConfigItem).ObservesProperty(() => ProfileData.ActiveProfile.IsLocked);
|
||||
|
||||
PlusTenPixelCommand = new DelegateCommand<object>(OnDataItemIncDec, (obj) => NumericDataPointTextBox != null && ProfileData.HasActiveProfile && !ProfileData.ActiveProfile.IsLocked).ObservesProperty(() => SelectedPanelConfigItem).ObservesProperty(() => ProfileData.ActiveProfile.IsLocked);
|
||||
ConfigurePanelCommand = new DelegateCommand<object>(OnConfigurePanel, (obj) => true);
|
||||
}
|
||||
|
||||
public DelegateCommand LockPanelsCommand { get; private set; }
|
||||
|
||||
public DelegateCommand<object> PanelConfigUpdatedCommand { get; private set; }
|
||||
|
||||
public DelegateCommand<object> MinusTenPixelCommand { get; private set; }
|
||||
public DelegateCommand<object> ConfigurePanelPixelCommand { get; private set; }
|
||||
|
||||
public DelegateCommand<object> MinusOnePixelCommand { get; private set; }
|
||||
|
||||
public DelegateCommand<object> PlusOnePixelCommand { get; private set; }
|
||||
|
||||
public DelegateCommand<object> PlusTenPixelCommand { get; private set; }
|
||||
public DelegateCommand<object> ConfigurePanelCommand { get; private set; }
|
||||
|
||||
public ProfileData ProfileData { get { return _orchestrator.ProfileData; } }
|
||||
|
||||
|
@ -78,5 +70,60 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
|
|||
NumericDataPointTextBox.Focus();
|
||||
});
|
||||
}
|
||||
|
||||
private void OnConfigurePanel(object commandParameter)
|
||||
{
|
||||
if (SelectedPanelConfigItem.PanelIndex == -1)
|
||||
return;
|
||||
|
||||
var keyAction = commandParameter as KeyAction;
|
||||
|
||||
switch (keyAction.Action)
|
||||
{
|
||||
case "Up":
|
||||
_orchestrator.PanelConfiguration.PanelConfigIncreaseDecrease(SelectedPanelConfigItem.PanelIndex, PanelConfigPropertyName.Top, -1 * keyAction.Multiplier);
|
||||
break;
|
||||
case "Down":
|
||||
_orchestrator.PanelConfiguration.PanelConfigIncreaseDecrease(SelectedPanelConfigItem.PanelIndex, PanelConfigPropertyName.Top, 1 * keyAction.Multiplier);
|
||||
break;
|
||||
case "Left":
|
||||
_orchestrator.PanelConfiguration.PanelConfigIncreaseDecrease(SelectedPanelConfigItem.PanelIndex, PanelConfigPropertyName.Left, -1 * keyAction.Multiplier);
|
||||
break;
|
||||
case "Right":
|
||||
_orchestrator.PanelConfiguration.PanelConfigIncreaseDecrease(SelectedPanelConfigItem.PanelIndex, PanelConfigPropertyName.Left, 1 * keyAction.Multiplier);
|
||||
break;
|
||||
case "Control-Up":
|
||||
_orchestrator.PanelConfiguration.PanelConfigIncreaseDecrease(SelectedPanelConfigItem.PanelIndex, PanelConfigPropertyName.Height, -1 * keyAction.Multiplier);
|
||||
break;
|
||||
case "Control-Down":
|
||||
_orchestrator.PanelConfiguration.PanelConfigIncreaseDecrease(SelectedPanelConfigItem.PanelIndex, PanelConfigPropertyName.Height, 1 * keyAction.Multiplier);
|
||||
break;
|
||||
case "Control-Left":
|
||||
_orchestrator.PanelConfiguration.PanelConfigIncreaseDecrease(SelectedPanelConfigItem.PanelIndex, PanelConfigPropertyName.Width, -1 * keyAction.Multiplier);
|
||||
break;
|
||||
case "Control-Right":
|
||||
_orchestrator.PanelConfiguration.PanelConfigIncreaseDecrease(SelectedPanelConfigItem.PanelIndex, PanelConfigPropertyName.Width, 1 * keyAction.Multiplier);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class KeyAction
|
||||
{
|
||||
public KeyAction(string action, int multiplier)
|
||||
{
|
||||
Action = action;
|
||||
Multiplier = multiplier;
|
||||
}
|
||||
|
||||
public KeyAction(string action)
|
||||
{
|
||||
Action = action;
|
||||
Multiplier = 1;
|
||||
}
|
||||
|
||||
public string Action { get; set; }
|
||||
|
||||
public int Multiplier { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue