1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-24 14:50:10 +00:00
msfs-popout-panel-manager/WpfApp/UserControlPanelSelection.xaml

156 lines
12 KiB
Text
Raw Normal View History

2022-01-27 13:40:04 +00:00
<UserControl x:Class="MSFSPopoutPanelManager.WpfApp.UserControlPanelSelection"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2022-06-30 23:53:08 +00:00
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
2022-01-27 13:40:04 +00:00
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
2022-06-30 23:53:08 +00:00
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
2022-01-27 13:40:04 +00:00
xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
2022-07-23 19:23:32 +00:00
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
2022-01-27 13:40:04 +00:00
mc:Ignorable="d"
2022-07-23 19:23:32 +00:00
Height="545"
2022-01-27 13:40:04 +00:00
Width="920"
2022-07-23 19:23:32 +00:00
Background="#FF323A64">
2022-01-27 13:40:04 +00:00
<UserControl.Resources>
2022-07-23 19:23:32 +00:00
<CollectionViewSource x:Key="UserProfilesViewSource" Source="{Binding ProfileData.Profiles, Mode=OneWay}">
2022-01-27 13:40:04 +00:00
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="ProfileName" />
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
2022-06-30 23:53:08 +00:00
<BooleanToVisibilityConverter x:Key="VisibleIfTrueConverter" />
2022-01-27 13:40:04 +00:00
</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" />
2022-04-18 03:38:33 +00:00
<WrapPanel Orientation="Horizontal" Margin="20,5,0,0" HorizontalAlignment="Left">
2022-04-18 16:24:00 +00:00
<ComboBox
x:Name="cmbProfile"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Width="450"
ItemsSource="{Binding Source={StaticResource UserProfilesViewSource}}"
2022-07-23 19:23:32 +00:00
SelectedItem="{Binding Path=ProfileData.ActiveProfile, Mode=OneWay}"
2022-04-18 16:24:00 +00:00
DisplayMemberPath="ProfileName"
2022-08-08 06:07:24 +00:00
SelectedValuePath="ProfileId"
IsEnabled="{c:Binding 'FlightSimData.IsSimulatorStarted and FlightSimData.HasCurrentMsfsAircraft'}">
2022-07-23 19:23:32 +00:00
<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}"/>
2022-01-27 13:40:04 +00:00
</WrapPanel>
2022-04-18 19:52:39 +00:00
<Separator Margin="5,10,5,5"/>
<Label HorizontalAlignment="Left" Margin="0,0,0,0" >
<TextBlock TextWrapping="WrapWithOverflow">
2022-08-02 15:51:28 +00:00
2. Bind active aircraft to the selected profile to automatically activate profile and pop out panels when flight session starts.
2022-04-18 19:52:39 +00:00
</TextBlock>
</Label>
2022-04-18 03:38:33 +00:00
<WrapPanel Orientation="Vertical" Margin="15,0,0,0" HorizontalAlignment="Left">
<WrapPanel Orientation="Horizontal" Margin="5,5,0,0" HorizontalAlignment="Left">
2022-08-02 15:51:28 +00:00
<Label Content="{c:Binding 'FlightSimData.CurrentMsfsAircraft == null ? &quot;Aircraft information is currently unavailable&quot; : FlightSimData.CurrentMsfsAircraft'}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" FontStyle="Italic" FontSize="16" Width="447">
2022-04-18 03:38:33 +00:00
<Label.Style>
<Style TargetType="{x:Type Label}">
<Style.Triggers>
2022-07-23 19:23:32 +00:00
<DataTrigger Binding="{Binding ProfileData.IsAircraftBoundToProfile}" Value="True">
2022-04-18 03:38:33 +00:00
<Setter Property="Foreground" Value="LightGreen" ></Setter>
</DataTrigger>
2022-07-23 19:23:32 +00:00
<DataTrigger Binding="{Binding ProfileData.IsAircraftBoundToProfile}" Value="False">
2022-08-02 15:51:28 +00:00
<Setter Property="Foreground" Value="White" ></Setter>
</DataTrigger>
<DataTrigger Binding="{c:Binding 'FlightSimData.CurrentMsfsAircraft == null'}" Value="True">
2022-04-18 03:38:33 +00:00
<Setter Property="Foreground" Value="AntiqueWhite" ></Setter>
2022-08-02 15:51:28 +00:00
<Setter Property="ToolTip" Value="No aircraft has been loaded by the game yet"></Setter>
2022-04-18 03:38:33 +00:00
</DataTrigger>
2022-08-02 15:51:28 +00:00
<DataTrigger Binding="{c:Binding 'FlightSimData.CurrentMsfsAircraft != null and !ProfileData.IsAllowedAddAircraftBinding and !ProfileData.IsAllowedDeleteAircraftBinding'}" Value="True">
2022-04-18 03:38:33 +00:00
<Setter Property="Foreground" Value="Red" ></Setter>
2022-08-01 23:21:42 +00:00
<Setter Property="ToolTip" Value="Aircraft is currently bound to another profile"></Setter>
2022-04-18 03:38:33 +00:00
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
</Label>
2022-07-23 19:23:32 +00:00
<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}"/>
2022-04-18 03:38:33 +00:00
</WrapPanel>
2022-01-27 13:40:04 +00:00
</WrapPanel>
2022-07-23 19:23:32 +00:00
<Separator Margin="5,10,5,5"/>
2022-06-30 23:53:08 +00:00
<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>
2022-07-23 19:23:32 +00:00
<WrapPanel Orientation="Horizontal">
<Label Content="CTRL + LEFT CLICK" Foreground="AntiqueWhite" />
<Label Content="when all panels have been selected or to cancel selections." />
</WrapPanel>
2022-06-30 23:53:08 +00:00
<WrapPanel Orientation="Horizontal" Margin="0,5,0,0" HorizontalAlignment="Left">
2022-07-23 19:23:32 +00:00
<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}"/>
2022-06-30 23:53:08 +00:00
</WrapPanel>
2022-01-27 13:40:04 +00:00
</WrapPanel>
2022-06-30 23:53:08 +00:00
<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" />
2022-07-23 19:23:32 +00:00
<Button Content="Start Pop Out" HorizontalAlignment="Left" Margin="20,5,0,0" Width="130" Command="{Binding StartPopOutCommand}"/>
2022-06-30 23:53:08 +00:00
</WrapPanel>
<WrapPanel Orientation="Vertical" Visibility="Visible">
2022-01-27 13:40:04 +00:00
</WrapPanel>
</WrapPanel>
<DockPanel DockPanel.Dock="Right" Width="325" HorizontalAlignment="Center">
<Label DockPanel.Dock="Top" Content="Panel Locations" HorizontalAlignment="Center" Margin="0,10,0,0"/>
2022-07-23 19:23:32 +00:00
<DataGrid DockPanel.Dock="Top" HorizontalAlignment="Center" Width="290" Height="435" AutoGenerateColumns="False" CanUserResizeColumns="False" HorizontalScrollBarVisibility="Disabled"
2022-01-27 13:40:04 +00:00
CanUserReorderColumns="False" CanUserResizeRows="False" IsReadOnly="True" HorizontalGridLinesBrush="#B9B9B9" VerticalGridLinesBrush="#B9B9B9" GridLinesVisibility="Horizontal" BorderThickness="1"
2022-07-23 19:23:32 +00:00
CanUserAddRows="False" CanUserSortColumns="False" ItemsSource="{Binding ProfileData.ActiveProfile.PanelSourceCoordinates}">
2022-01-27 13:40:04 +00:00
<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>
2022-07-23 19:23:32 +00:00
<CheckBox DockPanel.Dock="Bottom" Content="Edit Panel Location Overlay" HorizontalAlignment="Center" Command="{Binding EditPanelSourceCommand}" IsChecked="{Binding PanelSource.IsEditingPanelSource, Mode=OneWay}"/>
2022-01-27 13:40:04 +00:00
</DockPanel>
</DockPanel>
</Grid>
</UserControl>