From 3fdcdac577d552bbdf6d7320c6ffb0753e810a08 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 10 Dec 2017 19:01:05 +0200 Subject: Started working on machine designer view models. Added NAME field to MACHINE table. --- .../ViewModels/MachinesViewVM.cs | 41 ++++++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModels/MachinesViewVM.cs') diff --git a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModels/MachinesViewVM.cs b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModels/MachinesViewVM.cs index 6d2cddda6..88a62dff8 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModels/MachinesViewVM.cs +++ b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModels/MachinesViewVM.cs @@ -1,18 +1,53 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; -using Tango.MachineDesigner.UI.SupervisingController; +using Tango.DAL.Observables; using Tango.SharedUI; namespace Tango.MachineDesigner.UI.ViewModels { - public class MachinesViewVM : ViewModel + public class MachinesViewVM : ViewModel { - public MachinesViewVM(IMachinesView view) : base(view) + private ObservableCollection _machines; + /// + /// Gets or sets the machines. + /// + public ObservableCollection Machines { + get { return _machines; } + set { _machines = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _organizations; + /// + /// Gets or sets the organizations. + /// + public ObservableCollection Organizations + { + get { return _organizations; } + set { _organizations = value; RaisePropertyChangedAuto(); } + } + private Machine _selectedMachine; + /// + /// Gets or sets the selected machine. + /// + public Machine SelectedMachine + { + get { return _selectedMachine; } + set { _selectedMachine = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + public MachinesViewVM() : base() + { + Organizations = DBAdapter.DbContext.ORGANIZATIONS.Where(x => !x.DELETED).ToList().Select(x => new Organization(x)).ToObservableCollection(); + Machines = DBAdapter.DbContext.MACHINES.Where(x => !x.DELETED).ToList().Select(x => new Machine(x)).ToObservableCollection(); } } } -- cgit v1.3.1