using System; namespace Kingo.Plugin.NYYP { /// /// Represents an object to configure . /// public class AutoCompleteComboBoxSetting { /// /// Gets a filter function which determines whether items should be suggested or not /// for the specified query. /// Default: Gets the filter which maps an item to true /// if its text contains the query (case insensitive). /// /// /// The string input by user. /// /// /// The function to get a string which identifies the specified item. /// /// public virtual Predicate GetFilter(string query, Func stringFromItem) { return item => stringFromItem(item).IndexOf(query, StringComparison.InvariantCultureIgnoreCase) >= 0; } /// /// Gets an integer. /// The combobox opens the drop down /// if the number of suggested items is less than the value. /// Note that the value is larger, it's heavier to open the drop down. /// Default: 100. /// public virtual int MaxSuggestionCount { get { return 100; } } /// /// Gets the duration to delay updating the suggestion list. /// Returns Zero if no delay. /// Default: 300ms. /// public virtual TimeSpan Delay { get { return TimeSpan.FromMilliseconds(300.0); } } static AutoCompleteComboBoxSetting @default = new AutoCompleteComboBoxSetting(); /// /// Gets the default setting. /// public static AutoCompleteComboBoxSetting Default { get { return @default; } set { if (value == null) throw new ArgumentNullException(nameof(value)); @default = value; } } } }