Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server Forms Search Boxes #1038

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
22 changes: 22 additions & 0 deletions Server.MirForms/Database/GameShop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public GameShop()
InitializeComponent();

LoadGameShopItems();

GameShopSearchBox_TextChanged(this, EventArgs.Empty);
}

private void GameShop_Load(object sender, EventArgs e)
Expand Down Expand Up @@ -471,5 +473,25 @@ private void ItemComboBox_SelectedIndexChanged(object sender, EventArgs e)
int selectedIndex = GameShopListBox.SelectedIndex;
GameShopListBox.Items[selectedIndex] = selectedGameShopItem;
}

#region Search Box
private void GameShopSearchBox_TextChanged(object sender, EventArgs e)
JevLOMCN marked this conversation as resolved.
Show resolved Hide resolved
{
string searchText = GameShopSearchBox.Text.Trim().ToLower();

GameShopListBox.Items.Clear();

foreach (var item in SMain.EditEnvir.GameShopList)
{
// Add to list if search text is empty or the item matches the search criteria
if (string.IsNullOrEmpty(searchText) ||
(!string.IsNullOrEmpty(item.Info?.Name) && item.Info.Name.ToLower().Contains(searchText)))
{
GameShopListBox.Items.Add(item);
}
}
}

#endregion
}
}
19 changes: 16 additions & 3 deletions Server.MirForms/Database/GameShop.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Server.MirForms/Database/MagicInfoForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading