aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachineVersionsProvider.cs
blob: 75b4718cdc50f17669bed98d465fd8f4a182304a (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
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="MachineVersion">Machine Versions</see> provider.
    /// </summary>
    /// <seealso cref="Tango.AutoComplete.Editors.ISuggestionProvider" />
    public class MachineVersionsProvider : ISuggestionProvider
    {
        public String Text { get; set; }

        public IEnumerable GetSuggestions(string filter)
        {
            Text = filter;
            return ObservablesStaticCollections.Instance.MachineVersions.Where(x => x.Version.ToString().StartsWith(filter, StringComparison.CurrentCultureIgnoreCase) || x.Name.StartsWith(filter, StringComparison.CurrentCultureIgnoreCase)).ToList();
        }
    }
}