1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-22 05:40:11 +00:00
msfs-popout-panel-manager/WpfApp/UserControlPanelSelection.xaml
2022-07-23 15:23:32 -04:00

150 lines
12 KiB
XML

<UserControl x:Class="MSFSPopoutPanelManager.WpfApp.UserControlPanelSelection"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
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:c="clr-namespace:CalcBinding;assembly=CalcBinding"
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
mc:Ignorable="d"
Height="545"
Width="920"
Background="#FF323A64">
<UserControl.Resources>
<CollectionViewSource x:Key="UserProfilesViewSource" Source="{Binding ProfileData.Profiles, Mode=OneWay}">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="ProfileName" />
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
<BooleanToVisibilityConverter x:Key="VisibleIfTrueConverter" />
</UserControl.Resources>
<Grid>
<DockPanel>
<WrapPanel DockPanel.Dock="Left" Orientation="Vertical" Margin="15,10,0,0" Width="585" HorizontalAlignment="Left">
<Label Content="1. Please select a profile you would like to use." HorizontalAlignment="Left" />
<WrapPanel Orientation="Horizontal" Margin="20,5,0,0" HorizontalAlignment="Left">
<ComboBox
x:Name="cmbProfile"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Width="450"
ItemsSource="{Binding Source={StaticResource UserProfilesViewSource}}"
SelectedItem="{Binding Path=ProfileData.ActiveProfile, Mode=OneWay}"
DisplayMemberPath="ProfileName"
SelectedValuePath="ProfileId">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding ChangeProfileCommand}" CommandParameter="{Binding ElementName=cmbProfile, Path=SelectedValue}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</ComboBox>
<Button Content="+" ToolTip="Add Profile" HorizontalAlignment="Left" Margin="10,0,0,0" Width="40" Command="{Binding AddProfileCommand}" />
<Button Content="-" ToolTip="Delete Profile" HorizontalAlignment="Left" Margin="10,0,0,0" Width="40" Command="{Binding DeleteProfileCommand}"/>
</WrapPanel>
<Separator Margin="5,10,5,5"/>
<Label HorizontalAlignment="Left" Margin="0,0,0,0" >
<TextBlock TextWrapping="WrapWithOverflow">
2. Bind active aircraft livery to the selected profile to automatically activate profile and to automatically pop out panels when a flight session starts.
</TextBlock>
</Label>
<WrapPanel Orientation="Vertical" Margin="15,0,0,0" HorizontalAlignment="Left">
<WrapPanel Orientation="Horizontal" Margin="5,5,0,0" HorizontalAlignment="Left">
<Label Content="{c:Binding 'FlightSimData.CurrentMsfsPlaneTitle == null ? &quot;Active aircraft livery is unavailable&quot; : FlightSimData.CurrentMsfsPlaneTitle'}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" FontStyle="Italic" Width="447">
<Label.Style>
<Style TargetType="{x:Type Label}">
<Style.Triggers>
<DataTrigger Binding="{Binding ProfileData.IsAircraftBoundToProfile}" Value="True">
<Setter Property="Foreground" Value="LightGreen" ></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding ProfileData.IsAircraftBoundToProfile}" Value="False">
<Setter Property="Foreground" Value="AntiqueWhite" ></Setter>
</DataTrigger>
<DataTrigger Binding="{c:Binding '!ProfileData.IsAllowedAddAircraftBinding and !ProfileData.IsAllowedDeleteAircraftBinding'}" Value="True">
<Setter Property="Foreground" Value="Red" ></Setter>
<Setter Property="ToolTip" Value="Aircraft Livery is currently bound to another profile"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
</Label>
<Button Content="+" ToolTip="Add Binding" Margin="10,0,0,0" Width="40" Command="{Binding AddProfileBindingCommand}"/>
<Button Content="-" ToolTip="Delete Binding" Margin="10,0,0,0" Width="40" Command="{Binding DeleteProfileBindingCommand}"/>
</WrapPanel>
<CheckBox Margin="10,5,0,0" Content="Power on required to pop out panels on cold start (G1000 / NXi Only)" IsChecked="{Binding ProfileData.ActiveProfile.PowerOnRequiredForColdStart}" Command="{Binding SetPowerOnRequiredCommand}" />
<WrapPanel Name="TouchPanelConfigurationPanel" Orientation="Horizontal" Margin="0,10,0,0" Visibility="{Binding AppSettingData.AppSetting.IsEnabledTouchPanelServer, Converter={StaticResource VisibleIfTrueConverter}, Mode=OneWay}" >
<Label Content="Open MSFS touch panel when flight session starts" Margin="5,0,0,0" />
<Button Content="+" ToolTip="Add Binding" Margin="94,0,0,0" Width="40" Command="{Binding OpenTouchPanelBindingCommand}"/>
</WrapPanel>
</WrapPanel>
<Separator Margin="5,10,5,5"/>
<WrapPanel Orientation="Vertical">
<Label Content="3. Identify pop out panel locations in the game by clicking on them." Margin="0,0,0,0" />
<WrapPanel Orientation="Vertical" Margin="20,0,0,0" HorizontalAlignment="Left">
<WrapPanel Orientation="Horizontal">
<Label Content="LEFT CLICK" Foreground="AntiqueWhite"/>
<Label Content="to add a new panel."/>
</WrapPanel>
<WrapPanel Orientation="Horizontal">
<Label Content="SHIFT + LEFT CLICK" Foreground="AntiqueWhite" />
<Label Content="to remove the most recently added panel."/>
</WrapPanel>
<WrapPanel Orientation="Horizontal">
<Label Content="CTRL + LEFT CLICK" Foreground="AntiqueWhite" />
<Label Content="when all panels have been selected or to cancel selections." />
</WrapPanel>
<WrapPanel Orientation="Horizontal" Margin="0,5,0,0" HorizontalAlignment="Left">
<Button Content="Start Panel Selection" HorizontalAlignment="Left" Margin="0,0,0,0" Width="165" Command="{Binding StartPanelSelectionCommand}"/>
<Button Content="Override Auto Panning Camera" HorizontalAlignment="Left" Margin="20,0,0,0" Width="240" Command="{Binding SaveAutoPanningCameraCommand}"/>
</WrapPanel>
</WrapPanel>
<Separator Margin="5,10,5,5"/>
</WrapPanel>
<WrapPanel Orientation="Vertical" >
<Label Content="4. Start the pop out process for selected panels." Margin="0,0,0,0" />
<Button Content="Start Pop Out" HorizontalAlignment="Left" Margin="20,5,0,0" Width="130" Command="{Binding StartPopOutCommand}"/>
</WrapPanel>
<WrapPanel Orientation="Vertical" Visibility="Visible">
</WrapPanel>
</WrapPanel>
<DockPanel DockPanel.Dock="Right" Width="325" HorizontalAlignment="Center">
<Label DockPanel.Dock="Top" Content="Panel Locations" HorizontalAlignment="Center" Margin="0,10,0,0"/>
<DataGrid DockPanel.Dock="Top" HorizontalAlignment="Center" Width="290" Height="435" AutoGenerateColumns="False" CanUserResizeColumns="False" HorizontalScrollBarVisibility="Disabled"
CanUserReorderColumns="False" CanUserResizeRows="False" IsReadOnly="True" HorizontalGridLinesBrush="#B9B9B9" VerticalGridLinesBrush="#B9B9B9" GridLinesVisibility="Horizontal" BorderThickness="1"
CanUserAddRows="False" CanUserSortColumns="False" ItemsSource="{Binding ProfileData.ActiveProfile.PanelSourceCoordinates}">
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="TextBlock.TextAlignment" Value="Center" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Focusable" Value="False" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="IsHitTestVisible" Value="False" />
<Setter Property="Margin" Value="5, 5, 5, 0" />
<Setter Property="Height" Value="28" />
</Style>
</DataGrid.CellStyle>
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="TextBlock.TextAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="controls:ControlsHelper.ContentCharacterCasing" Value="Normal"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="Height" Value="30"/>
<Setter Property="Background" Value="#FF576573"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#FFB9B9B9"/>
<Setter Property="Padding" Value="5,0,5,0"/>
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="Panel" Width="97" Binding="{Binding PanelIndex}"/>
<DataGridTextColumn Header="X-Pos" Width="97" Binding="{Binding X}"/>
<DataGridTextColumn Header="Y-Pos" Width="97" Binding="{Binding Y}"/>
</DataGrid.Columns>
</DataGrid>
<CheckBox DockPanel.Dock="Bottom" Content="Edit Panel Location Overlay" HorizontalAlignment="Center" Command="{Binding EditPanelSourceCommand}" IsChecked="{Binding PanelSource.IsEditingPanelSource, Mode=OneWay}"/>
</DockPanel>
</DockPanel>
</Grid>
</UserControl>