Skip to content

Commit

Permalink
Bugfix, options now shown when choosing profile (#437)
Browse files Browse the repository at this point in the history
* Bugfix, options now shown when choosing profile

* compile
  • Loading branch information
jdahlblom authored Nov 29, 2023
1 parent 9c27004 commit e04b5ef
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Source/DCSFlightpanels/DCSFlightpanels.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</Authors>
<PackageId>DCSFlightpanels (DCSFP)</PackageId>
<Version>1.0.0</Version>
<AssemblyVersion>4.11.1</AssemblyVersion>
<AssemblyVersion>4.11.2</AssemblyVersion>
<FileVersion>
</FileVersion>
<ApplicationIcon>Images\UI\flightpanels02_8Rc_icon.ico</ApplicationIcon>
Expand Down
15 changes: 8 additions & 7 deletions Source/DCSFlightpanels/Windows/ChooseProfileModuleWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,27 @@
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" >
<Label Content="Module:" Margin="5,0,0,0"/>
<ComboBox Name="ComboBoxAirframe" ToolTip="Cockpit controls from DCS-BIOS will be loaded based on the selected airframe" HorizontalAlignment="Left" Margin="10,0,10,0" Width="150" SelectedIndex="0" SelectionChanged="ComboBoxAirframe_OnSelectionChanged"/>
</StackPanel>
<StackPanel Name="StackPanelUseGenericRadio" Grid.Row="1" Visibility="Collapsed">
<StackPanel Name="StackPanelUseGenericRadio" Grid.Row="1" Visibility="Visible">
<CheckBox Name="CheckBoxUseGenericRadio" IsChecked="False" Content="Use Generic Radio Panel" Margin="10,10,0,0" />
<StackPanel Name="StackPanelA10C" Margin="10,5,0,0" Visibility="Collapsed">
<RadioButton Name="RadioButtonA10C" GroupName="A10" IsChecked="True">A10-C</RadioButton>
<RadioButton Name="RadioButtonA10CII" GroupName="A10">A10-C II</RadioButton>
</StackPanel>
</StackPanel>
<StackPanel Grid.Row="2" >
<StackPanel Name="StackPanelA10C" Grid.Row="2" Visibility="Visible" Margin="10,5,0,0" >
<RadioButton Name="RadioButtonA10C" GroupName="A10" IsChecked="True">A10-C</RadioButton>
<RadioButton Name="RadioButtonA10CII" GroupName="A10">A10-C II</RadioButton>
</StackPanel>
<StackPanel Grid.Row="3" >
<Label Margin="0,15,0,0">
<TextBlock TextWrapping="Wrap">
For keyboard emulation only (SwitchPanel PZ55, Multipanel PZ70, TPM) choose "KeyEmulator".
</TextBlock>
</Label>
</StackPanel>
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,10,0" >
<StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,10,0" >
<Button Name="ButtonOk" Content="Ok" Click="ButtonOk_OnClick" Width="75" Height="25" Margin="0,0,5,0" />
<Button Name="ButtonCancel" Content="Cancel" Click="ButtonCancel_OnClick" Width="75" Height="25" HorizontalAlignment="Right" />
</StackPanel>
Expand Down
15 changes: 13 additions & 2 deletions Source/DCSFlightpanels/Windows/ChooseProfileModuleWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace DCSFlightpanels.Windows
public partial class ChooseProfileModuleWindow
{
private DCSAircraft _dcsAircraft;
private bool _isLoaded;

public ChooseProfileModuleWindow()
{
Expand All @@ -23,8 +24,11 @@ public ChooseProfileModuleWindow()

private void ChooseProfileModuleWindow_OnLoaded(object sender, RoutedEventArgs e)
{
if (_isLoaded) return;

PopulateAirframeCombobox();
DarkMode.SetFrameworkElementDarkMode(this);
_isLoaded = true;
}

private void ButtonCancel_OnClick(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -53,8 +57,7 @@ private void ButtonOk_OnClick(object sender, RoutedEventArgs e)
Common.ShowErrorMessageBox( ex);
}
}



private void PopulateAirframeCombobox()
{
if (!IsLoaded)
Expand All @@ -77,6 +80,14 @@ private void PopulateAirframeCombobox()
ComboBoxAirframe.ItemsSource = itemsSource;
ComboBoxAirframe.SelectedIndex = 0;
ComboBoxAirframe.SelectionChanged += ComboBoxAirframe_OnSelectionChanged;

if (ComboBoxAirframe.Items.Count <= 0)
{
return;
}

SetAirframe();
StackPanelA10C.Visibility = DCSAircraft.IsA10C(_dcsAircraft) ? Visibility.Visible : Visibility.Collapsed;
}

private void SetAirframe()
Expand Down

0 comments on commit e04b5ef

Please sign in to comment.