From 95d51dfc65299bdb735a855b515af84ca5b58252 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 23 十二月 2020 17:26:13 +0800
Subject: [PATCH] Merge branch 'NewFilePath' into CJL

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs |  272 ++++++++++++++++--------------------------------------
 1 files changed, 80 insertions(+), 192 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index 48bcd24..a139048 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -105,99 +105,45 @@
                         ///娓╁害鐐瑰嚮浜嬩欢
                         temperatureView.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
-                            FrameLayout frame = new FrameLayout
-                            {
-                                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
-                            };
-                            this.AddChidren(frame);
-                            LogicView.TimeView view = new LogicView.TimeView();
-                            view.FLayoutView(frame);
-                            EventHandler<MouseEventArgs> removefLayout = (sender1, e1) =>
-                            {
-                                //绉婚櫎fLayout鐣岄潰
-                                frame.RemoveFromParent();
-                            };
-                            //鍙栨秷鐐瑰嚮浜嬩欢
-                            view.btnCancel.MouseUpEventHandler += removefLayout;
-
-                            //鍒濆鍖栧垪琛�
-                            var temperatureList = new List<string>();
-                            for (int i = 16; i < 32; i++)
-                            {
-                                //娣诲姞鏁版嵁
-                                temperatureList.Add(i.ToString() + "鈩�");
-                                temperatureList.Add((i + 0.5).ToString() + "鈩�");
-
-                            }
-
-                            //鍔犺浇鏁版嵁鐣岄潰鐨勮缃柟娉�(鍒楄〃浜掍笉鑱斿姩)
-                            view.mUIPickerView.setNPicker(temperatureList, null, null);
-                            //榛樿鍒濆閫変腑鐘舵��
-                            view.mUIPickerView.setCurrentItems(9, 0, 0);
-                            //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鏃堕棿
-                            string temperature = "25鈩�";
-                            for (int i = 0; i < temperatureList.Count; i++)
-                            {
-                                if (temperatureList[i] == temperatureView.btnState.Text)
-                                {
-                                    //鏇存柊鐘舵��
-                                    view.mUIPickerView.setCurrentItems(i, 0, 0);
-                                    //鏇存柊鐘舵��
-                                    temperature = temperatureList[i];
-                                    break;
-                                }
-                            }
-                            //閫変腑鏃堕棿鍥炶皟鏂规硶,鏃堕棿鍙樺寲涓�娆″洖璋冧竴娆�
-                            view.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) =>
-                            {
-                                temperature = temperatureList[index1];
-                            };
-                            //纭畾鐐瑰嚮浜嬩欢
-                            view.btnConfirm.MouseUpEventHandler += (sender2, e2) =>
-                            {
-                                Dictionary<string, string> dic = new Dictionary<string, string>();
-                                LogicMethod.dictionary(dic, "key", "set_temp");
+                            ///涔嬪墠鐨勭姸鎬佹枃鏈�
+                            string tempValue = temperatureView.btnState.Text;
+                            LogicView.TemperatureView tempView= new LogicView.TemperatureView();
+                            tempView.FLayoutView(this, tempValue,(stateStr)=> {
+                                //鐣岄潰鏄剧ず閫変腑鍊�
+                                temperatureView.btnState.Text = stateStr;
+                                //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�;
                                 string keyVlaue = "set_temp";
-                                string set_temp_value = temperature.Replace("鈩�", "");
+                                selectedState = device.functionType + "_"+ keyVlaue;
+                                string set_temp_value = stateStr.Replace("鈩�", "");
+                                //鏁版嵁灏佽
+                                Dictionary<string, string> dic = new Dictionary<string, string>();
+                                LogicMethod.dictionary(dic, "key", keyVlaue);
                                 LogicMethod.dictionary(dic, "value", set_temp_value);
                                 AddDictionaryData(dicSateteList, keyVlaue, dic);
-                                selectedState = device.functionType + "_set_temp";
-                                RemView(frame);
-                                temperatureView.btnState.Text = temperature;
+                            });
 
 
-                            };
                         };
                         ///妯″紡鐐瑰嚮浜嬩欢
                         acModehView.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
-
-                            List<string> modeStr = new List<string> {
-                                Language.StringByID(StringId.coolLogic),
-                                 Language.StringByID(StringId.heatingLogic),
-                                  Language.StringByID(StringId.autoLogic),
-                                   Language.StringByID(StringId.dehumidifyLogic),
-                            };
-                            FrameLayout frame = new FrameLayout
-                            {
-                                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
-                            };
-                            this.AddChidren(frame);
-
-
                             ///涔嬪墠鐨勭姸鎬佹枃鏈�
                             string currText = acModehView.btnState.Text;
