Exemplo n.º 1
0
 /// <summary>
 /// Constructor that accepts the full list of possible items.
 /// </summary>
 /// <param name="sourceList">The sorted source list of objects.</param>
 /// <param name="formatHandler">A delegate that returns a formatted text string for the input object.</param>
 /// <param name="refinementStrategy">An object that specifies how the shortlist is refined in response to user input.</param>
 public DefaultSuggestionProvider(IList <TItem> sourceList, Converter <TItem, string> formatHandler, IRefinementStrategy refinementStrategy)
     : base(refinementStrategy)
 {
     _shortlistProvider = delegate(string q) { return(string.IsNullOrEmpty(q) ? null : sourceList); };
     _formatHandler     = formatHandler;
     this.AutoSort      = false;         // assume the source list is already sorted
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor that accepts a delegate for providing a shortlist on demand.
 /// </summary>
 /// <param name="shortlistProvider">A delegate that obtains the shortlist for a specified query, or null to indicate that it should be called again.</param>
 /// <param name="formatHandler">A delegate that returns a formatted text string for the input object.</param>
 /// <param name="refinementStrategy">An object that specifies how the shortlist is refined in response to user input.</param>
 public DefaultSuggestionProvider(Converter <string, IList <TItem> > shortlistProvider, Converter <TItem, string> formatHandler, IRefinementStrategy refinementStrategy)
     : base(refinementStrategy)
 {
     _shortlistProvider = shortlistProvider;
     _formatHandler     = formatHandler;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 protected SuggestionProviderBase(IRefinementStrategy refinementStrategy)
 {
     _state = new CleanState(this);
     _refinementStrategy = refinementStrategy;
     this.AutoSort       = true;         // default
 }