aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachinesProvider.cs
blob: 01b74e8a64872e731c2bfaf6402ae2058eac4235 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.AutoComplete.Editors;
using Tango.BL;
using Tango.BL.Entities;

namespace Tango.MachineStudio.MachineDesigner.AutoComplete
{
    /// <summary>
    /// Represents an auto-complete <see cref="Machine">Machines</see> provider.
    /// </summary>
    /// <seealso cref="Tango.AutoComplete.Editors.ISuggestionProvider" />
    public class MachinesProvider : ISuggestionProvider
    {
        /// <summary>
        /// Gets the suggestions.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <returns></returns>
        public IEnumerable GetSuggestions(string filter)
        {
            return ObservablesEntitiesAdapter.Instance.Machines.Where(x => x.SerialNumber.StartsWith(filter, StringComparison.CurrentCultureIgnoreCase)).ToList();
        }
    }
}