Skip to content
This repository has been archived by the owner on Oct 6, 2024. It is now read-only.

Remove limit on controls shown in GUI #20

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BIOSBuddy/BIOSBuddy.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyVersion>1.0.6</AssemblyVersion>
<AssemblyVersion>1.0.8</AssemblyVersion>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
Expand Down
19 changes: 2 additions & 17 deletions src/BIOSBuddy/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public partial class MainWindow : IDisposable, IDcsBiosConnectionListener, ICate
private readonly List<DCSBIOSControlUserControl> _dcsbiosUIControlPanels = new();
private DCSBIOS _dcsBios;
private bool _formLoaded;
private const int MAX_CONTROLS_ON_PAGE = 70;
private DCSBIOSOutput _dcsbiosVersionOutput;
private bool _checkDCSBIOSVersionOnce;
private List<DCSBIOSControl> _metaControls;
Expand Down Expand Up @@ -309,14 +308,6 @@ private void UpdateComboBoxCategories()
{
var categoriesList = _loadedControls.Select(o => o.Category).DistinctBy(o => o).ToList();

if (_loadedControls.Count() <= MAX_CONTROLS_ON_PAGE)
{
/*
* If there aren't many controls to show then allow the user to show
* all categories at once.
*/
categoriesList.Insert(0, "All");
}
ComboBoxCategory.DataContext = categoriesList;
ComboBoxCategory.ItemsSource = categoriesList;
ComboBoxCategory.Items.Refresh();
Expand Down Expand Up @@ -432,7 +423,7 @@ private void ShowControls(bool searching = false)
/*
* Limit only on category if user is not searching
*/
if (string.IsNullOrEmpty(searchText) && ComboBoxCategory.SelectedValue != null && ComboBoxCategory.SelectedValue.ToString() != "All")
if (string.IsNullOrEmpty(searchText) && ComboBoxCategory.SelectedValue != null)
{
filteredControls = _loadedControls.Where(o => o.Category == ComboBoxCategory.SelectedValue.ToString())
.ToList();
Expand All @@ -444,13 +435,7 @@ private void ShowControls(bool searching = false)
filteredControls = _loadedControls.Where(o => o.Description.ToLower().Contains(searchWord) || o.Identifier.ToLower().Contains(searchWord))
.ToList();
}

if (filteredControls.Count() > MAX_CONTROLS_ON_PAGE)
{
Common.ShowMessageBox($"Query returned {filteredControls.Count()} DCS-BIOS Controls. Max controls that can be displayed at any time is {MAX_CONTROLS_ON_PAGE}.");
return;
}


foreach (var dcsbiosControl in filteredControls)
{
var luaCommand = DCSBIOSControlLocator.GetLuaCommand(dcsbiosControl.Identifier, true);
Expand Down
Loading