From 304dca51c28183a9dfc192c6b93ea1c00bdd5d97 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 01 七月 2020 15:00:40 +0800
Subject: [PATCH] 添加了写入功能类型

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs |  161 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 152 insertions(+), 9 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs
index 45d82b8..9ac4066 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using System.Collections.Generic;
 using System.Threading.Tasks;
 using ZigBee.Device;
 namespace Shared.Phone.UserCenter.DevicePanel
@@ -30,7 +31,28 @@
         /// 鎸夐敭鐨勯鑹叉暟鎹�
         /// </summary>
         private Panel.KeyColorData keyColorData = null;
-
+        /// <summary>
+        /// 閫夋嫨鐫$湢鏃堕棿鐨勪簨浠� value:绱㈠紩(浠�0寮�濮�)  鏂囨湰淇℃伅璇风敤Text鑾峰彇
+        /// </summary>
+        public Action<int> timeAction = null;
+        /// <summary>
+        /// 褰撳墠閫夋嫨鐨勫姛鑳界被鍨嬬储寮�
+        /// </summary>
+        private int nowSelectNo = 0;
+        /// <summary>
+        /// /// <summary>
+        /// 鐫$湢鏃堕棿鐨勫��
+        /// </summary>
+        /// </summary>
+        public string sleepTimeText
+        {
+            get { return btnSleepTime.Text; }
+            set { btnSleepTime.Text = value; }
+        }
+        /// <summary>
+        ///鐫$湢鏃堕棿 
+        /// </summary>
+        public NormalViewControl btnSleepTime = null;
         #endregion
 
         #region 鈻� 鍒濆鍖朹____________________________
@@ -70,7 +92,6 @@
             listview = new VerticalScrolViewLayout();
             listview.Height = Application.GetRealHeight(1981 - 184);
             bodyFrameLayout.AddChidren(listview);
-            listview.ScrollEnabled = false;
 
             HdlThreadLogic.Current.RunMain(() =>
             {
@@ -80,8 +101,15 @@
                 //娣诲姞灞忓箷浜害绾у埆鎺т欢
                 this.AddScreenBrightnesLevelControl();
 
-                //娣诲姞鏂伴闈㈡澘鐨勯鑹�
-                this.AddColorControl();
+                //鑾峰彇璁惧绫诲瀷鐨�
+                var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { panelDevice });
+                if (deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.ButtonPanel_SimpleEnvironment)
+                {
+                    //娣诲姞闈㈡澘鐨勯鑹�
+                    this.AddColorControl();
+                }
+
+                this.FinishInitControl(listview, energyModeInfo.enable);
 
                 //淇濆瓨
                 var btnSave = new BottomClickButton();
@@ -146,6 +174,7 @@
 
             //杩涘害鏉�
             var seekBar1 = new SeekBarControl();
+            seekBar1.SeekBarPadding = 25;
             seekBar1.MaxValue = 5;
             seekBar1.ProgressBarColor = 0xff3e99f4;
             seekBar1.Y = Application.GetRealHeight(253);
@@ -186,8 +215,12 @@
                         btnLevel.Text = "5" + strRank;
                         break;
                 }
+                listview.ScrollEnabled = false;
             };
-
+            seekBar1.OnStopTrackingTouchEvent += (sender, e) =>
+            {
+                listview.ScrollEnabled = true;
+            };
             seekBar1.OnStopTrackingTouchEvent += (div, value) =>
             {
                 if (value == 0)
@@ -396,7 +429,7 @@
                 btnSwitch.IsSelected = !btnSwitch.IsSelected;
                 energyModeInfo.enable = btnSwitch.IsSelected;
                 //灞曞紑鎴栬�呯缉灏忕殑楂樺害
-                var value = Application.GetRealHeight(443);
+                var value = Application.GetRealHeight(614);
                 if (btnSwitch.IsSelected == true)
                 {
                     frameBack.Height += value;
@@ -405,6 +438,7 @@
                 {
                     frameBack.Height -= value;
                 }
+                this.FinishInitControl(listview, energyModeInfo.enable);
             };
             if (energyModeInfo.enable == true)
             {
@@ -431,12 +465,18 @@
             var seekBar1 = new SeekBarControl();
             seekBar1.Y = Application.GetRealHeight(253);
             seekBar1.ProgressBarColor = 0xff3e99f4;
+            seekBar1.SeekBarPadding = 25;
             frameBack.AddChidren(seekBar1);
             seekBar1.ProgressChangedEvent += (div, value) =>
             {
                 btnProgress1.Text = value + "%";
                 //鏁版嵁鍙樻洿
                 energyModeInfo.level = value;
+                listview.ScrollEnabled = false;
+            };
+            seekBar1.OnStopTrackingTouchEvent += (sender, e) =>
+            {
+                listview.ScrollEnabled = true;
             };
             seekBar1.Progress = energyModeInfo.level;
 
@@ -460,11 +500,21 @@
             if (energyModeInfo.enable == true)
             {
                 //灞曞紑鎴栬�呯缉灏忕殑楂樺害
-                var value = Application.GetRealHeight(443);
+                var value = Application.GetRealHeight(614);
                 frameBack.Height += value;
             }
             //娣诲姞鎺ヨ繎鎰熷簲
             this.AddProximitySensorsRow(frameBack);
+            //搴曠嚎  
+            var btnLine = new NormalViewControl(965, 5, true);
+            btnLine.Height = 1;
+            btnLine.X = Application.GetRealWidth(52);
+            btnLine.Y = Application.GetRealHeight(484 + 127);
+            btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
+            frameBack.AddChidren(btnLine);
+
+            //娣诲姞鐫$湢鏃堕棿
+            this.AddSleepTimeRow(frameBack);
         }
 
         #endregion
@@ -499,6 +549,100 @@
                 btnSwitch.IsSelected = true;
             }
         }
