From a5ae6e497c9e1398220949e028d44fa15cb274c6 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期一, 11 九月 2023 14:17:24 +0800
Subject: [PATCH] 2023年09月11日14:15:05

---
 HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs  |    7 ++
 HDL_ON/UI/UI2/FuntionControlView/HisenseTV /Send.cs          |   50 ++++++++++++++++
 HDL_ON/Entity/Function/Function.cs                           |    2 
 HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs |   63 ++++++++++++++++-----
 HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs         |   10 +--
 5 files changed, 109 insertions(+), 23 deletions(-)

diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index afb0f09..6bc9f21 100644
--- a/HDL_ON/Entity/Function/Function.cs
+++ b/HDL_ON/Entity/Function/Function.cs
@@ -451,7 +451,7 @@
         public bool online {
             get
             {
-                if (spk == SPK.AirSwitchP3)
+                if (spk == SPK.AirSwitchP3|| spk == SPK.ElectricalTvHisense)
                 {
                     return _online;
                 }
diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
index 8aa0b44..b3aab1d 100644
--- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
@@ -1215,8 +1215,7 @@
                         {
                             var list =CommonMethod.Current.GetVideoDoorLockList();
                             var form = new VideoDoorLockListPage(()=> {
-                                functionContentView?.RemoveFromParent();
-                                this.RefreshFunctionView();
+                                UpdateBottomView();
                             });
                             form.AddForm(list);
                         };
@@ -1228,8 +1227,7 @@
                         {
                             var list = HDL_ON.UI.UI2.FuntionControlView.Aks.AksCommonMethod.Current.GetVideoControlsList();
                             var form = new HDL_ON.UI.UI2.FuntionControlView.Aks.AksListPage(() => {
-                                functionContentView?.RemoveFromParent();
-                                this.RefreshFunctionView();
+                                UpdateBottomView();
                             });
                             form.AddForm(list);
                         };
@@ -1258,8 +1256,8 @@
                         MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                         skipView.DelAction += () =>
                         {
-                            functionContentView?.RemoveFromParent();
-                            this.RefreshFunctionView();
+                           
+                            UpdateBottomView();
                         };
                     };
                 }
diff --git a/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs b/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs
index 4080a14..97c64ec 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs
@@ -526,7 +526,12 @@
                     Radius = (uint)Application.GetRealWidth(22),
                     BackgroundColor = CSS_Color.MainBackgroundColor,
                 };
-                contentView.AddChidren(delTextBtn);
+                //濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
+                if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare)
+                {
+                    contentView.AddChidren(delTextBtn);
+                }
+
 
                 EventHandler<MouseEventArgs> ClickEvent = (sener, e) =>
                 {
diff --git a/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs b/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs
index 9685f89..83623d5 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs
@@ -93,7 +93,7 @@
             this.btnRoomName = btnRoomName;
             this.btnCollectionIcon = btnCollectionIcon;
             this.comerom = comerom;
-            this.action = action; 
+            this.action = action;
 
         }
 
@@ -105,7 +105,7 @@
             //鍒濆鍖栦簨浠�
             this.EventListener();
             //璇诲彇鏁版嵁
-            //this.ReadData();
+            this.ReadData();
 
         }
 
@@ -192,11 +192,11 @@
                 ControlCommand(HisenseTVFunctionalAttributeConstant.volume_subtract, "");
             };
             //鑿滃崟
