Use OnCommit instead of OnChange simplifies things

This commit is contained in:
Drew DeVault 2017-01-31 19:48:33 -05:00
parent f740707712
commit b1a55f6b5e
2 changed files with 5 additions and 5 deletions

View File

@ -51,7 +51,11 @@ public FilterControl()
}
};
searchTextBox.OnChange += (sender, text) => FilterChanged?.Invoke();
searchTextBox.OnCommit += (sender, newText) =>
{
if (newText)
FilterChanged?.Invoke();
};
searchTextBox.Exit = () => Exit?.Invoke();
}

View File

@ -189,13 +189,9 @@ private void load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game,
}
private ScheduledDelegate filterTask;
private string previousFilter = string.Empty;
private void filterChanged()
{
if (previousFilter == filter.Search)
return;
previousFilter = filter.Search;
filterTask?.Cancel();
filterTask = Scheduler.AddDelayed(() =>
{