From 5215a463afd281f62ecd67b2ae87d37404174287 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期一, 28 八月 2023 15:41:59 +0800
Subject: [PATCH] 2023年08月28日15:41:39

---
 HDL_ON/Entity/Function/Scene.cs                                |   16 ++
 HDL_ON/UI/UI2/FuntionControlView/HisenseTV /Send.cs            |   10 
 HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs     |   56 ++++++++
 HDL_ON/DAL/Server/NewAPI.cs                                    |    5 
 HDL_ON/Entity/Function/Function.cs                             |   33 ++++
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs |   10 +
 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs             |   14 ++
 HDL_ON/Common/Utlis.cs                                         |   10 +
 HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs |  199 ++++++++++++++++++++--------
 HDL_ON/UI/MainPage.cs                                          |    6 
 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs |   50 +++----
 11 files changed, 311 insertions(+), 98 deletions(-)

diff --git a/HDL_ON/Common/Utlis.cs b/HDL_ON/Common/Utlis.cs
index 956fc06..7778dc5 100644
--- a/HDL_ON/Common/Utlis.cs
+++ b/HDL_ON/Common/Utlis.cs
@@ -26,13 +26,21 @@
 		/// <param name="tag">鎻忚堪淇℃伅</param>
 		/// <param name="url">璇锋眰鍦板潃(鍙互鏍规嵁鍦板潃杩囨护璇ユ暟鎹�)</param>
 		/// <param name="content">淇℃伅鍐呭</param>
-		public static void WriteLine(string tag,string url,string content)
+		public static void WriteLine(string tag, string url, string content)
 		{
 #if DEBUG
 			if (url == "")
 			{
 				return;
 			}
+			if (!string.IsNullOrEmpty(content))
+			{
+				if (content.StartsWith("{") && content.EndsWith("}"))
+				{
+					//瀹屽叏鏄负浜嗘墦鍗板ソ鐪嬩竴鐐�,娌$壒娈婃剰涔�;
+					content = Newtonsoft.Json.JsonConvert.DeserializeObject(content)?.ToString();
+				}
+			}
 			string text = tag + "======" + url + "\r\n" + content;
 			Console.WriteLine(text);
 #endif
diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs
index 348e8cb..2555660 100644
--- a/HDL_ON/DAL/Server/NewAPI.cs
+++ b/HDL_ON/DAL/Server/NewAPI.cs
@@ -757,6 +757,11 @@
         /// 瑙g粦绗笁鏂筰ot骞冲彴璐﹀彿
         /// </summary>
         public const string Api_Post_Unbound3tyIotAccount = "/smart-open/open-platform/tripartite/userUnbind";
+        /// <summary>
+        /// 瑙g粦浣忓畢涓嬬殑绗笁鏂硅澶�
+        /// </summary>
+        public const string Api_Post_UnbindDeviceToHome = "/smart-open/open-platform/tripartite/unbindDeviceToHome";
+        
         #endregion
 
         #region 鈻�  -- 绾㈠瀹濇帴鍙__________________________
diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index 3973493..31a5117 100644
--- a/HDL_ON/Entity/Function/Function.cs
+++ b/HDL_ON/Entity/Function/Function.cs
@@ -860,6 +860,28 @@
                     }
                 }
             }
+            else if (spk == SPK.MusicStandard|| spk == SPK.AvMusic)
+            {
+                list.AddRange(attributes);
+            }
+            else if (spk == SPK.ElectricalTvHisense)
+            {
+                list.Add(new FunctionAttributes
+                {
+                    key = FunctionAttributeKey.OnOff,
+                    curValue = string.Empty,
+                });
+                list.Add(new FunctionAttributes
+                {
+                    key = FunctionAttributeKey.SetVolume,
+                    curValue = string.Empty,
+                });
+                list.Add(new FunctionAttributes
+                {
+                    key = FunctionAttributeKey.Signal,
+                    curValue = string.Empty,
+                });
+            }
             else
             {
                 list.AddRange(attributes);
@@ -940,6 +962,9 @@
 
                 switch (attr.key)
                 {
+
+                    case FunctionAttributeKey.SetVolume:
+                    case FunctionAttributeKey.Signal:
                     case FunctionAttributeKey.OnOff:
                     case FunctionAttributeKey.Brightness:
                     case FunctionAttributeKey.Mode:
@@ -1577,6 +1602,14 @@
         /// </summary>
         public const string TotalElectricity = "total_electricity";
 
+        /// <summary>
+        /// 娴蜂俊tv闊抽噺
+        /// </summary>
+        public const string SetVolume = "set_volume";
+        /// <summary>
+        /// 娴蜂俊tv淇″彿婧�(0:LiveTV;2:PS;3:HDMI_1;4:HDMI_2;5:HDMI_3;6:HDMI_4;11:AV;)
+        /// </summary>
+        public const string Signal = "signal";
 
     }
     /// <summary>
diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs
index 04888ab..cf4d230 100644
--- a/HDL_ON/Entity/Function/Scene.cs
+++ b/HDL_ON/Entity/Function/Scene.cs
@@ -706,6 +706,12 @@
                 case "security":
                     text = Language.StringByID(StringId.DeploymentStatus);
                     break;
+                case FunctionAttributeKey.SetVolume:
+                    text = Language.StringByID(StringId.yinliang);
+                    break;
+                case FunctionAttributeKey.Signal:
+                    text = Language.StringByID(StringId.xinhaoyuan);
+                    break;
             }
             return text;
         }