+                            //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�;
+                            string keyVlaue = "mode";
+                            selectedState = device.functionType + "_"+keyVlaue;
                             PublicInterface modeView = new PublicInterface();
-                            modeView.SingleSelectionShow(frame, modeStr, Language.StringByID(StringId.modeLogic), currText
+                            var modeListStr=  modeView.GetViewList(keyVlaue);
+                            modeView.SingleSelectionShow(this, modeListStr, Language.StringByID(StringId.modeLogic), currText
                                , (stateValue) =>
                                {
-                                   string keyVlaue = "mode";
-                                   Dictionary<string, string> dic = new Dictionary<string, string>();
-                                   LogicMethod.dictionary(dic, "key", "mode");
-                                   LogicMethod.dictionary(dic, "value", InterfaceDsplaysLogic.GetModeValueString(stateValue, "mode"));
-                                   AddDictionaryData(dicSateteList, keyVlaue, dic);
+                                   //鐣岄潰鏄剧ず閫変腑鍊�
                                    acModehView.btnState.Text = stateValue;
-                                   selectedState = device.functionType + "_mode";
+                                   //鏁版嵁灏佽
+                                   Dictionary<string, string> dic = new Dictionary<string, string>();
+                                   LogicMethod.dictionary(dic, "key", keyVlaue);
+                                   LogicMethod.dictionary(dic, "value", modeView.GetModeValueString(stateValue, keyVlaue));
+                                   AddDictionaryData(dicSateteList, keyVlaue, dic);
 
                                });
 
@@ -205,35 +151,30 @@
                         ///椋庨�熺偣鍑讳簨浠�
                         acSpeedView.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
-                            List<string> speedStr = new List<string> {
-                                Language.StringByID(StringId.LowWindSpeed),
-                                 Language.StringByID(StringId.MiddleWindSpeed),
-                                  Language.StringByID(StringId.HighWindSpeed),
-                                   Language.StringByID(StringId.Auto),
-                            };
-                            FrameLayout frame = new FrameLayout
-                            {
-                                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
-                            };
-                            this.AddChidren(frame);
 
                             ///涔嬪墠鐨勭姸鎬佹枃鏈�
                             string currText = acSpeedView.btnState.Text;
-                            PublicInterface modeView = new PublicInterface();
-                            modeView.SingleSelectionShow(frame, speedStr, Language.StringByID(StringId.speedLogic), currText
+                            //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�;
+                            string keyVlaue = "fan";
+                            selectedState = device.functionType + "_" + keyVlaue;
+                            PublicInterface speedView = new PublicInterface();
+                            var speedListStr = speedView.GetViewList(keyVlaue);
+                            speedView.SingleSelectionShow(this, speedListStr, Language.StringByID(StringId.speedLogic), currText
                                , (stateValue) =>
                                {
-                                   string keyVlaue = "fan";
-                                   Dictionary<string, string> dic = new Dictionary<string, string>();
-                                   LogicMethod.dictionary(dic, "key", "fan");
-                                   LogicMethod.dictionary(dic, "value", InterfaceDsplaysLogic.GetModeValueString(stateValue, "fan"));
-                                   AddDictionaryData(dicSateteList, keyVlaue, dic);
+                                   //鐣岄潰鏄剧ず閫変腑鍊�
                                    acSpeedView.btnState.Text = stateValue;
-                                   selectedState = device.functionType + "_fan";
+                                   //鏁版嵁灏佽
+                                   Dictionary<string, string> dic = new Dictionary<string, string>();
+                                   LogicMethod.dictionary(dic, "key", keyVlaue);
+                                   LogicMethod.dictionary(dic, "value", speedView.GetModeValueString(stateValue, keyVlaue));
+                                   AddDictionaryData(dicSateteList, keyVlaue, dic);
+
                                });
                         };
                         if (edit)
                         {
+                            //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
                             GetEditState(device, index, acSwitchVie.btnState, temperatureView.btnState, acModehView.btnState, acSpeedView.btnState);
                         }
 
@@ -271,102 +212,53 @@
                         ///娓╁害鐐瑰嚮浜嬩欢
                         temperatureView.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
-                            FrameLayout frame = new FrameLayout
-                            {
-                                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
-                            };
-                            this.AddChidren(frame);
-                            LogicView.TimeView view = new LogicView.TimeView();
-                            view.FLayoutView(frame);
-                            EventHandler<MouseEventArgs> removefLayout = (sender1, e1) =>
-                            {
-                                //绉婚櫎fLayout鐣岄潰
-                                frame.RemoveFromParent();
-                            };
-                            //鍙栨秷鐐瑰嚮浜嬩欢
-                            view.btnCancel.MouseUpEventHandler += removefLayout;
-
-                            //鍒濆鍖栧垪琛�
-                            var temperatureList = new List<string>();
-                            for (int i = 16; i < 32; i++)
-                            {
-                                //娣诲姞鏁版嵁
-                                temperatureList.Add(i.ToString() + "鈩�");
-                                temperatureList.Add((i + 0.5).ToString() + "鈩�");
-
-                            }
-
-                            //鍔犺浇鏁版嵁鐣岄潰鐨勮缃柟娉�(鍒楄〃浜掍笉鑱斿姩)
-                            view.mUIPickerView.setNPicker(temperatureList, null, null);
-
-                            //榛樿鍒濆閫変腑鐘舵��
-                            view.mUIPickerView.setCurrentItems(9, 0, 0);
-                            //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鏃堕棿
-                            string temperature = "25鈩�";
-                            for (int i = 0; i < temperatureList.Count; i++)
-                            {
-                                if (temperatureList[i] == temperatureView.btnState.Text)
-                                {
-                                    //鏇存柊鐘舵��
-                                    view.mUIPickerView.setCurrentItems(i, 0, 0);
-                                    //鏇存柊鐘舵��
-                                    temperature = temperatureList[i];
-                                    break;
-                                }
-                            }
-                            //閫変腑鏃堕棿鍥炶皟鏂规硶,鏃堕棿鍙樺寲涓�娆″洖璋冧竴娆�
-                            view.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) =>
-                            {
-                                temperature = temperatureList[index1];
-                            };
-                            //纭畾鐐瑰嚮浜嬩欢
-                            view.btnConfirm.MouseUpEventHandler += (sender2, e2) =>
-                            {
-                                Dictionary<string, string> dic = new Dictionary<string, string>();
-                                LogicMethod.dictionary(dic, "key", "set_temp");
+                            string tempValue = temperatureView.btnState.Text;
+                            LogicView.TemperatureView tempView = new LogicView.TemperatureView();
+                            tempView.FLayoutView(this, tempValue, (stateStr) => {
+                                //鐣岄潰鏄剧ず閫変腑鍊�
+                                temperatureView.btnState.Text = stateStr;
+                                //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�;
                                 string keyVlaue = "set_temp";
-                                string set_temp_value = temperature.Replace("鈩�", "");
+                                selectedState = device.functionType + "_"+ keyVlaue;
+                                string set_temp_value = stateStr.Replace("鈩�", "");
+                                //鏁版嵁灏佽
+                                Dictionary<string, string> dic = new Dictionary<string, string>();
+                                LogicMethod.dictionary(dic, "key", keyVlaue);
                                 LogicMethod.dictionary(dic, "value", set_temp_value);
-                                selectedState = device.functionType + "_set_temp";
                                 AddDictionaryData(dicSateteList, keyVlaue, dic);
-                                RemView(frame);
-                                temperatureView.btnState.Text = temperature;
 
-                            };
+                            });
+                           
                         };
                         ///妯″紡鐐瑰嚮浜嬩欢
                         floorHeatingModehView.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