-           caidanBtn.SetClickListener((btn) =>
-            {
-                ControlCommand(HisenseTVFunctionalAttributeConstant.operation, "11");
+            caidanBtn.SetClickListener((btn) =>
+             {
+                 ControlCommand(HisenseTVFunctionalAttributeConstant.operation, "11");
 
-            });
+             });
             //鎾斁
             bofangBtn.SetClickListener((btn) =>
             {
@@ -293,6 +293,26 @@
         {
             try
             {
+                if (this.device == null)
+                {
+                    //璁惧涓嶅湪绾挎帶鍒跺け璐�
+                    Application.RunOnMainThread(() =>
+                    {
+                        CommonMethod.Current.ShowTip(Language.StringByID(StringId.shebeibuzaixian), 3);
+                    });
+                    return;
+                }
+
+                if (!this.device.online)
+                {
+                    //璁惧涓嶅湪绾挎帶鍒跺け璐�
+                    Application.RunOnMainThread(() =>
+                    {
+                        CommonMethod.Current.ShowTip(Language.StringByID(StringId.shebeibuzaixian), 3);
+                    });
+                    return;
+                }
+
                 Dictionary<string, string> dic = new Dictionary<string, string>();
                 dic.Add(key, value);
                 Send.Current.SendControlCommand(this.device, dic, action);
@@ -304,14 +324,27 @@
         /// </summary>
         private void ReadData()
         {
+            if (this.device == null)
+            {
+                return;
+            }
             CommonMethod.Current.Loading.Start();
             CommonMethod.Current.SunThread(() =>
             {
                 try
                 {
-                    CommonMethod.Current.MainThread(() =>
+
+                    var isRefreshDeviceStatus = Send.Current.RefreshDeviceStatus(new List<string> { this.device.deviceId });
+                    if (isRefreshDeviceStatus)
                     {
-                    });
+                        var fun = Send.Current.GetDeviceInfo(this.device.deviceId);
+                        if (fun != null)
+                        {
+                            //鏇存柊鐪熷疄鍦ㄧ嚎鐘舵��
+                            this.device.online = fun.online;
+                        }
+
+                    }
                 }
                 catch { }
                 finally
@@ -413,7 +446,7 @@
             kaijiFL.GetImageButton().SelectedImagePath = "HisenseTv/kaiguanSelected.png";
             kaijiFL.GetTextButton().TextID = StringId.kaiji;
 
-            guanFL = new CustomFrameLayout(); 
+            guanFL = new CustomFrameLayout();
             backgroundOpenFl.AddChidren(guanFL);
             guanFL.X = kaijiFL.Right + Application.GetRealWidth(37);
             guanFL.Y = yHeight;
@@ -580,7 +613,7 @@
             #endregion
 
         }
-     
+
         /// <summary>
         /// 鍒濆鍖栧ご閮�
         /// </summary>
@@ -592,7 +625,7 @@
             this.topView.topNameBtn.TextID = StringId.dianshi;
             this.AddChidren(topView.TopFLayoutView());
         }
-       
+
 
         /// <summary>
         /// 閲嶆柊璁$畻瀹藉害(璁惧鍚嶇О,鎴块棿鎺т欢)
@@ -650,7 +683,7 @@
             TextID = StringId.dangqianmenweiguan,
             TextSize = TextSize.Text14,
             TextColor = MusicColor.TextColor,
-            SelectedTextColor= MusicColor.MusicTxet14SelectedColor,
+            SelectedTextColor = MusicColor.MusicTxet14SelectedColor,
             TextAlignment = TextAlignment.Center,
             Gravity = Gravity.CenterHorizontal,
             Name = "btnText",
@@ -724,7 +757,7 @@
             this.BackgroundColor = 0xffECEDEE;
             this.SelectedBackgroundColor = 0xFFF2F3F7;
             this.Radius = (uint)Application.GetRealHeight(19);
-            this.Padding = new Padding(0,0,0,0);
+            this.Padding = new Padding(0, 0, 0, 0);
         }
 
 
@@ -817,8 +850,8 @@
             TextColor = MusicColor.TextColor,
             SelectedTextColor = MusicColor.MusicTxet14SelectedColor,
             TextSize = TextSize.Text16,
-            TextID =StringId.xinhaoyuan,
-            Padding=new Padding(0,0,0,0),
+            TextID = StringId.xinhaoyuan,
+            Padding = new Padding(0, 0, 0, 0),
             IsBold = true,
         };
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /Send.cs b/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /Send.cs
index 525e5e4..5cfa50d 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /Send.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /Send.cs
@@ -73,6 +73,56 @@
         }
 
         /// <summary>
+        /// 鍒锋柊璁惧鐘舵��
+        /// </summary>
+        /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param>
+        /// <returns></returns>
+        public bool RefreshDeviceStatus(List<string> functionIds, TipType tipType = TipType.flicker)
+        {
+            try
+            {
+                Dictionary<string, object> d = new Dictionary<string, object>();
+                d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+                d.Add("deviceIds", functionIds);
+                var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_RefreshDeviceStatus, "鍒锋柊璁惧鐘舵��");
+                if (!this.DataChecking(responsePackNew, tipType))
+                {
+                    return false;
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇璁惧璇︽儏
+        /// </summary>
+        /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param>
+        /// <returns></returns>
+        public Function GetDeviceInfo(string functionId, TipType tipType = TipType.flicker)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceIds", new List<string>() { functionId });
+
+            var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_GetDevcieInfoList, "鑾峰彇璁惧璇︽儏");
+            if (!this.DataChecking(responsePackNew, tipType))
+            {
+                return null;
+            }
+            var functionList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Function>>(responsePackNew.Data.ToString());
+            if (functionList != null && functionList.Count > 0)
+            {
+                return functionList[0];
+            }
+            return null;
+
+        }
+
+        /// <summary>
         ///鍒犻櫎璁惧
         /// </summary>
         /// <param name="deviceId">璁惧id</param>

--
Gitblit v1.8.0