From 1ebda09d954de4409c5a7f3ba3c3ee75626ec7c0 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期四, 01 四月 2021 16:08:16 +0800
Subject: [PATCH] 2021-4-1-6

---
 HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs
index 65a710e..300b194 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using HDL_ON.DriverLayer;
 using HDL_ON.Entity;
 using Shared;
 
@@ -9,7 +10,7 @@
         /// <summary>
         /// 鏇存柊鐏厜鐘舵��
         /// </summary>
-        public static void UpdataState(SwitchSocket uFan)
+        public static void UpdataState(Function uFan)
         {
             Application.RunOnMainThread(() =>
             {
@@ -17,7 +18,7 @@
                 {
                     if (bodyView == null)
                         return;
-                    bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = uFan.on_off == "on";
+                    bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = uFan.trait_on_off.curValue.ToString() == "on";
                 }
                 catch (Exception ex)
                 {
@@ -35,8 +36,9 @@
 
             //鍥為��鍒锋柊淇℃伅浜嬩欢
             actionRefresh = () => {
-                btnFunctionName.Text = btnFunctionName_Out.Text = socketFunction.name;
-                btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = socketFunction.GetRoomListName();
+                btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
+                btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
+                function.UpdataFuncitonInfo();
             };
         }
 
@@ -46,8 +48,8 @@
         void LoadCollectionEvent()
         {
             btnCollection.MouseUpEventHandler += (sender, e) => {
-                btnCollection.IsSelected = socketFunction.collection = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                DB_ResidenceData.residenceData.SaveResidenceData();
+                btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
+                function.CollectFunction();
             };
         }
 
@@ -58,29 +60,29 @@
         {
             btnSwitchIcon.MouseUpEventHandler += (sender, e) =>
             {
-                btnSwitchIcon.IsSelected = !btnSwitchIcon.IsSelected;
+                btnSwitchIcon.IsSelected = btnSwitch.IsSelected = !btnSwitchIcon.IsSelected;
 
                 new System.Threading.Thread(() =>
                 {
-                    socketFunction.on_off = btnSwitch.IsSelected ? "on" : "off";
-                    //Control.Send(CommandType_A.write, this.socketFunction);
+                    function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
+                    //Control.Send(CommandType_A.write, this.function);
                     System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                    d.Add("on_off", socketFunction.on_off.ToString());
-                    Control.SendWriteCommand(socketFunction, d);
+                    d.Add("on_off", function.trait_on_off.curValue.ToString());
+                    Control.Ins.SendWriteCommand(function, d);
                 })
                 { IsBackground = true }.Start();
             };
             btnSwitch.MouseUpEventHandler += (sender, e) =>
             {
-                btnSwitch.IsSelected = !btnSwitch.IsSelected;
+                btnSwitch.IsSelected = btnSwitchIcon.IsSelected = !btnSwitch.IsSelected;
 
                 new System.Threading.Thread(() =>
                 {
-                    socketFunction.on_off = btnSwitch.IsSelected ? "on" : "off";
-                    //Control.Send(CommandType_A.write, this.socketFunction);
+                    function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
+                    //Control.Send(CommandType_A.write, this.function);
                     System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                    d.Add("on_off", socketFunction.on_off.ToString());
-                    Control.SendWriteCommand(socketFunction, d);
+                    d.Add("on_off", function.trait_on_off.curValue.ToString());
+                    Control.Ins.SendWriteCommand(function, d);
                 })
                 { IsBackground = true }.Start();
             };

--
Gitblit v1.8.0