From 44538302375e489af520e320de908d8cfcf43691 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 21 二月 2022 13:49:32 +0800
Subject: [PATCH] HomeKit对接说明

---
 HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage_InstantaneousValue.cs |   62 ++++++++++++++++---------------
 1 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage_InstantaneousValue.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage_InstantaneousValue.cs
index 4abdef4..46c8fa3 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage_InstantaneousValue.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage_InstantaneousValue.cs
@@ -97,45 +97,47 @@
 
         public static void UpdataView(Function updata)
         {
-            if(bodyView!=null)
+            if (bodyView != null)
             {
-                for (int i = 0; i < bodyView.instantaneousValueView.ChildrenCount; i++)
+                Application.RunOnMainThread(() =>
                 {
-                    var view = bodyView.instantaneousValueView.GetChildren(i);
-                    if(null != view.Tag )
+                    for (int i = 0; i < bodyView.instantaneousValueView.ChildrenCount; i++)
                     {
-                        if (view.GetType() == typeof(InstantaneousValueView))
+                        var view = bodyView.instantaneousValueView.GetChildren(i);
+                        if (null != view.Tag)
                         {
-                           var view2 = view as InstantaneousValueView;
-                            switch (view.Tag.ToString())
+                            if (view.GetType() == typeof(InstantaneousValueView))
                             {
-                                case "active_power":
-                                    var attr = updata.GetAttribute("active_power");
-                                    if (attr != null)
-                                    {
-                                        view2.btnValue.Text = attr.curValue.ToString();
-                                    }
-                                    break;
-                                case "voltage":
-                                    var attr1 = updata.GetAttribute("voltage");
-                                    if (attr1 != null)
-                                    {
-                                        view2.btnValue.Text = attr1.curValue.ToString();
-                                    }
-                                    break;
-                                case "current":
-                                    var attr2 = updata.GetAttribute("current");
-                                    if (attr2 != null)
-                                    {
-                                        view2.btnValue.Text = attr2.curValue.ToString();
-                                    }
-                                    break;
+                                var view2 = view as InstantaneousValueView;
+                                switch (view.Tag.ToString())
+                                {
+                                    case "active_power":
+                                        var attr = updata.GetAttribute("active_power");
+                                        if (attr != null)
+                                        {
+                                            view2.btnValue.Text = attr.curValue.ToString();
+                                        }
+                                        break;
+                                    case "voltage":
+                                        var attr1 = updata.GetAttribute("voltage");
+                                        if (attr1 != null)
+                                        {
+                                            view2.btnValue.Text = attr1.curValue.ToString();
+                                        }
+                                        break;
+                                    case "current":
+                                        var attr2 = updata.GetAttribute("current");
+                                        if (attr2 != null)
+                                        {
+                                            view2.btnValue.Text = attr2.curValue.ToString();
+                                        }
+                                        break;
+                                }
                             }
                         }
                     }
-                }
+                });
             }
-
         }
     }
 

--
Gitblit v1.8.0