From 6900c4dea48adb484efc9648e081b7b3f75bd60c Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 4 Jan 2018 15:26:21 +0200 Subject: Progress on Machine Designer.. --- .../AutoComplete/MachinesProvider.cs | 19 + .../Images/app.png | Bin 0 -> 1211 bytes .../Images/dispenser.png | Bin 18037 -> 16541 bytes .../Images/embedded-software.png | Bin 0 -> 768 bytes .../Images/embedded.png | Bin 0 -> 560 bytes .../Images/mid-tank.png | Bin 2800 -> 2624 bytes .../Images/tablet.png | Bin 0 -> 792 bytes .../Tango.MachineStudio.MachineDesigner.csproj | 14 + .../ViewModels/MainViewVM.cs | 68 ++- .../Views/MainView.xaml | 483 +++++++++++++++++---- .../Views/MainView.xaml.cs | 32 +- .../packages.config | 1 + 12 files changed, 521 insertions(+), 96 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachinesProvider.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/app.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/embedded-software.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/embedded.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/tablet.png (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachinesProvider.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachinesProvider.cs new file mode 100644 index 000000000..943c52f81 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachinesProvider.cs @@ -0,0 +1,19 @@ +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.DAL.Observables; + +namespace Tango.MachineStudio.MachineDesigner.AutoComplete +{ + public class MachinesProvider : ISuggestionProvider + { + public IEnumerable GetSuggestions(string filter) + { + return ObservablesEntitiesAdapter.Instance.Machines.Where(x => x.SerialNumber.StartsWith(filter, StringComparison.CurrentCultureIgnoreCase)).ToList(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/app.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/app.png new file mode 100644 index 000000000..9798ed866 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/app.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/dispenser.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/dispenser.png index 82cf1a39a..b7c292bf9 100644 Binary files a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/dispenser.png and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/dispenser.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/embedded-software.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/embedded-software.png new file mode 100644 index 000000000..b6a2087aa Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/embedded-software.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/embedded.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/embedded.png new file mode 100644 index 000000000..d0b917b44 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/embedded.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/mid-tank.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/mid-tank.png index d22896e86..6603d1b9f 100644 Binary files a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/mid-tank.png and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/mid-tank.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/tablet.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/tablet.png new file mode 100644 index 000000000..1a09683eb Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/tablet.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj index fbec9280e..2c3f6c674 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj @@ -31,6 +31,9 @@ 4 + + ..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll + ..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll @@ -71,6 +74,7 @@ + @@ -183,5 +187,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index dbba1962e..241297d85 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -32,7 +32,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels public Machine Machine { get { return _machine; } - set { _machine = value; RaisePropertyChangedAuto(); } + set { _machine = value; RaisePropertyChangedAuto(); OnMachineChanged(); } } private Configuration _configuration; @@ -45,8 +45,22 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels set { _configuration = value; RaisePropertyChangedAuto(); } } + private IdsPack _selectedIds; + /// + /// Gets or sets the selected ids pack. + /// + public IdsPack SelectedIds + { + get { return _selectedIds; } + set { _selectedIds = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + public RelayCommand SaveCommand { get; set; } + public RelayCommand AddIdsCommand { get; set; } + + public RelayCommand RemoveIdsCommand { get; set; } + /// /// Initializes a new instance of the class. /// @@ -56,15 +70,59 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels Adapter = ObservablesEntitiesAdapter.Instance; Configuration = new Configuration(); - Configuration.Name = "Config 2"; + Configuration.Name = "Untitled"; + SaveCommand = new RelayCommand(Save, (x) => !_isSaving); + AddIdsCommand = new RelayCommand(AddIds, (x) => !_isSaving && Configuration.IdsPacks.Count < 8); + RemoveIdsCommand = new RelayCommand(RemoveIds, (x) => !_isSaving && SelectedIds != null); + } - for (int i = 0; i < 8; i++) + private void OnMachineChanged() + { + if (Machine != null) + { + Configuration = Machine.Configuration; + } + else { - Configuration.IdsPacks.Add(new IdsPack() { Name = "IDS PACK " + i }); + Configuration = new Configuration() { Name = "Untitled" }; } + } - SaveCommand = new RelayCommand(Save, (x) => !_isSaving); + public void DropTouchPanel(ApplicationDisplayPanelVersion applicationDisplayPanelVersion) + { + Configuration.ApplicationDisplayPanelVersions = applicationDisplayPanelVersion; + Configuration.ApplicationDisplayPanelVersionGuid = applicationDisplayPanelVersion.Guid; + } + + public void DropApplicationVersion(ApplicationVersion applicationVersion) + { + Configuration.ApplicationVersions = applicationVersion; + Configuration.ApplicationVersionGuid = applicationVersion.Guid; + } + + public void DropEmbeddedFirmware(EmbeddedFirmwareVersion embeddedFirmwareVersion) + { + Configuration.EmbeddedFirmwareVersions = embeddedFirmwareVersion; + Configuration.EmbeddedFirmwareVersionGuid = embeddedFirmwareVersion.Guid; + } + + public void DropEmbeddedSoftware(EmbeddedSoftwareVersion embeddedSoftwareVersion) + { + Configuration.EmbeddedSoftwareVersions = embeddedSoftwareVersion; + Configuration.EmbeddedSoftwareVersionGuid = embeddedSoftwareVersion.Guid; + } + + private void RemoveIds() + { + Configuration.IdsPacks.Remove(SelectedIds); + SelectedIds = null; + } + + private void AddIds() + { + Configuration.IdsPacks.Add(new IdsPack()); + InvalidateRelayCommands(); } public void DropCartridgeType(CartridgeType cartridgeType, IdsPack idsPack) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml index 1542adf49..48b90aa6b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml @@ -5,6 +5,9 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" xmlns:global="clr-namespace:Tango.MachineStudio.MachineDesigner" + xmlns:fa="http://schemas.fontawesome.io/icons/" + xmlns:providers="clr-namespace:Tango.MachineStudio.MachineDesigner.AutoComplete" + xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels" @@ -14,6 +17,7 @@ + + + - + - + + + + + + + + + + + - - - - - - - - - - - - - - - + MACHINE DESIGNER + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - Touch Panel: - - - - - - Embedded Firmware: - - - - - - Dispensers: - - - - - - Mid Tanks: - - - - - + + + + + + + - + + + + + + + + + + + + Add IDS + + + + + + Remove IDS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NO IDS PACKS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Touch Panel: + + + + + + Embedded Firmware: + + + + + + Dispensers: + + + + + + Mid Tanks: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IDS PACKS + + + + + + + + + + Dispenser: + + + + Cartridge: + + + + Mid Tank: + + + + Liquid: + + + + + + + + + + @@ -151,7 +348,7 @@ - + @@ -165,7 +362,7 @@ - + @@ -180,7 +377,7 @@ - + + + + + + + + + + v + + + + + + + + + + + + + + + + + + + + + + + v + + + + + + + + + + + + + + + + + + + + + + + v + + + + + + + + + + + + + + + + + + + + + + + v + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs index 97412178e..ebf45624d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; @@ -29,7 +30,10 @@ namespace Tango.MachineStudio.MachineDesigner.Views { InitializeComponent(); DraggingSurface = dragSufrace; - this.Loaded += (x, y) => _vm = DataContext as MainViewVM; + this.Loaded += (x, y) => + { + _vm = DataContext as MainViewVM; + }; } public DraggingSurface DraggingSurface @@ -40,7 +44,7 @@ namespace Tango.MachineStudio.MachineDesigner.Views public static readonly DependencyProperty DraggingSurfaceProperty = DependencyProperty.Register("DraggingSurface", typeof(DraggingSurface), typeof(MainView), new PropertyMetadata(null)); - private void OnDroppedDispenser(object sender, DropEventArgs e) + private void OnDropOnIdsPack(object sender, DropEventArgs e) { if (e.Draggable.DataContext is Dispenser) { @@ -59,5 +63,29 @@ namespace Tango.MachineStudio.MachineDesigner.Views _vm.DropMidTankType(e.Draggable.DataContext as MidTankType, e.Droppable.DataContext as IdsPack); } } + + private void OnTabletDrop(object sender, DropEventArgs e) + { + if (e.Draggable.DataContext is ApplicationDisplayPanelVersion) + { + _vm.DropTouchPanel(e.Draggable.DataContext as ApplicationDisplayPanelVersion); + } + else if (e.Draggable.DataContext is ApplicationVersion) + { + _vm.DropApplicationVersion(e.Draggable.DataContext as ApplicationVersion); + } + } + + private void OnEmbeddedDrop(object sender, DropEventArgs e) + { + if (e.Draggable.DataContext is EmbeddedFirmwareVersion) + { + _vm.DropEmbeddedFirmware(e.Draggable.DataContext as EmbeddedFirmwareVersion); + } + else if (e.Draggable.DataContext is EmbeddedSoftwareVersion) + { + _vm.DropEmbeddedSoftware(e.Draggable.DataContext as EmbeddedSoftwareVersion); + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config index 4fd672b32..42945b407 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config @@ -1,6 +1,7 @@  + -- cgit v1.3.1