From 23bbed132eea46eef51c6d01c21b346238e29ee2 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 30 六月 2022 13:39:12 +0800
Subject: [PATCH] Merge branch 'wxr0114' into V1.5.9

---
 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs |  233 +++++++++++++++++++++++++++------------------------------
 1 files changed, 111 insertions(+), 122 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs
index 7f04f4e..e1dd248 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs
@@ -145,7 +145,7 @@
                 {
                     continue;
                 }
-                if (!string.IsNullOrEmpty(roomId) && roomId != "ALLSELECT")
+                if (!string.IsNullOrEmpty(roomId) && roomId == "ALLSELECT")
                 {
                     if (!function.roomIds.Contains(roomId))
                     {
@@ -172,7 +172,7 @@
                 {
                     continue;
                 }
-                if (!string.IsNullOrEmpty(roomId) && roomId != "ALLSELECT")
+                if (!string.IsNullOrEmpty(roomId))
                 {
                     if (!scene.roomIds.Contains(roomId))
                     {
@@ -202,131 +202,121 @@
         void LoadFunctionListRow()
         {
             functionListView.RemoveAll();
-            new System.Threading.Thread(() =>
+            foreach (var function in allocatedList)
             {
-                System.Threading.Thread.Sleep(50);
-                Application.RunOnMainThread(() =>
+                //var output = alarm.output.Find((obj) => obj.sid == function.sid);
+                //if (output == null)
+                //{
+                //    output = new SecurityOutput();
+                //    output.sid = function.sid;
+                //}
+
+                FrameLayout functionRow = new FrameLayout()
                 {
+                    Height = Application.GetRealHeight(65),
+                    BackgroundColor = CSS_Color.MainBackgroundColor,
+                };
+                functionListView.AddChidren(functionRow);
 
-                    foreach (var function in allocatedList)
+                var btnFunctionName = new Button()
+                {
+                    X = Application.GetRealWidth(16),
+                    Width = Application.GetRealWidth(200),
+                    Height = Application.GetRealHeight(44),
+                    Text = function.name,
+                    TextAlignment = TextAlignment.CenterLeft,
+                    TextColor = CSS_Color.FirstLevelTitleColor,
+                    TextSize = CSS_FontSize.TextFontSize,
+                };
+                functionRow.AddChidren(btnFunctionName);
+
+                var btnFunctionFloorName = new Button()
+                {
+                    X = Application.GetRealWidth(16),
+                    Y = Application.GetRealHeight(24),
+                    Width = Application.GetRealWidth(200),
+                    Height = Application.GetRealHeight(41),
+                    Text = function.RoomName,
+                    TextAlignment = TextAlignment.CenterLeft,
+                    TextColor = CSS_Color.PromptingColor1,
+                    TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
+                };
+                functionRow.AddChidren(btnFunctionFloorName);
+
+                Button btnState = new Button()
+                {
+                    Width = Application.GetRealWidth(317),
+                    TextAlignment = TextAlignment.CenterRight,
+                    TextSize = CSS_FontSize.TextFontSize,
+                    TextColor = CSS_Color.PromptingColor1,
+                    Text = function.StateText()
+                };
+                functionRow.AddChidren(btnState);
+
+                Button btnChooseIcon = new Button()
+                {
+                    X = Application.GetRealWidth(333),
+                    Gravity = Gravity.CenterVertical,
+                    Width = Application.GetMinRealAverage(32),
+                    Height = Application.GetMinRealAverage(32),
+                    UnSelectedImagePath = "Public/ChooseIcon.png",
+                    SelectedImagePath = "Public/ChooseOnIcon.png",
+                };
+                functionRow.AddChidren(btnChooseIcon);
+
+                btnChooseIcon.MouseUpEventHandler = (sender, e) => {
+                    btnChooseIcon.IsSelected = !btnChooseIcon.IsSelected;
+                    var tempLocal = alarm.output.Find((obj) =>
+                        obj.sid == function.sid
+                    );
+                    //if (tempLocal == null && !string.IsNullOrEmpty(output.spk))
+                    //{
+                    //    ShowStateDialog(output, btnState, btnChooseIcon);
+                    //}
+                    if (btnChooseIcon.IsSelected)
                     {
-                        //var output = alarm.output.Find((obj) => obj.sid == function.sid);
-                        //if (output == null)
-                        //{
-                        //    output = new SecurityOutput();
-                        //    output.sid = function.sid;
-                        //}
-
-                        FrameLayout functionRow = new FrameLayout()
-                        {
-                            Height = Application.GetRealHeight(65),
-                            BackgroundColor = CSS_Color.MainBackgroundColor,
-                        };
-                        functionListView.AddChidren(functionRow);
-
-                        var btnFunctionName = new Button()
-                        {
-                            X = Application.GetRealWidth(16),
-                            Width = Application.GetRealWidth(200),
-                            Height = Application.GetRealHeight(44),
-                            Text = function.name,
-                            TextAlignment = TextAlignment.CenterLeft,
-                            TextColor = CSS_Color.FirstLevelTitleColor,
-                            TextSize = CSS_FontSize.TextFontSize,
-                        };
-                        functionRow.AddChidren(btnFunctionName);
-
-                        var btnFunctionFloorName = new Button()
-                        {
-                            X = Application.GetRealWidth(16),
-                            Y = Application.GetRealHeight(24),
-                            Width = Application.GetRealWidth(200),
-                            Height = Application.GetRealHeight(41),
-                            Text = function.RoomName,
-                            TextAlignment = TextAlignment.CenterLeft,
-                            TextColor = CSS_Color.PromptingColor1,
-                            TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
-                        };
-                        functionRow.AddChidren(btnFunctionFloorName);
-
-                        Button btnState = new Button()
-                        {
-                            Width = Application.GetRealWidth(317),
-                            TextAlignment = TextAlignment.CenterRight,
-                            TextSize = CSS_FontSize.TextFontSize,
-                            TextColor = CSS_Color.PromptingColor1,
-                            Text = function.StateText()
-                        };
-                        functionRow.AddChidren(btnState);
-
-                        Button btnChooseIcon = new Button()
-                        {
-                            X = Application.GetRealWidth(333),
-                            Gravity = Gravity.CenterVertical,
-                            Width = Application.GetMinRealAverage(32),
-                            Height = Application.GetMinRealAverage(32),
-                            UnSelectedImagePath = "Public/ChooseIcon.png",
-                            SelectedImagePath = "Public/ChooseOnIcon.png",
-                        };
-                        functionRow.AddChidren(btnChooseIcon);
-
-                        btnChooseIcon.MouseUpEventHandler = (sender, e) =>
-                        {
-                            btnChooseIcon.IsSelected = !btnChooseIcon.IsSelected;
-                            var tempLocal = alarm.output.Find((obj) =>
-                                obj.sid == function.sid
-                            );
-                            //if (tempLocal == null && !string.IsNullOrEmpty(output.spk))
-                            //{
-                            //    ShowStateDialog(output, btnState, btnChooseIcon);
-                            //}
-                            if (btnChooseIcon.IsSelected)
-                            {
-                                if (tempLocal == null)
-                                    alarm.output.Add(function);
-                                ShowStateDialog(function, btnState, btnChooseIcon);
-                            }
-                            else
-                            {
-                                if (tempLocal != null)
-                                {
-                                    alarm.output.Remove(function);
-                                }
-                            }
-                        };
-                        btnState.MouseUpEventHandler = (sender, e) =>
-                        {
-                            btnChooseIcon.IsSelected = true;
-                            var tempLocal = alarm.output.Find((obj) =>
-                                obj.sid == function.sid
-                            );
-                            if (tempLocal == null)
-                                alarm.output.Add(function);
-                            ShowStateDialog(function, btnState, btnChooseIcon);
-                        };
-
-                        var localOutput = alarm.output.Find((obj) => obj.sid == function.sid);
-
-                        if (localOutput != null)
-                        {
-                            btnChooseIcon.IsSelected = true;
-                            btnState.Text = function.StateText();
-                        }
-
-
-                        functionListView.AddChidren(new Button()
-                        {
-                            Gravity = Gravity.CenterHorizontal,
-                            Width = Application.GetRealWidth(343),
-                            Height = Application.GetRealWidth(1),
-                            BackgroundColor = CSS_Color.DividingLineColor,
-                        });
-
-
+                        if (tempLocal == null)
+                            alarm.output.Add(function);
+                        ShowStateDialog(function, btnState, btnChooseIcon);
                     }
+                    else
+                    {
+                        if (tempLocal != null)
+                        {
+                            alarm.output.Remove(function);
+                        }
+                    }
+                };
+                btnState.MouseUpEventHandler = (sender, e) =>
+                {
+                    btnChooseIcon.IsSelected = true;
+                    var tempLocal = alarm.output.Find((obj) =>
+                        obj.sid == function.sid
+                    );
+                    if (tempLocal == null)
+                        alarm.output.Add(function);
+                    ShowStateDialog(function, btnState, btnChooseIcon);
+                };
 
+                var localOutput = alarm.output.Find((obj) => obj.sid == function.sid);
+
+                if (localOutput != null)
+                {
+                    btnChooseIcon.IsSelected = true;
+                    btnState.Text = function.StateText();
+                }
+
+
+                functionListView.AddChidren(new Button()
+                {
+                    Gravity = Gravity.CenterHorizontal,
+                    Width = Application.GetRealWidth(343),
+                    Height = Application.GetRealWidth(1),
+                    BackgroundColor = CSS_Color.DividingLineColor,
                 });
-            }).Start();
+
+
+            }
         }
 
 
@@ -481,8 +471,7 @@
                 var form = new FloorRoomSelectPopupView();
                 form.ShowDeviceFunctionView(btnFloor, listAllFun, (selectId, listFun) =>
                 {
-                    var selecteRoom = SpatialInfo.CurrentSpatial.RoomList.Find((obj) => obj.uid == selectId);
-                    SetData(selecteRoom.roomId);
+                    SetData(selectId);
                     //閲嶆柊鍒锋柊璁惧鍒楄〃
                     this.LoadFunctionListRow();
                 }, nowSelectId);

--
Gitblit v1.8.0