陈嘉乐
2020-06-24 adb12dcdbb2ddaeac687c3aa9e57bb7ed459ab7e
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
using System;
using Shared;
using Shared.Common;
using Shared.R;
using ZigBee.Device;
 
namespace Shared.Phone.Device.Logic
{
    public class Nightlight : FrameLayout
    {
        public Nightlight()
        {
            Tag = "Logic";
        }
 
        public void Show()
        {
 
            this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
            TopView view = new TopView();
            this.AddChidren(view.TopRowView());
            view.toptitleNameBtn.Text = Name;
            view.clickBtn.MouseDownEventHandler += (sender, e) =>
            {
                RemoveFromParent();
            };
            var middle = new FrameLayout
            {
                Y = view.topRowLayout.Bottom,
                Height = Application.GetRealHeight(Method.H - 184),
                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
            };
            this.AddChidren(middle);
 
            LogicView.LightView openView = new LogicView.LightView();
            openView.titleBtn.Text = "夜灯开关";
            middle.AddChidren(openView.Show());
            openView.clickviewBtn.MouseUpEventHandler += (sender, e) => {
                CurrentDeviceView("夜灯开关",new CommonDevice { },true, "");
 
            };
 
            LogicView.LightView brightnessView = new LogicView.LightView();
            brightnessView.frameLayout.Y = openView.frameLayout.Bottom;
            brightnessView.titleBtn.Text = "亮度";
            middle.AddChidren(brightnessView.Show());
            brightnessView.clickviewBtn.MouseUpEventHandler += (sender, e) => {
                CurrentDeviceView("亮度", new CommonDevice { }, true, "");
            };
 
            LogicView.LightView colorTemperatureView = new LogicView.LightView();
            colorTemperatureView.frameLayout.Y = brightnessView.frameLayout.Bottom;
            colorTemperatureView.titleBtn.Text = "色温";
            middle.AddChidren(colorTemperatureView.Show());
            colorTemperatureView.clickviewBtn.MouseUpEventHandler += (sender, e) => {
                CurrentDeviceView("色温", new CommonDevice { }, true, "");
            };
 
            LogicView.LightView buzzView = new LogicView.LightView();
            buzzView.frameLayout.Y = colorTemperatureView.frameLayout.Bottom;
            buzzView.titleBtn.Text = "蜂鸣器";
            middle.AddChidren(buzzView.Show());
            buzzView.clickviewBtn.MouseUpEventHandler += (sender, e) => {
                CurrentDeviceView("蜂鸣器", new CommonDevice { }, true, "");
            };
 
        }
        public void CurrentDeviceView(string if_str, CommonDevice common, bool edit, string str)
        {
            var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
            this.AddChidren(flMain);
            UserView.HomePage.Instance.ScrollEnabled = false;//不让当前界面滑动
            CompleteView completeView = new CompleteView();
            flMain.AddChidren(completeView.Show(2));
            completeView.Btntitle.Text = LocalDevice.Current.GetDeviceEpointName(common);
            EventHandler<MouseEventArgs> clickcancel = (sender, e) =>
            {
                UserView.HomePage.Instance.ScrollEnabled = true;
                flMain.RemoveFromParent();
            };
            flMain.MouseUpEventHandler += clickcancel;
            completeView.Btncancel.MouseUpEventHandler += clickcancel;
 
          
            switch (if_str)
            {
                case "夜灯开关":
                    {
                        mFunView openView = new mFunView();
                        openView.frameLayout.Y = Application.GetRealHeight(140 + 20);
                        openView.titleBtn.TextID = MyInternationalizationString.open;
                        completeView.Show(2).AddChidren(openView.Show());
                        mFunView closeView = new mFunView();
                        closeView.frameLayout.Y = Application.GetRealHeight(140 + 20 + 160);
                        closeView.titleBtn.TextID = MyInternationalizationString.close;
                        completeView.Show(2).AddChidren(closeView.Show());
                        closeView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
                        ///点击确认事件
                        openView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
                        {
                            openView.selectedIconBtn.Visible = true;
                            closeView.selectedIconBtn.Visible = false;
                            openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                        };
 
                        ///点击取消事件
                        closeView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
                        {
                            openView.selectedIconBtn.Visible = false;
                            closeView.selectedIconBtn.Visible = true;
                            openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
 
                        };
 
                    }
                    break;
                case "亮度":
                    {
                        var horizontalSeekBarVol = new DiyImageSeekBar
                        {
                            Y = Application.GetRealHeight(140),
                            X = Application.GetRealWidth(78),
                            Width = Application.GetRealWidth(918),
                            Height = Application.GetRealHeight(320),//滑动条父控件高度
                            IsProgressTextShow = true,//显示百分比
                            IsClickable = true,//进度条是否滑动
                            ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected,//选中进度条颜色
                            ThumbImagePath = "ZigeeLogic/progressbtn2.png",//进度条按钮图标
                            ThumbImageHeight = Application.GetRealHeight(89),//进度条按钮图标的高度(默认正方形:宽和高一样)
                            ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                            ProgressTextSize = 9,//显示百分比字体大小12
                            SeekBarViewHeight = Application.GetRealHeight(6),//进度条的高度10
                        };
                        completeView.Show(2).AddChidren(horizontalSeekBarVol);
                    }
                    break;
                case "色温":
                    {
                        Button titleBtn = new Button
                        {
                            Y = Application.GetRealHeight(140+154),
                            X = Application.GetRealWidth(78),
                            Height = Application.GetRealHeight(12),
                            Width = Application.GetRealWidth(918),
                            //TextID = MyInternationalizationString.logicathomegarrison,
                            TextAlignment = TextAlignment.CenterLeft,
                            TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                            TextSize = 14,
                            UnSelectedImagePath= "ZigeeLogic/seek.png",
                        };
                        completeView.Show(2).AddChidren(titleBtn);
                        var horizontalSeekBarVol = new DiyImageSeekBar
                        {
                            Y = Application.GetRealHeight(140),
                            X = Application.GetRealWidth(78),
                            Width = Application.GetRealWidth(918),
                            Height = Application.GetRealHeight(320),//滑动条父控件高度
                            IsProgressTextShow = true,//显示百分比
                            IsClickable = true,//进度条是否滑动
                            ProgressBarColor = 0x00000000,// ZigbeeColor.Current.LogicProgressColorSelected,//选中进度条颜色
                            SeekBarBackgroundColor= 0x00000000,
                            ThumbImagePath = "ZigeeLogic/progressbtn2.png",//进度条按钮图标
                            ThumbImageHeight = Application.GetRealHeight(89),//进度条按钮图标的高度(默认正方形:宽和高一样)
                            ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                            ProgressTextSize = 9,//显示百分比字体大小12
                            SeekBarViewHeight = Application.GetRealHeight(12),//进度条的高度10
                        };
                        completeView.Show(2).AddChidren(horizontalSeekBarVol);
                    }
                    break;
                case "蜂鸣器":
                    {
                        mFunView openView = new mFunView();
                        openView.frameLayout.Y = Application.GetRealHeight(140 + 20);
                        openView.titleBtn.TextID = MyInternationalizationString.open;
                        completeView.Show(2).AddChidren(openView.Show());
                        mFunView closeView = new mFunView();
                        closeView.frameLayout.Y = Application.GetRealHeight(140 + 20 + 160);
                        closeView.titleBtn.TextID = MyInternationalizationString.close;
                        completeView.Show(2).AddChidren(closeView.Show());
                        closeView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
 
                        ///点击确认事件
                        openView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
                        {
                            openView.selectedIconBtn.Visible = true;
                            closeView.selectedIconBtn.Visible = false;
                            openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
 
 
                        };
 
                        ///点击取消事件
                        closeView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
                        {
                            openView.selectedIconBtn.Visible = false;
                            closeView.selectedIconBtn.Visible = true;
                            openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
 
 
                        };
                    }
                    break;
            }
 
        }
 
    }
 
}