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

Update floating panel feature

This commit is contained in:
hawkeye 2024-03-04 22:01:13 -05:00
parent e460a85c1a
commit 29f616324e
6 changed files with 60 additions and 21 deletions

View file

@ -1,15 +1,38 @@
using MSFSPopoutPanelManager.Shared;
using System;
using MSFSPopoutPanelManager.Shared;
using Newtonsoft.Json;
namespace MSFSPopoutPanelManager.DomainModel.Profile
{
public class FloatingPanel : ObservableObject
{
public FloatingPanel()
{
PropertyChanged += FloatingPanel_PropertyChanged; ;
}
private void FloatingPanel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
var arg = e as PropertyChangedExtendedEventArgs;
if (arg?.PropertyName != nameof(IsEnabled) || IsEnabled)
return;
KeyboardBinding = null;
IsHiddenOnStart = false;
}
public bool IsEnabled { get; set; }
public string KeyboardBinding { get; set; }
public bool IsHiddenOnStart { get; set; }
[JsonIgnore]
public bool IsDetectingKeystroke { get; set; }
[JsonIgnore]
public bool HasKeyboardBinding => !string.IsNullOrEmpty(KeyboardBinding);
}
}

View file

@ -20,20 +20,15 @@ namespace MSFSPopoutPanelManager.DomainModel.Profile
{
var arg = e as PropertyChangedExtendedEventArgs;
if (arg.PropertyName == nameof(FullScreen) && FullScreen)
switch (arg?.PropertyName)
{
case nameof(FullScreen) when FullScreen:
AlwaysOnTop = false;
HideTitlebar = false;
}
else if (arg.PropertyName == nameof(TouchEnabled) && TouchEnabled)
{
break;
case nameof(TouchEnabled) when TouchEnabled:
AutoGameRefocus = true;
}
else if (arg.ObjectName == QualifyFullName.Of(nameof(MSFSPopoutPanelManager.DomainModel.Profile.FloatingPanel)) &&
arg.PropertyName == nameof(FloatingPanel.IsEnabled))
{
if (!FloatingPanel.IsEnabled)
FloatingPanel.KeyboardBinding = null;
break;
}
}

View file

@ -22,7 +22,7 @@ namespace MSFSPopoutPanelManager.DomainModel.Profile
TouchEnabled,
AutoGameRefocus,
AllowFloatPanel,
FloatPanelKeyBinding,
IsHiddenOnStart,
None
}
}

View file

@ -377,6 +377,25 @@
Style="{StaticResource MaterialDesignOutlinedButton}">
Detect
</Button>
<WrapPanel
Margin="20,0,0,0"
Orientation="Horizontal"
Visibility="{c:Binding DataItem.FloatingPanel.HasKeyboardBinding}">
<ToggleButton
x:Name="TglBtnIsHiddenOnStart"
Margin="0,4,0,4"
VerticalAlignment="Center"
IsChecked="{Binding DataItem.FloatingPanel.IsHiddenOnStart, Mode=TwoWay, NotifyOnSourceUpdated=True}"
SourceUpdated="Data_SourceUpdated"
Style="{StaticResource ToggleButton}" />
<TextBlock
Margin="5,4,10,4"
VerticalAlignment="Center"
Style="{StaticResource TextBlockLabel}"
ToolTip="Hide the panel when pop out initially">
Hide on Start
</TextBlock>
</WrapPanel>
</WrapPanel>
</WrapPanel>
</Border>

View file

@ -6,7 +6,6 @@
xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:domain="clr-namespace:MSFSPopoutPanelManager.DomainModel.Profile;assembly=DomainModel"
xmlns:local="clr-namespace:MSFSPopoutPanelManager.MainApp"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:system="clr-namespace:System;assembly=mscorlib"

View file

@ -367,11 +367,8 @@ namespace MSFSPopoutPanelManager.Orchestration
panelConfig.PanelHandle = IntPtr.Zero;
}
if (ActiveProfile.PanelConfigs.Any(p => p.PanelType == PanelType.BuiltInPopout && p.IsPopOutSuccess != null && !(bool)p.IsPopOutSuccess) ||
ActiveProfile.PanelConfigs.Count(p => p.PanelType == PanelType.BuiltInPopout) == 0)
return false;
else
return true;
return !ActiveProfile.PanelConfigs.Any(p => p.PanelType == PanelType.BuiltInPopout && p.IsPopOutSuccess != null && !(bool)p.IsPopOutSuccess) &&
ActiveProfile.PanelConfigs.Count(p => p.PanelType == PanelType.BuiltInPopout) != 0;
});
}
}
@ -547,6 +544,12 @@ namespace MSFSPopoutPanelManager.Orchestration
InputEmulationManager.ToggleFullScreenPanel(panel.PanelHandle);
Thread.Sleep(250);
}
if (panel.FloatingPanel.IsEnabled && panel.FloatingPanel.HasKeyboardBinding && panel.FloatingPanel.IsHiddenOnStart)
{
panel.IsFloating = false;
WindowActionManager.MinimizeWindow(panel.PanelHandle);
}
}
private void ReturnToAfterPopOutCameraView()