mirror of
https://github.com/hawkeye-stan/msfs-popout-panel-manager.git
synced 2024-11-21 21:30:12 +00:00
Update floating panel feature
This commit is contained in:
parent
e460a85c1a
commit
29f616324e
6 changed files with 60 additions and 21 deletions
|
@ -1,15 +1,38 @@
|
||||||
using MSFSPopoutPanelManager.Shared;
|
using System;
|
||||||
|
using MSFSPopoutPanelManager.Shared;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace MSFSPopoutPanelManager.DomainModel.Profile
|
namespace MSFSPopoutPanelManager.DomainModel.Profile
|
||||||
{
|
{
|
||||||
public class FloatingPanel : ObservableObject
|
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 bool IsEnabled { get; set; }
|
||||||
|
|
||||||
public string KeyboardBinding { get; set; }
|
public string KeyboardBinding { get; set; }
|
||||||
|
|
||||||
|
public bool IsHiddenOnStart { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool IsDetectingKeystroke { get; set; }
|
public bool IsDetectingKeystroke { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public bool HasKeyboardBinding => !string.IsNullOrEmpty(KeyboardBinding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,20 +20,15 @@ namespace MSFSPopoutPanelManager.DomainModel.Profile
|
||||||
{
|
{
|
||||||
var arg = e as PropertyChangedExtendedEventArgs;
|
var arg = e as PropertyChangedExtendedEventArgs;
|
||||||
|
|
||||||
if (arg.PropertyName == nameof(FullScreen) && FullScreen)
|
switch (arg?.PropertyName)
|
||||||
{
|
{
|
||||||
|
case nameof(FullScreen) when FullScreen:
|
||||||
AlwaysOnTop = false;
|
AlwaysOnTop = false;
|
||||||
HideTitlebar = false;
|
HideTitlebar = false;
|
||||||
}
|
break;
|
||||||
else if (arg.PropertyName == nameof(TouchEnabled) && TouchEnabled)
|
case nameof(TouchEnabled) when TouchEnabled:
|
||||||
{
|
|
||||||
AutoGameRefocus = true;
|
AutoGameRefocus = true;
|
||||||
}
|
break;
|
||||||
else if (arg.ObjectName == QualifyFullName.Of(nameof(MSFSPopoutPanelManager.DomainModel.Profile.FloatingPanel)) &&
|
|
||||||
arg.PropertyName == nameof(FloatingPanel.IsEnabled))
|
|
||||||
{
|
|
||||||
if (!FloatingPanel.IsEnabled)
|
|
||||||
FloatingPanel.KeyboardBinding = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace MSFSPopoutPanelManager.DomainModel.Profile
|
||||||
TouchEnabled,
|
TouchEnabled,
|
||||||
AutoGameRefocus,
|
AutoGameRefocus,
|
||||||
AllowFloatPanel,
|
AllowFloatPanel,
|
||||||
FloatPanelKeyBinding,
|
IsHiddenOnStart,
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -377,6 +377,25 @@
|
||||||
Style="{StaticResource MaterialDesignOutlinedButton}">
|
Style="{StaticResource MaterialDesignOutlinedButton}">
|
||||||
Detect
|
Detect
|
||||||
</Button>
|
</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>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
|
xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:domain="clr-namespace:MSFSPopoutPanelManager.DomainModel.Profile;assembly=DomainModel"
|
xmlns:domain="clr-namespace:MSFSPopoutPanelManager.DomainModel.Profile;assembly=DomainModel"
|
||||||
xmlns:local="clr-namespace:MSFSPopoutPanelManager.MainApp"
|
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
||||||
|
|
|
@ -367,11 +367,8 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
panelConfig.PanelHandle = IntPtr.Zero;
|
panelConfig.PanelHandle = IntPtr.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ActiveProfile.PanelConfigs.Any(p => p.PanelType == PanelType.BuiltInPopout && p.IsPopOutSuccess != null && !(bool)p.IsPopOutSuccess) ||
|
return !ActiveProfile.PanelConfigs.Any(p => p.PanelType == PanelType.BuiltInPopout && p.IsPopOutSuccess != null && !(bool)p.IsPopOutSuccess) &&
|
||||||
ActiveProfile.PanelConfigs.Count(p => p.PanelType == PanelType.BuiltInPopout) == 0)
|
ActiveProfile.PanelConfigs.Count(p => p.PanelType == PanelType.BuiltInPopout) != 0;
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -547,6 +544,12 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
InputEmulationManager.ToggleFullScreenPanel(panel.PanelHandle);
|
InputEmulationManager.ToggleFullScreenPanel(panel.PanelHandle);
|
||||||
Thread.Sleep(250);
|
Thread.Sleep(250);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (panel.FloatingPanel.IsEnabled && panel.FloatingPanel.HasKeyboardBinding && panel.FloatingPanel.IsHiddenOnStart)
|
||||||
|
{
|
||||||
|
panel.IsFloating = false;
|
||||||
|
WindowActionManager.MinimizeWindow(panel.PanelHandle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ReturnToAfterPopOutCameraView()
|
private void ReturnToAfterPopOutCameraView()
|
||||||
|
|
Loading…
Reference in a new issue