aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModels/MachinesViewVM.cs
blob: 88a62dff89e1b569a46a5ca37700edb6baf7d4e7 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.DAL.Observables;
using Tango.SharedUI;

namespace Tango.MachineDesigner.UI.ViewModels
{
    public class MachinesViewVM : ViewModel
    {
        private ObservableCollection<Machine> _machines;
        /// <summary>
        /// Gets or sets the machines.
        /// </summary>
        public ObservableCollection<Machine> Machines
        {
            get { return _machines; }
            set { _machines = value; RaisePropertyChangedAuto(); }
        }

        private ObservableCollection<Organization> _organizations;
        /// <summary>
        /// Gets or sets the organizations.
        /// </summary>
        public ObservableCollection<Organization> Organizations
        {
            get { return _organizations; }
            set { _organizations = value; RaisePropertyChangedAuto(); }
        }

        private Machine _selectedMachine;
        /// <summary>
        /// Gets or sets the selected machine.
        /// </summary>
        public Machine SelectedMachine
        {
            get { return _selectedMachine; }
            set { _selectedMachine = value; RaisePropertyChangedAuto(); }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="MachinesViewVM"/> class.
        /// </summary>
        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();
        }
    }
}