aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs
blob: 292c4b2d6e479349a6991e77c23214fd6c880125 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Tango.Core.Commands;
using Tango.SharedUI;

namespace Tango.PPC.UI.Dialogs
{
    public class PowerEurekaViewVM : DialogViewVM
    {
        public enum PowerActionEnum { TurnOff, StandBy, Restart, RestartT, CloseApp };

        private PowerActionEnum _powerAction;

        public PowerActionEnum PowerAction
        {
            get { return _powerAction; }
            set {
                _powerAction = value;
            RaisePropertyChangedAuto();}
        }

        public RelayCommand TurnOffCommand {  get; set;}
        public RelayCommand StandByCommand { get; set;}
        public RelayCommand RestartCommand { get; set; }
        public RelayCommand RestartTabletCommand { get; set; }
        public RelayCommand MinimizeCommand { get; set; }
        public RelayCommand CloseAppCommand { get; set; }


        public PowerEurekaViewVM()
        {
            PowerAction = PowerActionEnum.StandBy;
            TurnOffCommand = new RelayCommand( OnTurnOff);
            StandByCommand = new RelayCommand(OnStandBy);
            RestartCommand = new RelayCommand(OnRestart);
            RestartTabletCommand = new RelayCommand(OnRestartTablet);
            MinimizeCommand = new RelayCommand(OnMinimize);
            CloseAppCommand = new RelayCommand(OnCloseApp);
        }

        private void OnCloseApp(object obj)
        {
            PowerAction = PowerActionEnum.CloseApp;
            base.Accept();
        }

        private void OnMinimize(object obj)
        {
            Application.Current.MainWindow.WindowState = WindowState.Minimized;
        }

        private void OnRestartTablet(object obj)
        {
            PowerAction = PowerActionEnum.RestartT;
            base.Accept();
        }

        private void OnRestart(object obj)
        {
            PowerAction = PowerActionEnum.Restart;
            base.Accept();
        }

        private void OnStandBy(object obj)
        {
            PowerAction = PowerActionEnum.StandBy;
            base.Accept();
        }

        private void OnTurnOff(object obj)
        {
            PowerAction = PowerActionEnum.TurnOff;
            base.Accept();
        }

        protected override void Cancel()
        {
            base.Cancel();
        }
    }
}