aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/AddLiquidFactorViewVM.cs
blob: 7b6b0b692df126288d1e840c9a8ad0d50a151c93 (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
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL;
using Tango.BL.Entities;
using Tango.SharedUI;
using System.Data.Entity;

namespace Tango.MachineStudio.RML.ViewModels
{
    public class AddLiquidFactorViewVM : DialogViewVM
    {
        private ObservablesContext _context;

        private ObservableCollection<LiquidType> _liquidTypes;
        public ObservableCollection<LiquidType> LiquidTypes
        {       
            get
            {
                return _liquidTypes;
            }
            set
            {
                _liquidTypes = value; RaisePropertyChangedAuto();
            }
        }

        private LiquidType _selectedLiquidType;
        public LiquidType SelectedLiquidType
        {
            get { return _selectedLiquidType; }
            set { _selectedLiquidType = value; RaisePropertyChangedAuto(); }
        }

        public AddLiquidFactorViewVM(ObservablesContext context)
        {
            _context = context;
        }

        public async override void OnShow()
        {
            base.OnShow();
            LiquidTypes = (await _context.LiquidTypes.ToListAsync()).OrderBy(x => x.PreferredIndex).ToObservableCollection();
            SelectedLiquidType = LiquidTypes.FirstOrDefault();
        }
    }
}