aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Controls/AutoCompleteProvider.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch/Controls/AutoCompleteProvider.cs')
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/AutoCompleteProvider.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/AutoCompleteProvider.cs b/Software/Visual_Studio/Tango.Touch/Controls/AutoCompleteProvider.cs
new file mode 100644
index 000000000..bc6b67bb3
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Touch/Controls/AutoCompleteProvider.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.Touch.Controls
+{
+ public interface IAutoCompleteProvider
+ {
+ IList Filter(IList list, String filter);
+ }
+
+ public class AutoCompleteProvider<T> : IAutoCompleteProvider
+ {
+ private Func<T, String, bool> _filter;
+
+ public AutoCompleteProvider(Func<T, string, bool> filter)
+ {
+ _filter = filter;
+ }
+
+ public IList Filter(IList list, String filter)
+ {
+ return list.Cast<T>().Where(x => _filter(x, filter)).ToList();
+ }
+ }
+}