mirror of
https://github.com/hawkeye-stan/msfs-popout-panel-manager.git
synced 2024-11-22 05:40:11 +00:00
409 lines
23 KiB
XML
409 lines
23 KiB
XML
<UserControl
|
|
x:Class="MSFSPopoutPanelManager.MainApp.AppUserControl.PopOutPanelConfigCard"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
|
|
xmlns:converter="clr-namespace:MSFSPopoutPanelManager.MainApp.Converter"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:popOutPanelCard="clr-namespace:MSFSPopoutPanelManager.MainApp.AppUserControl.PopOutPanelCard"
|
|
xmlns:profileDomain="clr-namespace:MSFSPopoutPanelManager.DomainModel.Profile;assembly=DomainModel"
|
|
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
|
xmlns:viewModel="clr-namespace:MSFSPopoutPanelManager.MainApp.ViewModel"
|
|
Width="860"
|
|
MinHeight="40"
|
|
mc:Ignorable="d">
|
|
<UserControl.Resources>
|
|
<system:Double x:Key="IconSize">22</system:Double>
|
|
<system:Double x:Key="ButtonSize">28</system:Double>
|
|
<converter:KeystrokeBindingsConverter x:Key="KeystrokeBindingsConverter" />
|
|
<DataTrigger
|
|
x:Key="TriggerIsProfileLocked"
|
|
Binding="{Binding ActiveProfile.IsLocked}"
|
|
Value="True">
|
|
<d:DataTrigger.DataContext>
|
|
<x:Type Type="viewModel:PopOutPanelConfigCardViewModel" />
|
|
</d:DataTrigger.DataContext>
|
|
<Setter Property="FrameworkElement.IsHitTestVisible" Value="False" />
|
|
<Setter Property="FrameworkElement.Opacity" Value="0.8" />
|
|
</DataTrigger>
|
|
<DataTrigger
|
|
x:Key="TriggerIsProfileUnlocked"
|
|
Binding="{Binding ActiveProfile.IsLocked}"
|
|
Value="False">
|
|
<d:DataTrigger.DataContext>
|
|
<x:Type Type="viewModel:PopOutPanelConfigCardViewModel" />
|
|
</d:DataTrigger.DataContext>
|
|
<Setter Property="FrameworkElement.IsHitTestVisible" Value="True" />
|
|
<Setter Property="Button.Foreground" Value="White" />
|
|
</DataTrigger>
|
|
<Style TargetType="{x:Type Expander}">
|
|
<Style.Triggers>
|
|
<StaticResource ResourceKey="TriggerIsProfileLocked" />
|
|
<StaticResource ResourceKey="TriggerIsProfileUnlocked" />
|
|
</Style.Triggers>
|
|
</Style>
|
|
<Style
|
|
x:Key="ToggleButton"
|
|
BasedOn="{StaticResource MaterialDesignSwitchToggleButton}"
|
|
TargetType="ToggleButton">
|
|
<Setter Property="Margin" Value="4,0,4,0" />
|
|
</Style>
|
|
<Style
|
|
x:Key="TextBlockLabel"
|
|
BasedOn="{StaticResource {x:Type TextBlock}}"
|
|
TargetType="TextBlock">
|
|
<Setter Property="FontSize" Value="13" />
|
|
<Setter Property="TextWrapping" Value="Wrap" />
|
|
<Setter Property="Margin" Value="5,0,40,0" />
|
|
<Setter Property="LineHeight" Value="18" />
|
|
</Style>
|
|
<Style BasedOn="{StaticResource MaterialDesignIconForegroundButton}" TargetType="Button" />
|
|
<Style
|
|
x:Key="PopOutPanelExpander"
|
|
BasedOn="{StaticResource CustomMaterialDesignExpander}"
|
|
TargetType="Expander">
|
|
<d:Style.DataContext>
|
|
<x:Type Type="viewModel:PopOutPanelConfigCardViewModel" />
|
|
</d:Style.DataContext>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding DataItem.IsPopOutSuccess}" Value="False">
|
|
<Setter Property="BorderBrush" Value="Red" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding DataItem.IsPopOutSuccess}" Value="True">
|
|
<Setter Property="BorderBrush" Value="Green" />
|
|
</DataTrigger>
|
|
|
|
</Style.Triggers>
|
|
</Style>
|
|
<Style x:Key="PopOutPanelExpanderVisibility" TargetType="StackPanel">
|
|
<d:Style.DataContext>
|
|
<x:Type Type="viewModel:PopOutPanelConfigCardViewModel" />
|
|
</d:Style.DataContext>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding DataItem.IsPopOutSuccess}" Value="True">
|
|
<Setter Property="FrameworkElement.Visibility" Value="Visible" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding DataItem.IsPopOutSuccess}" Value="{x:Null}">
|
|
<Setter Property="FrameworkElement.Visibility" Value="Visible" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding DataItem.IsPopOutSuccess}" Value="False">
|
|
<Setter Property="FrameworkElement.Visibility" Value="Collapsed" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<Style x:Key="ErrorPanelExpanderVisibility" TargetType="StackPanel">
|
|
<d:Style.DataContext>
|
|
<x:Type Type="viewModel:PopOutPanelConfigCardViewModel" />
|
|
</d:Style.DataContext>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding DataItem.IsPopOutSuccess}" Value="True">
|
|
<Setter Property="FrameworkElement.Visibility" Value="Collapsed" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding DataItem.IsPopOutSuccess}" Value="{x:Null}">
|
|
<Setter Property="FrameworkElement.Visibility" Value="Collapsed" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding DataItem.IsPopOutSuccess}" Value="False">
|
|
<Setter Property="FrameworkElement.Visibility" Value="Visible" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<Style x:Key="TxtBlockErrorMessage" TargetType="TextBlock">
|
|
<d:Style.DataContext>
|
|
<x:Type Type="viewModel:PopOutPanelConfigCardViewModel" />
|
|
</d:Style.DataContext>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding DataItem.PanelType}" Value="{x:Static profileDomain:PanelType.CustomPopout}">
|
|
<Setter Property="Text" Value="Unable to pop out this panel. Please check the source panel circle defined for this panel is at the correct location and not blocked by other window. Also please check if this panel is a duplicate with another panel. Lastly, please close all instrumentation pop outs that were opened manually." />
|
|
<Setter Property="LineHeight" Value="18" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding DataItem.PanelType}" Value="{x:Static profileDomain:PanelType.BuiltInPopout}">
|
|
<Setter Property="Text" Value="Unable to configure this built-in panel. Please make sure this panel has been opened and popped out by the game." />
|
|
<Setter Property="LineHeight" Value="18" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<Style
|
|
x:Key="TxtBlockDisableWhenFullScreen"
|
|
BasedOn="{StaticResource TextBlockLabel}"
|
|
TargetType="TextBlock">
|
|
<d:Style.DataContext>
|
|
<x:Type Type="viewModel:PopOutPanelConfigCardViewModel" />
|
|
</d:Style.DataContext>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding DataItem.FullScreen}" Value="True">
|
|
<Setter Property="Foreground" Value="DimGray" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</UserControl.Resources>
|
|
<DockPanel d:DataContext="{d:DesignInstance viewModel:PopOutPanelConfigCardViewModel}">
|
|
<Expander
|
|
x:Name="RootExpander"
|
|
Width="860"
|
|
materialDesign:ExpanderAssist.HorizontalHeaderPadding="10,0,10,0"
|
|
BorderThickness="1">
|
|
<Expander.Style>
|
|
<Style BasedOn="{StaticResource PopOutPanelExpander}" TargetType="Expander">
|
|
<Style.Triggers>
|
|
<StaticResource ResourceKey="TriggerIsProfileLocked" />
|
|
<StaticResource ResourceKey="TriggerIsProfileUnlocked" />
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Expander.Style>
|
|
<Expander.Header>
|
|
<StackPanel Width="805" Orientation="Horizontal">
|
|
<StackPanel
|
|
Width="24"
|
|
Height="52"
|
|
Margin="0"
|
|
Style="{StaticResource ErrorPanelExpanderVisibility}">
|
|
<materialDesign:PopupBox
|
|
x:Name="PopupErrorMessage"
|
|
Margin="0,15,0,0"
|
|
Padding="5"
|
|
PlacementMode="RightAndAlignMiddles"
|
|
PopupHorizontalOffset="-10"
|
|
PopupUniformCornerRadius="10"
|
|
PopupVerticalOffset="15"
|
|
StaysOpen="True">
|
|
<materialDesign:PopupBox.ToggleContent>
|
|
<materialDesign:PackIcon
|
|
Width="{StaticResource IconSize}"
|
|
Height="{StaticResource IconSize}"
|
|
Foreground="Red"
|
|
Kind="AlertCircleOutline" />
|
|
</materialDesign:PopupBox.ToggleContent>
|
|
<TextBlock
|
|
Width="450"
|
|
Style="{StaticResource TxtBlockErrorMessage}"
|
|
TextWrapping="Wrap" />
|
|
</materialDesign:PopupBox>
|
|
</StackPanel>
|
|
|
|
<!-- Drag panel handle -->
|
|
<StackPanel
|
|
Width="24"
|
|
Height="52"
|
|
Margin="0"
|
|
Style="{StaticResource PopOutPanelExpanderVisibility}">
|
|
<materialDesign:PackIcon
|
|
x:Name="IconDrag"
|
|
Width="{StaticResource IconSize}"
|
|
Height="{StaticResource IconSize}"
|
|
Margin="0,15,0,0"
|
|
Kind="Menu"
|
|
Opacity="0.5" />
|
|
</StackPanel>
|
|
|
|
<!-- Panel name text box -->
|
|
<TextBox
|
|
x:Name="TxtBoxPanelName"
|
|
Width="260"
|
|
Margin="8,0,0,0"
|
|
Padding="0"
|
|
VerticalAlignment="Center"
|
|
HorizontalContentAlignment="Left"
|
|
materialDesign:HintAssist.FloatingScale="1"
|
|
materialDesign:HintAssist.Hint="Panel Name"
|
|
GotFocus="TextBox_GotFocus"
|
|
IsEnabled="{Binding DataItem.IsCustomPopOut}"
|
|
KeyDown="TextBox_KeyDown"
|
|
SourceUpdated="Data_SourceUpdated"
|
|
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
|
|
Text="{Binding DataItem.PanelName, Mode=TwoWay, NotifyOnSourceUpdated=True}" />
|
|
|
|
|
|
<!-- Panel configurations -->
|
|
<StackPanel
|
|
Width="440"
|
|
VerticalAlignment="Center"
|
|
IsEnabled="{c:Binding 'DataItem.IsFloating'}">
|
|
<StackPanel
|
|
x:Name="StackPanelAdjustment"
|
|
Width="440"
|
|
Orientation="Horizontal"
|
|
Visibility="{c:Binding 'DataItem.IsBuiltInPopOut or DataItem.IsHudBarWindow or DataItem.IsNumPadWindow or (DataItem.IsCustomPopOut and DataItem.PanelSource.X != null)'}">
|
|
<popOutPanelCard:PanelConfigField
|
|
Margin="20,0,0,0"
|
|
BindingPath="Top"
|
|
DataItem="{Binding DataItem}"
|
|
IsEnabled="{c:Binding '!DataItem.IsRefocusDisplay'}"
|
|
SourceUpdated="Data_SourceUpdated" />
|
|
<popOutPanelCard:PanelConfigField
|
|
Margin="20,0,0,0"
|
|
BindingPath="Left"
|
|
DataItem="{Binding DataItem}"
|
|
IsEnabled="{c:Binding '!DataItem.IsRefocusDisplay'}"
|
|
SourceUpdated="Data_SourceUpdated" />
|
|
<popOutPanelCard:PanelConfigField
|
|
Margin="20,0,0,0"
|
|
BindingPath="Width"
|
|
DataItem="{Binding DataItem}"
|
|
IsEnabled="{c:Binding '!DataItem.IsHudBarWindow and !DataItem.IsRefocusDisplay'}"
|
|
SourceUpdated="Data_SourceUpdated" />
|
|
<popOutPanelCard:PanelConfigField
|
|
Margin="20,0,0,0"
|
|
BindingPath="Height"
|
|
DataItem="{Binding DataItem}"
|
|
IsEnabled="{c:Binding '!DataItem.IsHudBarWindow and !DataItem.IsRefocusDisplay'}"
|
|
SourceUpdated="Data_SourceUpdated" />
|
|
<popOutPanelCard:MoveAndResizePanelButton Margin="12,0,0,0" Visibility="{c:Binding '!DataItem.IsRefocusDisplay'}" />
|
|
</StackPanel>
|
|
<StackPanel
|
|
Width="440"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Visibility="{c:Binding 'DataItem.IsCustomPopOut and DataItem.PanelSource.X == null'}">
|
|
<Label HorizontalAlignment="Center">Please identify panel source</Label>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
|
|
<!-- Touch enable panel button -->
|
|
<StackPanel Margin="12,0,0,0" VerticalAlignment="Center">
|
|
<popOutPanelCard:TouchEnabledButton
|
|
Width="{StaticResource IconSize}"
|
|
Margin="0"
|
|
Visibility="{c:Binding 'DataItem.IsTouchEnablePanel'}" />
|
|
</StackPanel>
|
|
|
|
<!-- Delete panel button -->
|
|
<StackPanel Margin="15,0,0,0" VerticalAlignment="Center">
|
|
<Button
|
|
Width="{StaticResource ButtonSize}"
|
|
Height="{StaticResource ButtonSize}"
|
|
Margin="0"
|
|
Command="{Binding DeletePanelCommand}"
|
|
KeyboardNavigation.AcceptsReturn="False"
|
|
ToolTip="Delete panel"
|
|
Visibility="{c:Binding 'DataItem.IsDeletablePanel'}">
|
|
<materialDesign:PackIcon
|
|
Width="{StaticResource IconSize}"
|
|
Height="{StaticResource IconSize}"
|
|
Kind="DeleteOutline" />
|
|
</Button>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Expander.Header>
|
|
<StackPanel
|
|
Margin="46,8,24,16"
|
|
Orientation="Vertical"
|
|
TextBlock.Foreground="{DynamicResource MaterialDesignBody}">
|
|
<WrapPanel Orientation="Horizontal">
|
|
<ToggleButton
|
|
x:Name="TglBtnAlwaysOnTop"
|
|
Margin="5,0,0,0"
|
|
IsChecked="{Binding DataItem.AlwaysOnTop, Mode=TwoWay, NotifyOnSourceUpdated=True}"
|
|
IsEnabled="{c:Binding !DataItem.FullScreen}"
|
|
SourceUpdated="Data_SourceUpdated"
|
|
Style="{StaticResource ToggleButton}" />
|
|
<TextBlock Style="{StaticResource TxtBlockDisableWhenFullScreen}" ToolTip="Set this panel to be always on top">
|
|
Always on Top
|
|
</TextBlock>
|
|
<ToggleButton
|
|
x:Name="TglBtnFullScreen"
|
|
Margin="0,0,0,0"
|
|
IsChecked="{Binding DataItem.FullScreen, Mode=TwoWay, NotifyOnSourceUpdated=True}"
|
|
SourceUpdated="Data_SourceUpdated"
|
|
Style="{StaticResource ToggleButton}" />
|
|
<TextBlock Style="{StaticResource TextBlockLabel}" ToolTip="Expand this panel into full screen (emulate keystroke Alt-Enter)">Full Screen Mode</TextBlock>
|
|
<ToggleButton
|
|
x:Name="TglBtnHideTitlebar"
|
|
Margin="0,0,0,0"
|
|
IsChecked="{Binding DataItem.HideTitlebar, Mode=TwoWay, NotifyOnSourceUpdated=True}"
|
|
IsEnabled="{c:Binding !DataItem.FullScreen}"
|
|
SourceUpdated="Data_SourceUpdated"
|
|
Style="{StaticResource ToggleButton}" />
|
|
<TextBlock Style="{StaticResource TxtBlockDisableWhenFullScreen}" ToolTip="Hide the title bar for this panel">
|
|
Hide Title Bar
|
|
</TextBlock>
|
|
<ToggleButton
|
|
x:Name="TglBtnAutoGameRefocus"
|
|
Margin="0,0,0,0"
|
|
IsChecked="{Binding DataItem.AutoGameRefocus, Mode=TwoWay, NotifyOnSourceUpdated=True}"
|
|
SourceUpdated="Data_SourceUpdated"
|
|
Style="{StaticResource ToggleButton}" />
|
|
<TextBlock Style="{StaticResource TextBlockLabel}" ToolTip="Automatic game refocus when clicking this panel or when using touch on this panel">Auto Game Refocus</TextBlock>
|
|
</WrapPanel>
|
|
<WrapPanel Margin="0,10,0,0" VerticalAlignment="Center">
|
|
<Border
|
|
BorderBrush="Gray"
|
|
BorderThickness="{c:Binding 'DataItem.FloatingPanel.IsEnabled ? 1 : 0'}"
|
|
CornerRadius="4">
|
|
<WrapPanel Margin="4">
|
|
<ToggleButton
|
|
x:Name="TglBtnAllowFloatPanel"
|
|
Margin="0,4,0,4"
|
|
VerticalAlignment="Center"
|
|
IsChecked="{Binding DataItem.FloatingPanel.IsEnabled, Mode=TwoWay, NotifyOnSourceUpdated=True}"
|
|
SourceUpdated="Data_SourceUpdated"
|
|
Style="{StaticResource ToggleButton}" />
|
|
<TextBlock
|
|
Margin="5,4,10,4"
|
|
VerticalAlignment="Center"
|
|
Style="{StaticResource TextBlockLabel}"
|
|
ToolTip="Set the pop out panel that can float above other windows">
|
|
Floating Panel Toggle
|
|
</TextBlock>
|
|
<WrapPanel
|
|
Margin="10,0,0,0"
|
|
VerticalAlignment="Center"
|
|
Visibility="{c:Binding DataItem.FloatingPanel.IsEnabled}">
|
|
<TextBlock
|
|
Margin="5,4,10,4"
|
|
VerticalAlignment="Center"
|
|
Style="{StaticResource TextBlockLabel}"
|
|
Text="Keyboard Binding:" />
|
|
<TextBlock
|
|
x:Name="TextBlockFloatPanelKeyBinding"
|
|
Margin="5,4,10,4"
|
|
VerticalAlignment="Center"
|
|
Style="{StaticResource TextBlockLabel}"
|
|
Text="{Binding DataItem.FloatingPanel.KeyboardBinding, Converter={StaticResource KeystrokeBindingsConverter}, ConverterParameter=' + '}"
|
|
Visibility="{c:Binding '!DataItem.FloatingPanel.IsDetectingKeystroke'}" />
|
|
<TextBlock
|
|
x:Name="TextBlockDetectingFloatPanelKeyBinding"
|
|
Margin="5,4,10,4"
|
|
VerticalAlignment="Center"
|
|
Style="{StaticResource TextBlockLabel}"
|
|
Text="Scanning..."
|
|
Visibility="{c:Binding 'DataItem.FloatingPanel.IsDetectingKeystroke'}" />
|
|
<Button
|
|
x:Name="BtnDetectFloatPanelKeyBinding"
|
|
Width="80"
|
|
Height="25"
|
|
Margin="10,0,0,0"
|
|
VerticalAlignment="Center"
|
|
Command="{Binding DetectFloatPanelKeyBindingCommand}"
|
|
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>
|
|
</WrapPanel>
|
|
</StackPanel>
|
|
</Expander>
|
|
</DockPanel>
|
|
</UserControl>
|