From cbc156bc38d8b8eae7aef60cb186ab2b52fa701f Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期二, 16 七月 2024 13:59:56 +0800
Subject: [PATCH] 增加全部挂断

---
 HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs |   73 +++++++++++++++++++++++++++++++++++-
 1 files changed, 70 insertions(+), 3 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs
index 1e56bf0..c126685 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs
@@ -1,5 +1,7 @@
 锘縰sing System;
 using System.Collections.Generic;
+using HDL_ON.Common;
+using HDL_ON.DAL.Server;
 using Shared;
 
 namespace HDL_ON.UI
@@ -58,9 +60,44 @@
                         }
                     }
                 }
+                var waitPage = new Loading();
+                bodyView.AddChidren(waitPage);
+                new System.Threading.Thread(async() =>
+                {
+                    //function.UpdataRoomIds();
+                    var pack = ApiUtlis.Ins.HttpRequest.UpdataDevcieBindRoomInfo(function);
+                    //鐩存帴淇濆瓨鏈湴锛�
+                    function.SaveFunctionFile();
+                    if (pack.Code == StateCode.SUCCESS)
+                    {
+                        if (UI.RoomPage.bodyView != null)
+                        {
+                            Application.RunOnMainThread(() =>
+                            {
+                                UI.RoomPage.bodyView.ReLoadPage();
+                            });
+                        }
+                        Entity.SpatialInfo.CurrentSpatial.InitRoomListFunctions();
+                        try
+                        {
+                            //鍒濆鍖栦綇瀹呮墍鏈夋埧闂村姛鑳芥暟鎹�
+                            foreach (var r in Entity.SpatialInfo.CurrentSpatial.RoomList)
+                            {
+                                Entity.SpatialInfo.CurrentSpatial.InitRoomFuntion(r);
+                            }
+                        }
+                        catch (Exception ex)
+                        {
+                            MainPage.Log($"Init room function error : {ex.Message}");
+                        }
+                    }
+                    else
+                    {
+                        IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+                    }
 
-                function.UpdataRoomIds();
-                Entity.SpatialInfo.CurrentSpatial.InitRoomListFunctions();
+                })
+                { IsBackground = true }.Start();
             };
         }
 
@@ -79,7 +116,37 @@
                 function.roomIds.Remove(room.roomId);
                 //room.RemoveRoomFunction(function);
             }
-            function.UpdataRoomIds();
+            //function.UpdataRoomIds();
+
+            new System.Threading.Thread(() =>
+            {
+                try
+                {
+                    var pack = ApiUtlis.Ins.HttpRequest.UpdataDevcieBindRoomInfo(function);
+                    //鐩存帴淇濆瓨鏈湴锛�
+                    function.SaveFunctionFile();
+                    if (pack.Code == StateCode.SUCCESS)
+                    {
+                        if (UI.RoomPage.bodyView != null)
+                        {
+                            Application.RunOnMainThread(() =>
+                            {
+                                UI.RoomPage.bodyView.ReLoadPage();
+                            });
+                        }
+                    }
+                    else
+                    {
+                        IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+                    }
+                }
+                catch (Exception ex){
+                    MainPage.Log("鎴块棿缁戝畾璁惧寮傚父" + ex.Message);
+                }
+            })
+            { IsBackground = true }.Start();
+
+
             if (function.roomIds.Count == Entity.SpatialInfo.CurrentSpatial.RoomList.Count)
             {
                 btnChooseAll.IsSelected = true;

--
Gitblit v1.8.0