JLChen
2020-06-04 6d55af8792cf8fbef0055e677b900fc352dba9a2
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
using System;
namespace Shared.SimpleControl.Phone
{
    public class UserDeviceToTV : FrameLayout
    {
 
        VerticalScrolViewLayout bodyScrolView;
        /// <summary>
        /// 当前界面
        /// </summary>
        VerticalScrolViewLayout equipmentListScrolView;
 
 
        /// <summary>
        /// 构造函数
        /// </summary>
        public UserDeviceToTV ()
        {
            BackgroundColor = SkinStyle.Current.MainColor;
        }
 
        /// <summary>
        /// 显示房间的所有电视
        /// </summary>
        public void ShowAllRoomTV ()
        {
            #region 标题
            var topView = new FrameLayout () {
                Height = Application.GetRealHeight (126),
            };
            AddChidren (topView);
 
            var title = new Button () {
                TextAlignment = TextAlignment.Center,
                Text = Language.StringByID (R.MyInternationalizationString.TV),
                TextSize = 19,
                TextColor = SkinStyle.Current.TextColor1
            };
            topView.AddChidren (title);
 
            var logo = new Button () {
                Width = Application.GetRealWidth (154),
                Height = Application.GetRealHeight (90),
                X = Application.GetRealWidth (486),
                Y = Application.GetRealHeight (36),
                UnSelectedImagePath = MainPage.LogoString,
            };
            topView.AddChidren (logo);
            var back = new Button () {
                Y = Application.GetRealHeight (35),
                Height = Application.GetRealHeight (90),
                Width = Application.GetRealWidth (85),
                UnSelectedImagePath = "Item/Back.png",
                SelectedImagePath = "Item/BackSelected.png",
            };
            topView.AddChidren (back);
            back.MouseUpEventHandler += (sender, e) => {
                this.RemoveFromParent ();
                //UserMiddle.DevicePageView.RemoveAt (1);
                //UserMiddle.DevicePageView.PageIndex = 0;
            };
            #endregion
 
            #region powerView
            var powerView = new FrameLayout () {
                Height = Application.GetRealHeight (110),
                BackgroundColor = SkinStyle.Current.TitileView,
                Y = topView.Bottom
            };
            AddChidren (powerView);
 
            var showAllroom = new Button () {
                X = Application.GetRealHeight (20),
                Height = Application.GetRealHeight (108),
                TextAlignment = TextAlignment.CenterLeft,
                Text = Language.StringByID (R.MyInternationalizationString.TVList),
                TextColor = SkinStyle.Current.TextColor1
            };
            powerView.AddChidren (showAllroom);
            #endregion
 
            bodyScrolView = new VerticalScrolViewLayout () {
                Width = LayoutParams.MatchParent,
                Height = Application.GetRealHeight (Application.DesignHeight - 126 - 110),
                Y = powerView.Bottom,
                BackgroundColor = SkinStyle.Current.ViewColor,
            };
            AddChidren (bodyScrolView);
 
            //显示有多少个房间
            foreach (var room in Room.Lists) {
                if (string.IsNullOrEmpty(room.Name)) {
                    continue;
                }
                var infraredList = room.DeviceList.FindAll ((obj) => { return obj.Type == DeviceType.InfraredMode; });
                //var tvList = infraredList.FindAll ((obj) => { return ((InfraredMode)obj).InfraredType == InfraredType.TV; });
                foreach (var tempTV in infraredList) {
                    var roomView = new FrameLayout () {
                        Height = Application.GetRealHeight (110),
                        BackgroundColor = SkinStyle.Current.ViewColor,
                        Tag = room.Name + "-" + tempTV.Name,
                    };
                    bodyScrolView.AddChidren (roomView);
                    var btnPoint = new Button () {
                        Width = Application.GetRealWidth (10),
                        Height = Application.GetRealHeight (10),
                        X = Application.GetRealWidth (20),
                        Gravity = Gravity.CenterVertical,
                        UnSelectedImagePath = "Item/Point.png",
                        SelectedImagePath = "Item/Point.png",
                    };
                    roomView.AddChidren (btnPoint);
                    Button btnRoomName = new Button () {
                        Text = room.Name + "-" + tempTV.Name,
                        X = btnPoint.Right + Application.GetRealWidth (4),
                        TextAlignment = TextAlignment.CenterLeft,
                        Tag = tempTV,
                        TextColor = SkinStyle.Current.TextColor1
                    };
                    roomView.AddChidren (btnRoomName);
 
                    Button btnLightIcon = new Button () {
                        Width = Application.GetRealWidth (100),
                        Height = Application.GetRealHeight (80),
                        Gravity = Gravity.CenterVertical,
                        UnSelectedImagePath = "Item/InfraredTV.png",
                        X = Application.GetRealWidth (520),
                    };
                    roomView.AddChidren (btnLightIcon);
 
                    btnRoomName.MouseUpEventHandler += (sender, e) => {
                        var tvView =  new UserTVFrameLayout ((InfraredMode)tempTV);
                        UserMiddle.DevicePageView.AddChidren (tvView);
                        tvView.ShowUserTV ();
                        UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
                    };
 
                    Button btnViewNull = new Button () {
                        Y = Application.GetRealHeight (107),
                        Height = Application.GetRealHeight (3),
                        BackgroundColor = SkinStyle.Current.MainColor
                    };
                    roomView.AddChidren (btnViewNull);
                }
            }
        }
    }
}