aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-03-15 12:29:05 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-03-15 12:29:05 +0200
commitd6f46df0e9ccd08276912bcdcded246de0bc4447 (patch)
tree12b743658b9ef5b48c4e938bc63633eed2465594 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common
parent8356b90e200c1124e6dc89fe88f18f62c68b7623 (diff)
downloadTango-d6f46df0e9ccd08276912bcdcded246de0bc4447.tar.gz
Tango-d6f46df0e9ccd08276912bcdcded246de0bc4447.zip
Implemented virtual machine selection when connecting via USB.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/AutoComplete/MachinesProvider.cs29
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj1
2 files changed, 30 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/AutoComplete/MachinesProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/AutoComplete/MachinesProvider.cs
new file mode 100644
index 000000000..e486ec79a
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/AutoComplete/MachinesProvider.cs
@@ -0,0 +1,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.Common.AutoComplete
+{
+ /// <summary>
+ /// Represents an auto-complete machines suggestions 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) || x.Name.ToLower().Contains(filter.ToLower())).ToList();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj
index 529419bd7..7c28cb4c8 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj
@@ -80,6 +80,7 @@
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="AutoComplete\MachinesProvider.cs" />
<Compile Include="Controls\HiveColorPickerControl.xaml.cs">
<DependentUpon>HiveColorPickerControl.xaml</DependentUpon>
</Compile>