From 6a9ad7ec93218913a2ce3b898bb036f18f8f0da4 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 13 八月 2020 17:06:36 +0800
Subject: [PATCH] 20200813

---
 HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs |   37 ++++++++++++++++++++++++++++++++-----
 1 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
index e46e185..dca61b1 100644
--- a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
+++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
@@ -59,6 +59,7 @@
                                                             switch (functionType)
                                                             {
                                                                 case FunctionType.FloorHeating:
+                                                                    btnText = DB_ResidenceData.residenceData.functionList.floorHeatings.FindAll((obj) => obj.on_off == "on").Count + "/" + DB_ResidenceData.residenceData.functionList.floorHeatings.Count;
                                                                     break;
                                                                 case FunctionType.AC:
                                                                     btnText = DB_ResidenceData.residenceData.functionList.aCs.FindAll((obj) => obj.on_off == "on").Count + "/" + DB_ResidenceData.residenceData.functionList.aCs.Count;
@@ -70,6 +71,9 @@
                                                             break;
                                                         case FunctionCategory.Light:
                                                             btnText = DB_ResidenceData.residenceData.functionList.lights.FindAll((obj) => obj.on_off == "on").Count + "/" + DB_ResidenceData.residenceData.functionList.lights.Count;
+                                                            break;
+                                                        case FunctionCategory.Electrical:
+                                                            btnText = DB_ResidenceData.residenceData.functionList.electricals.FindAll((obj) => obj.on_off == "on").Count + "/" + DB_ResidenceData.residenceData.functionList.electricals.Count;
                                                             break;
                                                     }
                                                     btn.Text = btnText;
@@ -115,7 +119,15 @@
                                 {
                                     foreach (var rId in function.roomIdList)
                                     {
+                                        if(rId == null)
+                                        {
+                                            continue;
+                                        }
                                         var r = DB_ResidenceData.residenceData.rooms.Find(s => s.sid == rId);
+                                        if(r == null)
+                                        {
+                                            continue;
+                                        }
                                         var ssd = r.functions.FindAll((obj) => obj.on_off == "on" && obj.functionCategory != FunctionCategory.Scene);
                                         var sss = ssd.Count;
                                         if (sss == 0)
@@ -149,7 +161,10 @@
                                 continue;
                             }
                             f.on_off = "off";
-                            Control.Send(CommandType_A.write, f);
+                            //Control.Send(CommandType_A.write, f);
+                            System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                            d.Add("on_off", f.on_off.ToString());
+                            Control.SendWriteCommand(f, d);
                         }
                         btn.Visible = false;
                     };
@@ -250,7 +265,10 @@
                         foreach(var f in DB_ResidenceData.residenceData.functionList.aCs)
                         {
                             f.on_off = btn.IsSelected ? "on" : "off";
-                            Control.Send(CommandType_A.write, f);
+                            //Control.Send(CommandType_A.write, f);
+                            System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                            d.Add("on_off", f.on_off.ToString());
+                            Control.SendWriteCommand(f, d);
                         }
                         break;
                     case ShowFunction.Curtain:
@@ -260,7 +278,10 @@
                         foreach (var f in DB_ResidenceData.residenceData.functionList.lights)
                         {
                             f.on_off = btn.IsSelected ? "on" : "off";
-                            Control.Send(CommandType_A.write, f);
+                            //Control.Send(CommandType_A.write, f);
+                            System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                            d.Add("on_off", f.on_off.ToString());
+                            Control.SendWriteCommand(f, d);
                         }
                         break;
                 }
@@ -285,7 +306,10 @@
                 foreach (var f in DB_ResidenceData.residenceData.functionList.curtains)
                 {
                     f.on_off = "on";
-                    Control.Send(CommandType_A.write, f);
+                    //Control.Send(CommandType_A.write, f);
+                    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                    d.Add("on_off", f.on_off.ToString());
+                    Control.SendWriteCommand(f, d);
                 }
             };
 
@@ -300,7 +324,10 @@
                 foreach (var f in DB_ResidenceData.residenceData.functionList.curtains)
                 {
                     f.on_off =  "off";
-                    Control.Send(CommandType_A.write, f);
+                    //Control.Send(CommandType_A.write, f);
+                    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                    d.Add("on_off", f.on_off.ToString());
+                    Control.SendWriteCommand(f, d);
                 }
             };
 

--
Gitblit v1.8.0