-                            FrameLayout frame = new FrameLayout
-                            {
-                                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
-                            };
-                            this.AddChidren(frame);
-                            List<string> modeStr = new List<string> {
-                                Language.StringByID(StringId.dayMode),
-                                 Language.StringByID(StringId.nightMode),
-                                  Language.StringByID(StringId.leaveMode),
-                                   Language.StringByID(StringId.ordinaryMode),
-                                Language.StringByID(StringId.timeMode),
-                            };
+                           
+                           
                             ///涔嬪墠鐨勭姸鎬佹枃鏈�
                             string currText= floorHeatingModehView.btnState.Text;
+                            //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�;
+                            string keyVlaue = "mode";
+                            selectedState = device.functionType + "_"+ keyVlaue;
+
                             PublicInterface modeView = new PublicInterface();
-                            modeView.SingleSelectionShow(frame, modeStr, Language.StringByID(StringId.modeLogic), currText
+                            var modeListStr = modeView.GetViewList("floorheatingmode");
+                            modeView.SingleSelectionShow(this, modeListStr, Language.StringByID(StringId.modeLogic), currText
                                , (stateValue) =>
                                {
-                                   string keyVlaue = "mode";
-                                   Dictionary<string, string> dic = new Dictionary<string, string>();
-                                   LogicMethod.dictionary(dic, "key", "mode");
-                                   LogicMethod.dictionary(dic, "value", InterfaceDsplaysLogic.GetModeValueString(stateValue, "FloorHeating"));
-                                   AddDictionaryData(dicSateteList, keyVlaue, dic);
+                                   //鐣岄潰鏄剧ず閫変腑鍊�
                                    floorHeatingModehView.btnState.Text = stateValue;
-                                   selectedState = device.functionType + "_mode";
+                                   //鏁版嵁灏佽
+                                   Dictionary<string, string> dic = new Dictionary<string, string>();
+                                   LogicMethod.dictionary(dic, "key", keyVlaue);
+                                   LogicMethod.dictionary(dic, "value", modeView.GetModeValueString(stateValue, "floorheatingmode"));
+                                   AddDictionaryData(dicSateteList, keyVlaue, dic);
                                });
 
                         };
                         if (edit)
                         {
+                            //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
                             GetEditState(device, index, floorHeatingSwitchVie.btnState, temperatureView.btnState, floorHeatingModehView.btnState, null);
                         }
 
