From 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 21 七月 2020 09:46:53 +0800
Subject: [PATCH] 请合并最新多功能面板代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Relay/RelayThreeLoadBackLightSettionForm.cs |  404 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 404 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Relay/RelayThreeLoadBackLightSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Relay/RelayThreeLoadBackLightSettionForm.cs
new file mode 100755
index 0000000..3b8d198
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Relay/RelayThreeLoadBackLightSettionForm.cs
@@ -0,0 +1,404 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using ZigBee.Device;
+
+namespace Shared.Phone.UserCenter.DeviceRelay
+{
+    /// <summary>
+    /// 涓夎矾缁х數鍣ㄧ殑鑳屽厜鐏缃�
+    /// </summary>
+    public class RelayThreeLoadBackLightSettionForm : EditorCommonForm
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 璁惧Mac鍦板潃
+        /// </summary>
+        private string deviceMac = string.Empty;
+        /// <summary>
+        /// 浜害璋冭妭鐨勪俊鎭�
+        /// </summary>
+        private Panel.PanelSwitchLevelInfo linghtLevelInfo = null;
+        /// <summary>
+        /// 鑺傝兘妯″紡
+        /// </summary>
+        private Panel.PanelSaveEnergyModeInfo energyModeInfo = null;
+        /// <summary>
+        /// 璁惧鍒楄〃
+        /// </summary>
+        private List<CommonDevice> listDevice = null;
+        /// <summary>
+        /// 鏁版嵁鏄惁鍙樻洿
+        /// </summary>
+        private bool valueChanged = false;
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
+        /// </summary>
+        public void ShowForm(string i_deviceMac)
+        {
+            this.ScrollEnabled = false;
+
+            this.deviceMac = i_deviceMac;
+            this.listDevice = Common.LocalDevice.Current.GetDevicesByMac(i_deviceMac);
+
+            //璁剧疆澶撮儴淇℃伅
+            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uBackLight));
+
+            //鍒濆鍖栦腑閮ㄤ俊鎭�
+            this.InitMiddleFrame();
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栦腑閮ㄤ俊鎭�
+        /// </summary>
+        private void InitMiddleFrame()
+        {
+            //鑾峰彇璁惧鍒濆鏁版嵁
+            var result = this.GetDeviceDefultData();
+            if (result == false)
+            {
+                return;
+            }
+            //娓呯┖bodyFrame
+            this.ClearBodyFrame();
+
+            //鐐瑰嚮鐘舵��
+            var btnClickStatu = new NormalViewControl(600, 49, true);
+            btnClickStatu.X = ControlCommonResourse.XXLeft;
+            btnClickStatu.Y = Application.GetRealHeight(207);
+            btnClickStatu.TextSize = 12;
+            btnClickStatu.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnClickStatu.TextID = R.MyInternationalizationString.uClickStatu;
+            bodyFrameLayout.AddChidren(btnClickStatu);
+
+            //鍚勭鑳屽厜鐏殑瀹瑰櫒
+            var frameLinght = new FrameLayout();
+            frameLinght.Height = Application.GetRealHeight(818);
+            frameLinght.Y = Application.GetRealHeight(279);
+            frameLinght.BackgroundColor = UserCenterColor.Current.White;
+            bodyFrameLayout.AddChidren(frameLinght);
+
+            //娣诲姞1-6骞叉帴鐐圭殑鑳屽厜鐏繘搴︽潯
+            this.AddSixDryContactProgress(frameLinght);
+            //绗竷骞叉帴鐐圭殑鑳屽厜鐏繘搴︽潯
+            this.AddSevenDryContactProgress(frameLinght);
+            //娣诲姞鑺傝兘妯″紡
+            this.AddEnergyConservationRow(btnClickStatu, frameLinght);
+
+            //淇濆瓨
+            var btnSave = new BottomClickButton();
+            btnSave.TextID = R.MyInternationalizationString.uSave;
+            bodyFrameLayout.AddChidren(btnSave);
+            btnSave.ButtonClickEvent += (sender, e) =>
+            {
+                if (valueChanged == true)
+                {
+                    this.ShowProgressBar();
+                    //浜害璋冭妭鏇存敼(浠栦滑璇撮殢渚夸竴涓洖璺氨琛�)
+                    result = HdlDevicePanelLogic.Current.SetDeviceLightSettion(listDevice[0], linghtLevelInfo.panelDirectionsLevel, linghtLevelInfo.panelBacklightLevel);
+                    if (result == false)
+                    {
+                        this.CloseProgressBar();
+                        return;
+                    }
+                    //鑺傝兘妯″紡淇敼(浠栦滑璇撮殢渚夸竴涓洖璺氨琛�)
+                    result = HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode(listDevice[0], energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level);
+                    this.CloseProgressBar();
+                    if (result == false)
+                    {
+                        return;
+                    }
+                }
+                //鍏抽棴鑷韩
+                this.CloseForm();
+            };
+        }
+
+        #endregion
+
+        #region 鈻� 鑺傝兘妯″紡琛宊________________________
+
+        /// <summary>
+        ///  娣诲姞鑺傝兘妯″紡琛�
+        /// </summary>
+        /// <param name="btnClickStatu">鐐瑰嚮鐘舵�佹帶浠�(鎺т欢浼哥缉浣跨敤)</param>
+        /// <param name="frameLinght">鍚勭鑳屽厜鐏殑瀹瑰櫒(鎺т欢浼哥缉浣跨敤)</param>
+        private void AddEnergyConservationRow(NormalViewControl btnClickStatu, FrameLayout frameLinght)
+        {
+            //缂╁皬:170  鎵╁ぇ:429
+            var frameBack = new FrameRowControl();
+            frameBack.BackgroundColor = UserCenterColor.Current.White;
+            frameBack.UseClickStatu = false;
+            frameBack.Height = Application.GetRealHeight(170);
+            bodyFrameLayout.AddChidren(frameBack);
+
+            //褰撳墠浜害(鍏堝0鏄�,涓轰簡瀵瑰簲IOS鐨勬姌鍙犲悗,娌℃湁瀹屽叏閬尅鐨勯棶棰�)
+            var btnProgressView1 = new NormalViewControl(200, 49, true);
+            var btnProgress1 = new NormalViewControl(200, 49, true);
+
+            //鑺傝兘妯″紡
+            frameBack.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uEnergyConservationMode), 400);
+            //寮�鍏虫帶浠�
+            var btnSwitch = frameBack.AddMostRightSwitchIcon();
+            btnSwitch.ButtonClickEvent += (sender, e) =>
+            {
+                btnSwitch.IsSelected = !btnSwitch.IsSelected;
+                energyModeInfo.enable = btnSwitch.IsSelected;
+                //灞曞紑鎴栬�呯缉灏忕殑楂樺害
+                var value = Application.GetRealHeight(259);
+                if (btnSwitch.IsSelected == true)
+                {
+                    frameBack.Height += value;
+                    btnClickStatu.Y += value;
+                    frameLinght.Y += value;
+                    btnProgressView1.Visible = true;
+                    btnProgress1.Visible = true;
+                }
+                else
+                {
+                    frameBack.Height -= value;
+                    btnClickStatu.Y -= value;
+                    frameLinght.Y -= value;
+                    btnProgressView1.Visible = false;
+                    btnProgress1.Visible = false;
+                }
+                //鏁版嵁鍙樻洿
+                valueChanged = true;
+            };
+            if (energyModeInfo.enable == true)
+            {
+                btnSwitch.IsSelected = true;
+            }
+
+            //褰撳墠浜害
+            btnProgressView1.X = ControlCommonResourse.XXLeft;
+            btnProgressView1.Y = Application.GetRealHeight(161);
+            btnProgressView1.TextSize = 12;
+            btnProgressView1.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnProgressView1.TextID = R.MyInternationalizationString.uNowLuminance;
+            frameBack.AddChidren(btnProgressView1);
+            btnProgressView1.Visible = false;
+            btnProgress1.X = Application.GetRealWidth(222);
+            btnProgress1.Y = Application.GetRealHeight(158);
+            btnProgress1.TextSize = 12;
+            btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnProgress1.Text = energyModeInfo.level + "%";
+            frameBack.AddChidren(btnProgress1);
+            btnProgress1.Visible = false;
+
+            //杩涘害鏉�
+            var seekBar1 = new SeekBarControl();
+            seekBar1.Y = Application.GetRealHeight(253);
+            seekBar1.ProgressBarColor = 0xff3e99f4;
+            frameBack.AddChidren(seekBar1);
+            seekBar1.ProgressChangedEvent += (div, value) =>
+            {
+                btnProgress1.Text = value + "%";
+                //鏁版嵁鍙樻洿
+                energyModeInfo.level = value;
+                valueChanged = true;
+            };
+            seekBar1.Progress = energyModeInfo.level;
+
+            var btnTemp1 = new NormalViewControl(200, 49, true);
+            btnTemp1.X = ControlCommonResourse.XXLeft;
+            btnTemp1.Y = Application.GetRealHeight(325);
+            btnTemp1.TextSize = 12;
+            btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnTemp1.Text = "0%";
+            frameBack.AddChidren(btnTemp1);
+
+            var btnTemp2 = new NormalViewControl(200, 49, true);
+            btnTemp2.X = frameLinght.Width - Application.GetRealWidth(200 + 49);
+            btnTemp2.Y = Application.GetRealHeight(325);
+            btnTemp2.TextAlignment = TextAlignment.CenterRight;
+            btnTemp2.TextSize = 12;
+            btnTemp2.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnTemp2.Text = "100%";
+            frameBack.AddChidren(btnTemp2);
+
+            if (energyModeInfo.enable == true)
+            {
+                //灞曞紑鎴栬�呯缉灏忕殑楂樺害
+                var value = Application.GetRealHeight(259);
+                frameBack.Height += value;
+                btnClickStatu.Y += value;
+                frameLinght.Y += value;
+
+                btnProgressView1.Visible = true;
+                btnProgress1.Visible = true;
+            }
+        }
+
+        #endregion
+
+        #region 鈻� 1-6骞叉帴鐐圭殑鑳屽厜鐏痏_________________
+
+        /// <summary>
+        ///  娣诲姞1-6骞叉帴鐐圭殑鑳屽厜鐏繘搴︽潯锛堣繖涓搴旂殑鏄�愭寚绀虹伅浜害銆戯級
+        /// </summary>
+        /// <param name="frameLinght">鍚勭鑳屽厜鐏殑瀹瑰櫒</param>
+        private void AddSixDryContactProgress(FrameLayout frameLinght)
+        {
+            var btnProgressView1 = new NormalViewControl(200, 49, true);
+            btnProgressView1.X = ControlCommonResourse.XXLeft;
+            btnProgressView1.Y = Application.GetRealHeight(29);
+            btnProgressView1.TextSize = 12;
+            btnProgressView1.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnProgressView1.Text = "Dry1-6";
+            frameLinght.AddChidren(btnProgressView1);
+            var btnProgress1 = new NormalViewControl(200, 49, true);
+            btnProgress1.X = Application.GetRealWidth(204);
+            btnProgress1.Y = Application.GetRealHeight(29);
+            btnProgress1.TextSize = 12;
+            btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnProgress1.Text = linghtLevelInfo.panelBacklightLevel + "%";
+            frameLinght.AddChidren(btnProgress1);
+
+            //杩涘害鏉�
+            var seekBar1 = new SeekBarControl();
+            seekBar1.Y = Application.GetRealHeight(124);
+            seekBar1.ProgressBarColor = 0xfffdb500;
+            frameLinght.AddChidren(seekBar1);
+            seekBar1.ProgressChangedEvent += (div, value) =>
+            {
+                btnProgress1.Text = value + "%";
+                //鏁版嵁鍙樻洿
+                linghtLevelInfo.panelBacklightLevel = value;
+                valueChanged = true;
+            };
+            seekBar1.Progress = linghtLevelInfo.panelBacklightLevel;
+
+            var btnTemp1 = new NormalViewControl(200, 49, true);
+            btnTemp1.X = ControlCommonResourse.XXLeft;
+            btnTemp1.Y = Application.GetRealHeight(193);
+            btnTemp1.TextSize = 12;
+            btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnTemp1.Text = "0%";
+            frameLinght.AddChidren(btnTemp1);
+
+            var btnTemp2 = new NormalViewControl(200, 49, true);
+            btnTemp2.X = frameLinght.Width - Application.GetRealWidth(200 + 49);
+            btnTemp2.Y = Application.GetRealHeight(193);
+            btnTemp2.TextAlignment = TextAlignment.CenterRight;
+            btnTemp2.TextSize = 12;
+            btnTemp2.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnTemp2.Text = "100%";
+            frameLinght.AddChidren(btnTemp2);
+
+            //绾�
+            var btnLine = new NormalViewControl(Application.GetRealWidth(965), ControlCommonResourse.BottomLineHeight, false);
+            btnLine.Y = Application.GetRealHeight(311);
+            btnLine.Gravity = Gravity.CenterHorizontal;
+            btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
+            frameLinght.AddChidren(btnLine);
+        }
+
+        #endregion
+
+        #region 鈻� 绗竷骞叉帴鐐圭殑鑳屽厜鐏痏________________
+
+        /// <summary>
+        ///  娣诲姞绗竷骞叉帴鐐圭殑鑳屽厜鐏繘搴︽潯锛堣繖涓搴旂殑鏄�愯儗鍏夌伅浜害銆戯級
+        /// </summary>
+        /// <param name="frameLinght">鍚勭鑳屽厜鐏殑瀹瑰櫒</param>
+        private void AddSevenDryContactProgress(FrameLayout frameLinght)
+        {
+            var btnProgressView1 = new NormalViewControl(200, 49, true);
+            btnProgressView1.X = ControlCommonResourse.XXLeft;
+            btnProgressView1.Y = Application.GetRealHeight(369);
+            btnProgressView1.TextSize = 12;
+            btnProgressView1.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnProgressView1.Text = "Dry7";
+            frameLinght.AddChidren(btnProgressView1);
+            var btnProgress1 = new NormalViewControl(200, 49, true);
+            btnProgress1.X = Application.GetRealWidth(161);
+            btnProgress1.Y = Application.GetRealHeight(369);
+            btnProgress1.TextSize = 12;
+            btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnProgress1.Text = linghtLevelInfo.panelDirectionsLevel + "%";
+            frameLinght.AddChidren(btnProgress1);
+
+            //杩涘害鏉�
+            var seekBar1 = new SeekBarControl();
+            seekBar1.Y = Application.GetRealHeight(464);
+            seekBar1.ProgressBarColor = 0xfffdb500;
+            frameLinght.AddChidren(seekBar1);
+            seekBar1.ProgressChangedEvent += (div, value) =>
+            {
+                btnProgress1.Text = value + "%";
+                //鏁版嵁鍙樻洿
+                linghtLevelInfo.panelDirectionsLevel = value;
+                valueChanged = true;
+            };
+            seekBar1.Progress = linghtLevelInfo.panelDirectionsLevel;
+
+            var btnTemp1 = new NormalViewControl(200, 49, true);
+            btnTemp1.X = ControlCommonResourse.XXLeft;
+            btnTemp1.Y = Application.GetRealHeight(533);
+            btnTemp1.TextSize = 12;
+            btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnTemp1.Text = "0%";
+            frameLinght.AddChidren(btnTemp1);
+
+            var btnTemp2 = new NormalViewControl(200, 49, true);
+            btnTemp2.X = frameLinght.Width - Application.GetRealWidth(200 + 49);
+            btnTemp2.Y = Application.GetRealHeight(533);
+            btnTemp2.TextAlignment = TextAlignment.CenterRight;
+            btnTemp2.TextSize = 12;
+            btnTemp2.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnTemp2.Text = "100%";
+            frameLinght.AddChidren(btnTemp2);
+
+            //绾�
+            var btnLine = new NormalViewControl(Application.GetRealWidth(965), ControlCommonResourse.BottomLineHeight, false);
+            btnLine.Gravity = Gravity.CenterHorizontal;
+            btnLine.Y = Application.GetRealHeight(651);
+            btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
+            frameLinght.AddChidren(btnLine);
+        }
+
+        #endregion
+
+        #region 鈻� 鑾峰彇鍒濆鏁版嵁_______________________
+
+        /// <summary>
+        /// 鑾峰彇璁惧鍒濆鏁版嵁
+        /// </summary>
+        /// <returns></returns>
+        private bool GetDeviceDefultData()
+        {
+            //寮�鍚繘搴︽潯
+            this.ShowProgressBar();
+            //浜害璋冭妭(浠栦滑璇撮殢渚挎嬁涓�璺洖璺氨琛屼簡)
+            linghtLevelInfo = HdlDevicePanelLogic.Current.GetDeviceLightSettion(listDevice[0]);
+            if (linghtLevelInfo == null)
+            {
+                //鍏抽棴杩涘害鏉�
+                this.CloseProgressBar(ShowReLoadMode.YES);
+                return false;
+            }
+            //鑺傝兘妯″紡(浠栦滑璇撮殢渚挎嬁涓�璺洖璺氨琛屼簡)
+            energyModeInfo = HdlDevicePanelLogic.Current.GetDeviceEnergyConservationMode(listDevice[0]);
+            if (energyModeInfo == null)
+            {
+                //鍏抽棴杩涘害鏉�
+                this.CloseProgressBar(ShowReLoadMode.YES);
+                return false;
+            }
+            //鍏抽棴杩涘害鏉�
+            this.CloseProgressBar();
+
+            return true;
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0