@@ -717,7 +723,7 @@
         /// </summary>
         public string GetUintString()
         {
-            if (!string.IsNullOrEmpty(UintString) && UintString!= "{}")
+            if (!string.IsNullOrEmpty(UintString) && UintString != "{}")
             {
                 return UintString;
             }
@@ -851,6 +857,14 @@
                 case "auto":
                     text = Language.StringByID(StringId.Auto);
                     break;
+                case FunctionAttributeKey.SetVolume:
+                    text = value;
+                    break;
+                case FunctionAttributeKey.Signal:
+                    var p = new UI.UI2.Intelligence.Automation.PublicInterface();
+                    var dic = p.GetHisenseSignalSourceDic();
+                    text = p.GetKey(dic, value);
+                    break;
             }
             return text;
         }
diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs
index 47d8155..e704e17 100644
--- a/HDL_ON/UI/MainPage.cs
+++ b/HDL_ON/UI/MainPage.cs
@@ -122,9 +122,9 @@
             SPK.PanelSocket,SPK.ElectricSocket,
             SPK.MechanicalArm,SPK.IpCam_Imou,
             SPK.GroupControl,
-            //SPK.AvMusic,
-            //SPK.MusicStandard,
-            //SPK.ElectricalTvHisense
+            SPK.AvMusic,
+            SPK.MusicStandard,
+            SPK.ElectricalTvHisense
         };
 
 
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 193eb02..7442f62 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -1510,7 +1510,7 @@
                                         }
                                         if (!string.IsNullOrEmpty(volumet))
                                         {
-                                            stateStr += Language.StringByID(StringId.yinliang)+ volumet;
+                                            stateStr += Language.StringByID(StringId.yinliang) + volumet;
                                         }
 
                                         if (!string.IsNullOrEmpty(stateStr))
@@ -1519,7 +1519,9 @@
                                         }
                                         if (!string.IsNullOrEmpty(signal))
                                         {
-                                            stateStr += signal.Replace("_", " ");
+                                            var p = new PublicInterface();
+                                            string key = p.GetKey(p.GetHisenseSignalSourceDic(), signal);
+                                            stateStr += key;
                                         }
                                         stateStr = stateStr.TrimEnd(',');
                                     }
@@ -2535,7 +2537,9 @@
                                             //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
                                             break;
                                         }
-                                        button3.Text = value.Replace("_", " ");
+                                        var p = new PublicInterface();
+                                        string key = p.GetKey(p.GetHisenseSignalSourceDic(), value);
+                                        button3.Text = key;
                                     }
                                     break;
                             }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
index a073cc9..1263bbf 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -1,5 +1,6 @@
 锘縰sing System;
 using System.Collections.Generic;
+using System.Linq;
 using Shared;
 namespace HDL_ON.UI.UI2.Intelligence.Automation
 {
@@ -1304,6 +1305,61 @@
             return value;
         }
 