+        #endregion
+
+        #region 鈻� 鐫$湢鏃堕棿___________________________
+
+        /// <summary>
+        /// 鐫$湢鏃堕棿琛�
+        /// </summary>
+        private void AddSleepTimeRow(FrameRowControl frameRowControl)
+        {
+            //鐫$湢鏃堕棿琛�
+            var frameBack = new FrameRowControl();
+            frameBack.BackgroundColor = UserCenterColor.Current.White;
+            frameBack.UseClickStatu = false;
+            frameBack.Y = Application.GetRealHeight(784 - 170);
+            frameBack.Height = Application.GetRealHeight(170);
+            frameRowControl.AddChidren(frameBack);
+
+            //鐫$湢鏃堕棿
+            frameBack.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.SleepTime), 400);
+            //鍙崇澶�
+            frameBack.AddRightArrow();
+            btnSleepTime = new NormalViewControl(700, true);
+            switch (energyModeInfo.time)
+            {
+                case 15:
+                    btnSleepTime.Text = "15s";
+                    nowSelectNo = 0;
+                    break;
+                case 60:
+                    btnSleepTime.Text = "1min";
+                    nowSelectNo = 1;
+                    break;
+                case 300:
+                    btnSleepTime.Text = "5min";
+                    nowSelectNo = 2;
+                    break;
+            }
+            frameBack.AddMostRightView(this.sleepTimeText, 700);
+
+            timeAction = null;
+            timeAction += (nowSelectNo) =>
+            {
+                switch (nowSelectNo)
+                {
+                    case 0:
+                        energyModeInfo.time = 15;
+                        break;
+                    case 1:
+                        energyModeInfo.time = 60;
+                        break;
+                    case 2:
+                        energyModeInfo.time = 300;
+                        break;
+                }
+                AddSleepTimeRow(frameRowControl);
+            };
+            frameBack.ButtonClickEvent += (sender, e) =>
+            {
+                this.ShowSelectDeviceSleepTimeListForm();
+            };
+        }
+
+        #region 鈻� 鏄剧ず閫夋嫨璁惧鐫$湢鏃堕棿_______________ 
+        /// <summary>
+        /// 鏄剧ず閫夋嫨璁惧鐫$湢鏃堕棿鐨勭晫闈�
+        /// </summary>
+        public void ShowSelectDeviceSleepTimeListForm()
+        {
+            //鏄剧ず鍒楄〃
+            var listText = new List<string>();
+            listText.Add("15s");
+            listText.Add("1min");
+            listText.Add("5min");
+            //鏍囬:閫夋嫨鍔熻兘绫诲瀷
+            var title = Language.StringByID(R.MyInternationalizationString.SleepTime);
+
+            var form = new BottomItemSelectForm();
+            form.CancelCallEvent = false;//鍏佽鍙栨秷
+            form.AddForm(title, listText, nowSelectNo);
+            form.FinishSelectEvent += (selectNo) =>
+            {
+                if (selectNo == nowSelectNo)
+                {
+                    //閫夋嫨鐨勬槸鐩稿悓鐨�
+                    return;
+                }
+                //-1:閫夋嫨鍙栨秷
+                this.sleepTimeText = selectNo == -1 ? string.Empty : listText[selectNo];
+                nowSelectNo = selectNo;
+                //璋冪敤鍥炶皟鍑芥暟
+                this.timeAction?.Invoke(nowSelectNo);
+            };
+        }
+        #endregion
         #endregion
 
         #region 鈻� 鑾峰彇鍒濆鏁版嵁_______________________
@@ -560,8 +704,7 @@
             this.ShowProgressBar();
 
             //鑺傝兘妯″紡淇敼(浠栦滑璇撮殢渚夸竴涓洖璺氨琛�)
-            //璁惧鍚屼簨璇存柊椋庨潰鏉块粯璁�60绉掓椂闂达紝杩欐牱鎺ヨ繎鎰熷簲鍔熻兘鎵嶅悎鐞�
-            energyModeInfo.time = 60;
+
             var result = HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode(panelDevice, energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level);
             if (result == false)
             {

--
Gitblit v1.8.0