@@ -505,6 +397,7 @@
             };
             if (edit)
             {
+                //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
                 GetEditState(device, index, curtainSwitchView.btnState, null, null, null);
             }
             #endregion
@@ -552,6 +445,7 @@
             };
             if (edit)
             {
+                //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
                 GetEditState(device, index, lightSwitchView.btnState, brightnessView.btnState, null, null);
             }
             #endregion
@@ -587,13 +481,15 @@
                             id = StringId.stop;
                         } break;
                 }
+                //鐣岄潰鏄剧ず閫変腑鍊�
                 button.TextID = id;
+                selectedState = device.functionType + "_" + strValue;
+                string keyVlaue = "on_off";
+                //鏁版嵁灏佽
                 Dictionary<string, string> dic = new Dictionary<string, string>();
                 LogicMethod.dictionary(dic, "key", "on_off");
-                string keyVlaue = "on_off";
                 LogicMethod.dictionary(dic, "value", strValue);
                 AddDictionaryData(dicSateteList, keyVlaue, dic);
-                selectedState = device.functionType + "_" + strValue;
 
             });
             #endregion
@@ -606,17 +502,17 @@
         private void BrightnessMethod(Entity.Function device, Button button, string titleName)
         {
             #region 鐣岄潰
-            FrameLayout frame = new FrameLayout
-            {
-                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
-            };
-            this.AddChidren(frame);
+            //涔嬪墠鐨勭姸鎬佸��
+            string stateVlaue = button.Text;
             LogicView.BrightnessView brightness = new LogicView.BrightnessView();
-            brightness.FLayoutView(frame, titleName, button.Text, (brightnesValue) =>
+            brightness.FLayoutView(this, titleName, stateVlaue, (brightnesValue) =>
             {
+                //鐣岄潰鏄剧ず閫変腑鍊�
                 button.Text = brightnesValue+"%";
-                Dictionary<string, string> dic = new Dictionary<string, string>();
                 string keyVlaue = "";
+                selectedState = device.functionType + brightnesValue.ToString();
+                //鏁版嵁灏佽
+                Dictionary<string, string> dic = new Dictionary<string, string>();
                 switch (device.functionType)
                 {
                     //寮�鍏崇伅鍏� light.Switch
@@ -639,7 +535,6 @@
                 }
                 LogicMethod.dictionary(dic, "value", brightnesValue.ToString());
                 AddDictionaryData(dicSateteList, keyVlaue, dic);
-                selectedState = device.functionType + brightnesValue.ToString();
             });
             #endregion
 
@@ -728,14 +623,7 @@
             }
 
         }
-        /// <summary>
-        /// 绉婚櫎鎺т欢
-        /// </summary>
-        /// <param name="frame"></param>
-        private void RemView(FrameLayout frame)
-        {
-            frame.RemoveFromParent();
-        }
+     
 
 
     }

--
Gitblit v1.8.0