+       
+        /// <summary>
+        /// 鑾峰彇key鍊�
+        /// </summary>
+        /// <param name="value"></param>
+        /// <returns>涓嶅瓨鍦ㄨ繑鍥炵┖瀛楃鈥溾��</returns>
+        public string GetKey(Dictionary<string, string> dic, string value)
+        {
+            if (string.IsNullOrEmpty(value)) {
+                return  string.Empty;
+            }
+            if (dic==null||dic.Count==0)
+            {
+                return string.Empty;
+            }
+            //濡傛灉鍑虹幇澶氫釜鐩稿悓Value锛岃繖閲岄粯璁よ繑鍥炴槸绗竴涓猭ey鍊�
+            var key = dic.FirstOrDefault(q => q.Value == value).Key;
+            return key == null ? string.Empty : key;
+        }
+
+        /// <summary>
+        /// 鑾峰彇value鍊�
+        /// </summary>
+        /// <param name="key">閿�</param>
+        /// <returns>涓嶅瓨鍦ㄨ繑鍥炵┖瀛楃鈥溾��</returns>
+        public string GetValue(Dictionary<string, string> dic, string key)
+        {
+            if (string.IsNullOrEmpty(key))
+            {
+                return string.Empty;
+            }
+            if (dic == null || dic.Count == 0)
+            {
+                return string.Empty;
+            }
+            string value = string.Empty;
+            dic.TryGetValue(key, out value);
+            return value == null ? string.Empty : value;
+        }
+        /// <summary>
+        /// 鑾峰彇娴蜂俊鐢佃淇″彿婧愬垪琛�( 0:LiveTV;2:PS;3:HDMI_1;4:HDMI_2;5:HDMI_3;6:HDMI_4;11:AV;)
+        /// </summary>
+        /// <returns></returns>
+        public Dictionary<string, string> GetHisenseSignalSourceDic()
+        {
+            var dic = new Dictionary<string, string>();
+            dic.Add("HDML 1", "3");
+            dic.Add("HDML 2", "4");
+            dic.Add("HDML 3", "5");
+            dic.Add("HDML 4", "6");
+            dic.Add("Live TV", "0");
+            dic.Add("PS", "2");
+            dic.Add("AV", "11");
+            return dic;
+        }
 
     }
 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index faaa9d6..89a1e85 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -3,6 +3,7 @@
 using System.Collections.Generic;
 using HDL_ON.Entity;
 using HDL_ON.UI.CSS;
+using System.Linq;
 
 namespace HDL_ON.UI.UI2.Intelligence.Automation
 {
@@ -59,7 +60,7 @@
                 //缇ゆ帶
                 case SPK.GroupControl:
                     int height = Application.GetRealHeight(50);
-                    int attributesNameId=0;
+                    int attributesNameId = 0;
                     int count = 0;
                     foreach (var attr in (device as GroupControl).attributes)
                     {
@@ -136,7 +137,7 @@
                     }
 
                     //璁惧寤舵椂iewv
-                    DelayView(fLayout, height* count);
+                    DelayView(fLayout, height * count);
                     break;
                 //鎻掑骇(鏈塙SB)
                 case SPK.PanelSocket:
@@ -211,8 +212,8 @@
                     break;
                 //鐏厜寮�鍏� 浜害
                 case SPK.LightDimming:
-                //case SPK.LightRGB:
-                //case SPK.LightRGBW:
+                    //case SPK.LightRGB:
+                    //case SPK.LightRGBW:
                     {
                         #region 鐣岄潰
                         ///寮�鍏�
@@ -736,7 +737,7 @@
                         ///闊抽噺
                         LogicView.FunTypeView volView = new LogicView.FunTypeView();
                         volView.frameLayout.Y = funTypeView.frameLayout.Bottom;
-                        volView.btnText.TextID = StringId.volumeMusic; 
+                        volView.btnText.TextID = StringId.volumeMusic;
                         fLayout.AddChidren(volView.FLayoutView());
 
                         //if (SPK.AvMusic == device.spk)
@@ -744,7 +745,7 @@
                         //    //涓嶆敮鎸佺壒娈婅闊�
                         //    volView.frameLayout.Y = Application.GetRealHeight(0);
                         //}
-                        
+
 
                         ///璁惧寤舵椂iewv
                         DelayView(fLayout, volView.frameLayout.Bottom);
@@ -763,11 +764,11 @@
                                 {
                                     //HDL_ON.DriverLayer.Control.Ins.GetMusicDirectory(device);
                                     //var palyListName = Music.SendMethod.mMethod.GetListName(device); 
-                                    var palyList= Music.SendMethod.Current.GetSingleSongList(device, "hdl_special","");
-                                    List<string> songNameList = new List<string>(); 
+                                    var palyList = Music.SendMethod.Current.GetSingleSongList(device, "hdl_special", "");
+                                    List<string> songNameList = new List<string>();
                                     for (int i = 0; i < palyList.songs.Count; i++)
                                     {
-                                        var song = palyList.songs[i]; 
+                                        var song = palyList.songs[i];
                                         songNameList.Add(song.name);
                                     }
                                     Application.RunOnMainThread(() =>
@@ -776,7 +777,7 @@
                                         PublicInterface publicInterface = new PublicInterface();
                                         publicInterface.FrameOrVv(this, songNameList, new List<string> { funTypeView.btnState.Text }, palyList.group, (index2) =>
                                         {
-                                            var songSelecetd = palyList.songs[index2]; 
+                                            var songSelecetd = palyList.songs[index2];
                                             //鐣岄潰鏄剧ず閫変腑鍊�
                                             funTypeView.btnState.Text = songSelecetd.name;
                                             //鏁版嵁灏佽
@@ -788,7 +789,7 @@
                                                 AddDictionary("url", songSelecetd.url);
                                             }
 
-                                        },false);
+                                        }, false);
 
                                     });
                                 }
