Skip to content

Commit

Permalink
Dcsbios description (#396)
Browse files Browse the repository at this point in the history
* Adds description automatically to new dcs-bios inputs

* compile

* compile
  • Loading branch information
jdahlblom authored Oct 16, 2023
1 parent 01f4705 commit fcee807
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
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.10.3</AssemblyVersion>
<AssemblyVersion>4.10.4</AssemblyVersion>
<FileVersion>
</FileVersion>
<ApplicationIcon>flightpanels02_8Rc_icon.ico</ApplicationIcon>
Expand Down
22 changes: 22 additions & 0 deletions Source/DCSFlightpanels/Windows/DCSBIOSInputControlsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public partial class DCSBIOSInputControlsWindow : IIsDirty
private bool _isDirty;
private readonly bool _showSequenced;
private bool _isSequenced;
private readonly string _dcsbiosString = "DCS-BIOS";

public DCSBIOSInputControlsWindow(string header, string description, bool isSequenced, bool showSequenced)
{
Expand Down Expand Up @@ -66,6 +67,7 @@ private void SetFormState()
UpButton.IsEnabled = DataGridValues.Items.Count > 0 && DataGridValues.SelectedItem != null && DataGridValues.SelectedIndex > 0;
DownButton.IsEnabled = DataGridValues.Items.Count > 0 && DataGridValues.SelectedItem != null && DataGridValues.SelectedIndex < DataGridValues.Items.Count - 1;
ButtonOk.IsEnabled = _isDirty;
SetDescription();
}

private void ShowItems()
Expand Down Expand Up @@ -226,6 +228,26 @@ private void TextBoxDescription_OnKeyDown(object sender, KeyEventArgs e)
SetFormState();
}

private void SetDescription()
{
if (_dcsbiosInputs.Count == 1)
{
TextBoxDescription.Text = _dcsbiosInputs[0].ControlId;
return;
}

if (_dcsbiosInputs.Count > 1 && TextBoxDescription.Text == _dcsbiosInputs[0].ControlId)
{
TextBoxDescription.Text = _dcsbiosString;
return;
}

if (string.IsNullOrEmpty(TextBoxDescription.Text))
{
TextBoxDescription.Text = _dcsbiosString;
}
}

public void SetIsDirty()
{
_isDirty = true;
Expand Down

0 comments on commit fcee807

Please sign in to comment.