From f1e8c2cde53050ffe78ef3b13346ba77ca65110c Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期四, 03 十二月 2020 17:55:52 +0800
Subject: [PATCH] 2020-12-03-2

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs |  208 +++++++++++++++++++++++++++++----------------------
 1 files changed, 119 insertions(+), 89 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index 1880dad..b6e8ab6 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -45,10 +45,19 @@
                 //寮�鍏崇伅鍏� light.Switch
                 case FunctionType.Dimmer:
                     {
+                        #region 鐣岄潰
+                        ///寮�鍏�
                         LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView();
                         lightSwitchView.btnText.TextID = StringId.switchLogic;
-                        lightSwitchView.btnState.Text = "";
                         fLayout.AddChidren(lightSwitchView.FLayoutView());
+                        ///浜害
+                        LogicView.FunTypeView brightnessView = new LogicView.FunTypeView();
+                        brightnessView.frameLayout.Y = lightSwitchView.frameLayout.Bottom;
+                        brightnessView.btnText.TextID = StringId.brightnesLogic;
+                        fLayout.AddChidren(brightnessView.FLayoutView());
+                        #endregion
+                        #region 鐐瑰嚮浜嬩欢
+                        ///寮�鍏崇偣鍑讳簨浠�
                         lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
                             FrameLayout frame = new FrameLayout
@@ -56,86 +65,99 @@
                                 BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                             };
                             this.AddChidren(frame);
-                            SwitchViewMethod(frame, device, lightSwitchView.btnState, 2);
+                            Dictionary<string, string> dic = new Dictionary<string, string>();
+                            LogicMethod.dictionary(dic, "key", "on_off");
+                            keyVlaue = "on_off";
+                            LogicView.SwitchView switchView = new LogicView.SwitchView();
+                            switchView.FLayoutView(frame, 2);
+                            switchView.btnOn.MouseUpEventHandler += (sender2, e2) =>
+                            {
+                                LogicMethod.dictionary(dic, "value", "on");
+                                RemView(frame);
+                                lightSwitchView.btnState.TextID = StringId.onLogic;
+                                selectedState = device.functionType + "_on";
+                                AddDictionaryData(dicSateteList, keyVlaue, dic);
+                            };
+                            switchView.btnOff.MouseUpEventHandler += (sender3, e3) =>
+                            {
+                                LogicMethod.dictionary(dic, "value", "off");
+                                RemView(frame);
+                                lightSwitchView.btnState.TextID = StringId.offLogic;
+                                selectedState = device.functionType + "_off";
+                                AddDictionaryData(dicSateteList, keyVlaue, dic);
+                            };
+                            if (lightSwitchView.btnState.Text != "")
+                            {
+                                if (lightSwitchView.btnState.Text == switchView.btnOn.Text)
+                                {
+                                    switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor;
+                                }
+                                else
+                                {
+                                    switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor;
+                                }
+                            }
                         };
+                        ///浜害鐐瑰嚮浜嬩欢
+                        brightnessView.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            FrameLayout frame = new FrameLayout
+                            {
+                                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
+                            };
+                            this.AddChidren(frame);
+                            Dictionary<string, string> dic = new Dictionary<string, string>();
+                            LogicMethod.dictionary(dic, "key", "on_off");
+                            keyVlaue = "on_off";
+                            LogicView.BrightnessView brightness = new LogicView.BrightnessView();
+                            brightness.btnTitle.TextID = StringId.brightnesLogic;
+                            brightness.FLayoutView(frame);
+                            brightness.btn_subtract.MouseUpEventHandler += (sender2, e2) =>
+                            {
+                                LogicMethod.dictionary(dic, "value", "on");
+                                RemView(frame);
+                                lightSwitchView.btnState.TextID = StringId.onLogic;
+                                selectedState = device.functionType + "_on";
+                                AddDictionaryData(dicSateteList, keyVlaue, dic);
+                            };
+                            brightness.btn_add.MouseUpEventHandler += (sender3, e3) =>
+                            {
+                                LogicMethod.dictionary(dic, "value", "off");
+                                RemView(frame);
+                                lightSwitchView.btnState.TextID = StringId.offLogic;
+                                selectedState = device.functionType + "_off";
+                                AddDictionaryData(dicSateteList, keyVlaue, dic);
+                            };
+                            if (lightSwitchView.btnState.Text != "")
+                            {
+                                //if (lightSwitchView.btnState.Text == switchView.btnOn.Text)
+                                //{
+                                //    switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor;
+                                //}
+                                //else
+                                //{
+                                //    switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor;
+                                //}
+                            }
+                        };
+
                         if (edit)
                         {
                             GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null);
                         }
-
+                        #endregion
                     }
                     break;
                 case FunctionType.RGB:
-                    {
-                        LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView();
-                        lightSwitchView.btnText.TextID = StringId.switchLogic;
-                        lightSwitchView.btnState.Text = "";
-                        fLayout.AddChidren(lightSwitchView.FLayoutView());
-                        lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) =>
-                        {
-                            FrameLayout frame = new FrameLayout
-                            {
-                                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
-                            };
-                            this.AddChidren(frame);
-                            SwitchViewMethod(frame, device, lightSwitchView.btnState, 2);
-                        };
-                        if (edit)
-                        {
-                            GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null);
-                        }
-
-                    }
                     break;
                 case FunctionType.RGBW:
-                    {
-                        LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView();
-                        lightSwitchView.btnText.TextID = StringId.switchLogic;
-                        lightSwitchView.btnState.Text = "";
-                        fLayout.AddChidren(lightSwitchView.FLayoutView());
-                        lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) =>
-                        {
-                            FrameLayout frame = new FrameLayout
-                            {
-                                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
-                            };
-                            this.AddChidren(frame);
-                            SwitchViewMethod(frame, device, lightSwitchView.btnState, 2);
-                        };
-                        if (edit)
-                        {
-                            GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null);
-                        }
-
-                    }
                     break;
                 case FunctionType.CCT:
-                    {
-                        LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView();
-                        lightSwitchView.btnText.TextID = StringId.switchLogic;
-                        lightSwitchView.btnState.Text = "";
-                        fLayout.AddChidren(lightSwitchView.FLayoutView());
-                        lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) =>
-                        {
-                            FrameLayout frame = new FrameLayout
-                            {
-                                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
-                            };
-                            this.AddChidren(frame);
-                            SwitchViewMethod(frame, device, lightSwitchView.btnState, 2);
-                        };
-                        if (edit)
-                        {
-                            GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null);
-                        }
-
-                    }
                     break;
                 case FunctionType.Relay:
                     {
                         LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView();
                         lightSwitchView.btnText.TextID = StringId.switchLogic;
-                        lightSwitchView.btnState.Text = "";
                         fLayout.AddChidren(lightSwitchView.FLayoutView());
                         lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
@@ -144,41 +166,49 @@
                                 BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                             };
                             this.AddChidren(frame);
-                            SwitchViewMethod(frame, device, lightSwitchView.btnState, 2);
+                            Dictionary<string, string> dic = new Dictionary<string, string>();
+                            LogicMethod.dictionary(dic, "key", "on_off");
+                            keyVlaue = "on_off";
+                            LogicView.SwitchView switchView = new LogicView.SwitchView();
+                            switchView.FLayoutView(frame, 3);
+                            switchView.btnOn.MouseUpEventHandler += (sender2, e2) =>
+                            {
+                                LogicMethod.dictionary(dic, "value", "on");
+                                RemView(frame);
+                                lightSwitchView.btnState.TextID = StringId.onLogic;
+                                selectedState = device.functionType + "_on";
+                                AddDictionaryData(dicSateteList, keyVlaue, dic);
+                            };
+                            switchView.btnOff.MouseUpEventHandler += (sender3, e3) =>
+                            {
+                                LogicMethod.dictionary(dic, "value", "off");
+                                RemView(frame);
+                                lightSwitchView.btnState.TextID = StringId.offLogic;
+                                selectedState = device.functionType + "_off";
+                                AddDictionaryData(dicSateteList, keyVlaue, dic);
+                            };
+                            if (lightSwitchView.btnState.Text != "")
+                            {
+                                if (lightSwitchView.btnState.Text == switchView.btnOn.Text)
+                                {
+                                    switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor;
+                                }
+                                else
+                                {
+                                    switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor;
+                                }
+                            }
                         };
                         if (edit)
                         {
                             GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null);
                         }
-
                     }
                     break;
                 //绐楀笜
                 case FunctionType.Curtain:
-                    {
-                        LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView();
-                        lightSwitchView.btnText.TextID = StringId.switchLogic;
-                        lightSwitchView.btnState.Text = "";
-                        fLayout.AddChidren(lightSwitchView.FLayoutView());
-                        lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) =>
-                        {
-                            FrameLayout frame = new FrameLayout
-                            {
-                                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
-                            };
-                            this.AddChidren(frame);
-                            SwitchViewMethod(frame, device, lightSwitchView.btnState, 2);
-                        };
-                        if (edit)
-                        {
-                            GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null);
-                        }
-
-                    }
                     break;
             }
-
-
             #region  淇濆瓨
             ///淇濆瓨View
             LogicView.SaveView saveView = new LogicView.SaveView();
@@ -344,7 +374,7 @@
         /// <param name="device"></param>
         /// <param name="button"></param>
         /// <param name="len"></param>
-        public void SwitchViewMethod(FrameLayout frame, Entity.Function device, Button button, int len)
+        public void SwitchViewMethod1(FrameLayout frame, Entity.Function device, Button button, int len)
         {
 
             LogicView.SwitchView switchView = new LogicView.SwitchView();

--
Gitblit v1.8.0