@@ -802,12 +803,12 @@
                             selectedState = device.spk + "_volume";
                             new LogicView.TipPopView { }.InputBox(StringId.volumeMusic, volView.btnState.Text, (value) =>
                             {
-                                
+
                                 //鐣岄潰鏄剧ず閫変腑鍊�
-                                volView.btnState.Text =value;
+                                volView.btnState.Text = value;
                                 //鏁版嵁灏佽
                                 AddDictionary("volume", value);//闊抽噺
-                            },0,100);
+                            }, 0, 100);
                         };
 
                         if (edit)
@@ -824,7 +825,7 @@
                     {
                         #region 鐣岄潰
                         ///寮�鍏�
-                        LogicView.FunTypeView switchView = new LogicView.FunTypeView(); 
+                        LogicView.FunTypeView switchView = new LogicView.FunTypeView();
                         switchView.btnText.TextID = StringId.switchLogic;
                         fLayout.AddChidren(switchView.FLayoutView());
                         ///闊抽噺
@@ -834,7 +835,7 @@
                         fLayout.AddChidren(volView.FLayoutView());
 
                         ///淇″彿婧�
-                        LogicView.FunTypeView sourceView = new LogicView.FunTypeView(); 
+                        LogicView.FunTypeView sourceView = new LogicView.FunTypeView();
                         sourceView.frameLayout.Y = volView.frameLayout.Bottom;
                         sourceView.btnText.TextID = StringId.xinhaoyuan;
                         fLayout.AddChidren(sourceView.FLayoutView());
@@ -871,23 +872,16 @@
                             ///涔嬪墠鐨勭姸鎬佹枃鏈�
                             string currText = sourceView.btnState.Text;
                             //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�;
-                            string key = "signal"; 
+                            string key = "signal";
                             selectedState = device.spk + "_" + key;
                             PublicInterface pif = new PublicInterface();
-                            var sourceList = new List<string>();
-                            sourceList.Add("HDML 1");
-                            sourceList.Add("HDML 2");
-                            sourceList.Add("HDML 3");
-                            sourceList.Add("HDML 4");
-                            sourceList.Add("Live TV");
-                            sourceList.Add("PS");
-                            sourceList.Add("AV");
-                            pif.SingleSelectionShow(this, sourceList, Language.StringByID(StringId.xinhaoyuan), currText
-                               , (valueStr) => 
+                            var dic = pif.GetHisenseSignalSourceDic();
+                            pif.SingleSelectionShow(this, dic.Keys.ToList(), Language.StringByID(StringId.xinhaoyuan), currText
+                               , (valueStr) =>
                                {
                                    //鐣岄潰鏄剧ず閫変腑鍊�
                                    sourceView.btnState.Text = valueStr;
-                                   string value = valueStr.Replace(" ", "_");
+                                   string value = pif.GetValue(dic, valueStr);
                                    //鏁版嵁灏佽
                                    AddDictionary(key, value);
 
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs
index 61a1d85..62f26f6 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs
@@ -571,6 +571,20 @@
                 }
             }
 
+            var perSetVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume);
+            if (perSetVolume != null)
+            {
+                sceneFunctionInfo += " " + perSetVolume.value ;
+            }
+
+            var perSignal = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Signal);
+            if (perSignal != null)
+            {
+                var p = new HDL_ON.UI.UI2.Intelligence.Automation.PublicInterface();
+                string key = p.GetKey(p.GetHisenseSignalSourceDic(), perSignal.value);
+                sceneFunctionInfo += " " + key;
+            }
+
             return sceneFunctionInfo;
         }
 
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
index 5cb0afd..681f9a9 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
@@ -3,6 +3,7 @@
 using HDL_ON.UI.CSS;
 using Shared;
 using System.Collections.Generic;
+using System.Linq;
 
 namespace HDL_ON.UI
 {
@@ -25,12 +26,14 @@
         SceneFunction rgbColorful;
         bool isOnStatus = false;
 
-        public SceneFunctionInfoEditPage(Scene s, SceneFunction fc,Action action)
+
+        public SceneFunctionInfoEditPage(Scene s, SceneFunction fc, Action action)
         {
-            bodyView = this; 
-             scene = s;
+
+            bodyView = this;
+            scene = s;
             sceneFunction = fc.localFunction.ConvertSceneFunction();
-            foreach(var ll in sceneFunction.status)
+            foreach (var ll in sceneFunction.status)
             {
                 try
                 {
@@ -118,6 +121,12 @@
                     case "security"://澶у崕鎽勫儚甯冮槻鎾ら槻
                         LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == "security"));
                         break;
+                    case FunctionAttributeKey.SetVolume:
+                        LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume));
+                        break;
+                    case FunctionAttributeKey.Signal:
+                        LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Signal));
+                        break;
                 }
             }
 
@@ -146,14 +155,15 @@
                 BackgroundColor = CSS_Color.MainColor,
                 TextSize = CSS_FontSize.SubheadingFontSize,
                 IsBold = true,
-                Radius = (uint) Application.GetRealWidth(22),
+                Radius = (uint)Application.GetRealWidth(22),
                 TextID = StringId.Complete
             };
             bottomView.AddChidren(btnConfrim);
 
             btnConfrim.MouseUpEventHandler = (sender, e) =>
             {
-                if (sceneFunction.localFunction.spk == SPK.GroupControl) {
+                if (sceneFunction.localFunction.spk == SPK.GroupControl)
+                {
                     var colorBegin = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.ColorfulBegin);
                     if (colorBegin != null)
                     {
@@ -254,14 +264,14 @@
         void UpdataFunctionRow()
         {
             contentView.RemoveAll();
-            for (var i =0;i< functionRowList.Count; i++)
+            for (var i = 0; i < functionRowList.Count; i++)
             {
                 try
                 {
                     var view = functionRowList[i];
-                    if(view!= null)
+                    if (view != null)
                     {
-                        if(view.GetType() == typeof(FrameLayout))
+                        if (view.GetType() == typeof(FrameLayout))
                         {
                             if (view.Tag != null)
                             {
@@ -276,7 +286,7 @@
                                     {
                                         if (isColorful && sceneFunction.localFunction.spk == SPK.LightRGB)
                                         {
-                                            if(view.Tag.ToString() != FunctionAttributeKey.Colorful)
+                                            if (view.Tag.ToString() != FunctionAttributeKey.Colorful)
                                             {
                                                 view.RemoveFromParent();
                                             }
@@ -301,7 +311,8 @@
                             }
                         }
                     }
-                }catch(Exception ex)
+                }
+                catch (Exception ex)
                 {
                     MainPage.Log($"UpdataFuntionRow error:{ex.Message}");
                 }
@@ -490,8 +501,8 @@
 
                             break;
                         case "angle":
-                        //鍛堢幇鐨勫脊绐�
-                        LoadEditDialog_Angle(sceneStatus, btnFunctionText);
+                            //鍛堢幇鐨勫脊绐�
+                            LoadEditDialog_Angle(sceneStatus, btnFunctionText);
 
                             break;
                         case "cct":
@@ -510,11 +521,28 @@
                         case FunctionAttributeKey.Percent:
                             LoadEditDialog_Percent(sceneStatus, btnFunctionText);
                             break;
+                        case FunctionAttributeKey.SetVolume:
+                            BrightnessView(btnFunctionText.Text, btnFunctionName.Text, (volume, uintStr) =>
+                            {
+                                btnFunctionText.Text = volume;
+                                sceneStatus.value = volume;
+                            });
+                            break;
+                        case FunctionAttributeKey.Signal:
+                            var p = new UI2.Intelligence.Automation.PublicInterface();
+                            var dic = p.GetHisenseSignalSourceDic();
+                            ListView(dic.Keys.ToList(), btnFunctionText.Text, btnFunctionName.Text, (valueStr) =>
+                            {
+                                btnFunctionText.Text = valueStr;
+                                sceneStatus.value = p.GetValue(dic, valueStr);
+                            });
+                            break;
                     }
                 };
 
                 #endregion
-            }catch(Exception ex)
+            }
+            catch (Exception ex)
             {
                 MainPage.Log($"鍦烘櫙鍔犺浇璁惧灞炴�у紓甯革細{ex.Message}");
             }
@@ -672,8 +700,10 @@
             delayRow.AddChidren(btnSceneDelayTitle);
 
 
-            btnSceneDelayTitle.MouseUpEventHandler = (sender, e) => {
-                Action<string> action = (obj) => {
+            btnSceneDelayTitle.MouseUpEventHandler = (sender, e) =>
+            {
+                Action<string> action = (obj) =>
+                {
                     sceneFunction.delay = obj;
                     btnDelayInfo.Text = new Scene() { delay = sceneFunction.delay }.GetDelayText();
                 };
@@ -974,21 +1004,25 @@
 
             dialog.Show();
 
-            pView.MouseUpEventHandler = (sender, e) => {
+            pView.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
             };
 
-            btnCancel.MouseUpEventHandler = (sender, e) => {
+            btnCancel.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
             };
-            btnOn.MouseUpEventHandler = (sender, e) => {
+            btnOn.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
                 trait.value = "true";
                 sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Security).value = "true";
                 btn.Text = trait.GetValueText() + trait.GetUintString();
 
             };
-            btnOff.MouseUpEventHandler = (sender, e) => {
+            btnOff.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
                 trait.value = "false";
                 sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Security).value = "false";
@@ -1011,7 +1045,7 @@
             trait.value = temp.ToString();
 
             List<string> pickerItems = new List<string>();
-            if(trait == null)
+            if (trait == null)
             {
                 return;
             }
@@ -1026,7 +1060,7 @@
 
             var optionBaseView = new FrameLayout()
             {
-                Y = Application.GetRealHeight(456-60),
+                Y = Application.GetRealHeight(456 - 60),
                 Gravity = Gravity.CenterHorizontal,
                 Width = Application.GetRealWidth(343),
                 Height = Application.GetRealHeight(260),
@@ -1046,7 +1080,7 @@
                 Radius = (uint)Application.GetRealWidth(12),
             };
             optionBaseView.AddChidren(topView);
-            topView.AddChidren(new Button() {Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
+            topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
 
             var btnCancel = new Button()
             {
@@ -1088,26 +1122,30 @@
             if (pickerItems.Contains(trait.value + trait.GetUintString()))
             {
                 selectItem = trait.value.ToString() + trait.GetUintString();
-                uIPickerView.setCurrentItems(pickerItems.IndexOf(selectItem),0,0);
+                uIPickerView.setCurrentItems(pickerItems.IndexOf(selectItem), 0, 0);
             }
 
             dialog.Show();
 
-            pView.MouseUpEventHandler = (sender, e) => {
+            pView.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
             };
 
-            btnCancel.MouseUpEventHandler = (sender, e) => {
+            btnCancel.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
             };
-            uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => {
+            uIPickerView.OnSelectChangeEvent = (int1, int2, int3) =>
+            {
                 selectItem = pickerItems[int1];
             };
-            btnConfrim.MouseUpEventHandler = (sender, e) => {
+            btnConfrim.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
                 btn.Text = selectItem;
                 //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ;
-                trait.value = selectItem.Replace(trait.GetUintString(),"");
+                trait.value = selectItem.Replace(trait.GetUintString(), "");
             };
 
         }
@@ -1117,7 +1155,7 @@
         /// </summary>
         /// <param name="function"></param>
         /// <param name="btn"></param>
-        void LoadEditDialog_Angle (SceneFunctionStatus trait, Button btn)
+        void LoadEditDialog_Angle(SceneFunctionStatus trait, Button btn)
         {
             double temp = trait.min;
             double.TryParse(trait.value, out temp);
@@ -1196,7 +1234,7 @@
             }
             uIPickerView.setNPicker(pickerItems, null, null);
             optionBaseView.AddChidren(uIPickerView);
-            uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()+ "掳"), 0, 0);
+            uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString() + "掳"), 0, 0);
 
             string selectItem = pickerItems[pickerItems.IndexOf(trait.value.ToString() + "掳")];
             if (pickerItems.Contains(trait.value + trait.GetUintString()))
@@ -1206,17 +1244,21 @@
             //uIPickerView.setCurrentItems
             dialog.Show();
 
-            pView.MouseUpEventHandler = (sender, e) => {
+            pView.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
             };
 
-            btnCancel.MouseUpEventHandler = (sender, e) => {
+            btnCancel.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
             };
-            uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => {
+            uIPickerView.OnSelectChangeEvent = (int1, int2, int3) =>
+            {
                 selectItem = pickerItems[int1];
             };
-            btnConfrim.MouseUpEventHandler = (sender, e) => {
+            btnConfrim.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
                 btn.Text = selectItem;
                 //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ;
@@ -1416,7 +1458,7 @@
             }
 
             double temp = trait.min;
-          
+
             double.TryParse(trait.value, out temp);
             trait.value = temp.ToString();
 
@@ -1494,24 +1536,28 @@
             uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5);
 
             string selectItem = pickerItems[0];
-              if (pickerItems.Contains(trait.value + trait.GetUintString()))
+            if (pickerItems.Contains(trait.value + trait.GetUintString()))
             {
                 selectItem = trait.value.ToString() + trait.GetUintString();
             }
 
             dialog.Show();
 
-            pView.MouseUpEventHandler = (sender, e) => {
+            pView.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
             };
 
-            btnCancel.MouseUpEventHandler = (sender, e) => {
+            btnCancel.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
             };
-            uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => {
+            uIPickerView.OnSelectChangeEvent = (int1, int2, int3) =>
+            {
                 selectItem = pickerItems[int1];
             };
-            btnConfrim.MouseUpEventHandler = (sender, e) => {
+            btnConfrim.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
                 btn.Text = selectItem;
                 //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ;
@@ -1574,7 +1620,7 @@
 
             #endregion
 
-            int attrViewHight = Application.GetRealHeight(18 + 22+ 248);
+            int attrViewHight = Application.GetRealHeight(18 + 22 + 248);
             //灞炴�ц缃尯鍩�
             var attrView = new FrameLayout()
             {
@@ -1585,7 +1631,7 @@
             contentView.AddChidren(attrView);
             attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) });
 
-            
+
 
             #region RGB
             var rgbView = new FrameLayout()
@@ -1642,7 +1688,8 @@
             int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12);
 
 
-            colorPicker.ColorChaged += (sender2, e2) => {
+            colorPicker.ColorChaged += (sender2, e2) =>
+            {
                 rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString();
                 //trait.value = rgbString;
                 btnCurColor.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
@@ -1695,7 +1742,8 @@
                 TextID = StringId.Cancel,
             };
             bottomView.AddChidren(btnCancel);
-            btnCancel.MouseUpEventHandler = (sender, e) => {
+            btnCancel.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
             };
 
@@ -1715,7 +1763,8 @@
             //渚嬶細鍙充笅鍦嗚 澶у皬涓�50
             int mRectCornerID = HDLUtils.RectCornerBottomRight;
             btnComplete.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID);
-            btnComplete.MouseUpEventHandler = (sender, e) => {
+            btnComplete.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
                 trait.value = rgbString;
                 btn.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
@@ -1745,7 +1794,8 @@
                 return;
             }
 
-            Dialog dialog = new Dialog() {
+            Dialog dialog = new Dialog()
+            {
                 Height = Application.GetRealHeight(647),
             };
 
@@ -1845,7 +1895,8 @@
             int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12);
 
 
-            colorPicker.ColorChaged += (sender2, e2) => {
+            colorPicker.ColorChaged += (sender2, e2) =>
+            {
                 rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString();
                 //trait.value = rgbString;
                 btnCurColor.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
@@ -1879,7 +1930,7 @@
             #region 
             var btnCancel = new Button()
             {
-                X  = Application.GetRealWidth(20),
+                X = Application.GetRealWidth(20),
                 Width = Application.GetRealWidth(100),
                 Height = Application.GetRealHeight(44),
                 TextAlignment = TextAlignment.CenterLeft,
@@ -1888,7 +1939,8 @@
                 TextID = StringId.Cancel,
             };
             titleView.AddChidren(btnCancel);
-            btnCancel.MouseUpEventHandler = (sender, e) => {
+            btnCancel.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
             };
 
@@ -1907,7 +1959,8 @@
             //渚嬶細鍙充笅鍦嗚 澶у皬涓�50
             int mRectCornerID = HDLUtils.RectCornerBottomRight;
             btnComplete.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID);
-            btnComplete.MouseUpEventHandler = (sender, e) => {
+            btnComplete.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
                 trait.value = rgbString;
                 btn.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
@@ -2102,14 +2155,14 @@
         /// <summary>
         /// 鍔犺浇鍔熻兘灞炴�ф暟鎹�夋嫨寮圭獥
         /// </summary>
-        void LoadEditDialog_FunctionPar(SceneFunctionStatus trait, Button btn,List<string> statusList)
+        void LoadEditDialog_FunctionPar(SceneFunctionStatus trait, Button btn, List<string> statusList)
         {
             Button lastButton = new Button();
             var lastData = trait.value;
             var lastText = btn.Text;
             Dialog dialog = new Dialog();
 
-            if(DB_ResidenceData.Instance.GatewayType == 0)
+            if (DB_ResidenceData.Instance.GatewayType == 0)
             {
                 if (SPK.AcSpkList().Contains(sceneFunction.localFunction.spk))
                 {
@@ -2278,7 +2331,8 @@
                 };
                 row.AddChidren(btnPropertyTitle);
 
-                btnPropertyTitle.MouseUpEventHandler = (sender, e) => {
+                btnPropertyTitle.MouseUpEventHandler = (sender, e) =>
+                {
                     btnChoose.IsSelected = true;
                     if (lastButton != null)
                     {
@@ -2295,14 +2349,17 @@
 
             dialog.Show();
 
-            pView.MouseUpEventHandler = (sender, e) => {
+            pView.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
             };
 
-            btnCancel.MouseUpEventHandler = (sender, e) => {
+            btnCancel.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
             };
-            btnConfrim.MouseUpEventHandler = (sender, e) => {
+            btnConfrim.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
                 trait.value = lastData;
                 //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.curValue.ToString() ;
@@ -2311,6 +2368,34 @@
 
         }
 
+
+        /// <summary>
+        /// 鐧惧垎姣�
+        /// </summary>
+        /// <param name="oldStateValue">鏃х姸鎬佸��</param>
+        /// <param name="titleName">鏍囬</param>
+        ///  <param name="action">鍥炶皟</param>
+        void BrightnessView(string oldStateValue, string titleName, Action<string, string> action)
+        {
+            #region 鐣岄潰
+            var brightness = new UI2.Intelligence.Automation.LogicView.BrightnessView();
+            brightness.FLayoutView(this, titleName, oldStateValue, action);
+            #endregion
+
+        }
+        /// <summary>
+        /// 鍒楄〃鐣岄潰
+        /// </summary>
+        /// <param name="list">鐣岄潰鏄剧ず鏁版嵁婧�</param>
+        /// <param name="oldStateValue">鏃х姸鎬佸��</param>
+        /// <param name="titleName">鏍囬</param>
+        ///  <param name="action">鍥炶皟</param>
+        void ListView(List<string> list, string oldStateValue, string titleName, Action<string> action)
+        {
+            var pif = new UI2.Intelligence.Automation.PublicInterface();
+            pif.SingleSelectionShow(this, list, titleName, oldStateValue, action);
+        }
+
         #endregion
 
     }
diff --git a/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /Send.cs b/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /Send.cs
index 28343de..875d3ad 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /Send.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /Send.cs
@@ -35,17 +35,17 @@
         /// <param name="deviceId">璁惧id</param>
         /// <param name="action">鎴愬姛杩斿洖true</param>
         /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param>
-        public bool DelDevice(string deviceId,Action<bool>action, TipType tipType = TipType.flicker)
+        public void DelDevice(string deviceId, Action<bool> action, TipType tipType = TipType.flicker)
         {
             Dictionary<string, object> d = new Dictionary<string, object>();
             d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
-            d.Add("deviceId", deviceId);//璁惧id
-            var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(d, NewAPI.Api_Post_Aks_KeypadExecute, "鍒犻櫎娴蜂俊鐢佃");
+            d.Add("deviceIds", new List<string> { deviceId });//璁惧id
+            var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(d, NewAPI.Api_Post_UnbindDeviceToHome, "鍒犻櫎娴蜂俊鐢佃");
             if (!this.DataChecking(responsePackNew, tipType))
             {
-                return false;
+                action?.Invoke(false);
             }
-            return true;
+            action?.Invoke(true);
         }
 
         /// <summary>

--
Gitblit v1.8.0