From 01b8b5bde8a58060bdd03b78a32747c5aa551976 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 01 十二月 2021 09:32:54 +0800
Subject: [PATCH] 111

---
 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs |  811 ++++++++++++++++++++++++++++++---------------------------
 1 files changed, 427 insertions(+), 384 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs
index 8501b16..4ff5844 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs
@@ -7,363 +7,402 @@
 
 namespace HDL_ON.UI
 {
-  public class AddOutputPage : FrameLayout
-  {
-    FrameLayout bodyView;
-
-    FrameLayout showdFunctionTypeRow;
-
-    /// <summary>
-    /// 妤煎眰閫夋嫨涓嬫媺鍥炬爣
-    /// </summary>
-    Button btnFloorDownIcon;
-    /// <summary>
-    /// 妤煎眰鏄剧ず
-    /// </summary>
-    Button btnFloor;
-
-    /// <summary>
-    /// 绛涢�夋枃鏈樉绀�
-    /// </summary>
-    Button btnScreenText;
-
-    VerticalScrolViewLayout functionListView;
-
-    SecurityAlarm securityAlarm;
-    Action<SecurityAlarm> refreshAction;
-    List<SecurityOutput> outputList = new List<SecurityOutput>();
-
-    List<Function> allocatedList = new List<Function>();
-
-    public AddOutputPage(SecurityAlarm function, Action<SecurityAlarm> action)
+    public class AddOutputPage : FrameLayout
     {
-      bodyView = this;
-      securityAlarm = function;
-      refreshAction = action;
-    }
+        FrameLayout bodyView;
 
+        FrameLayout showdFunctionTypeRow;
 
-    /// <summary>
-    /// 鍔犺浇鐣岄潰
-    /// </summary>
-    public void LoadPage()
-    {
-      bodyView.BackgroundColor = CSS_Color.BackgroundColor;
-      new TopViewDiv(bodyView, Language.StringByID(StringId.AddFunction)).LoadTopView();
+        /// <summary>
+        /// 妤煎眰閫夋嫨涓嬫媺鍥炬爣
+        /// </summary>
+        Button btnFloorDownIcon;
+        /// <summary>
+        /// 妤煎眰鏄剧ず
+        /// </summary>
+        Button btnFloor;
 
-      #region 鏄剧ず鐨勫姛鑳界被鍨嬪垏鎹㈠尯鍩�
-      showdFunctionTypeRow = new FrameLayout()
-      {
-        Y = Application.GetRealHeight(64),
-        Height = Application.GetRealHeight(62),
-        BackgroundColor = CSS_Color.MainBackgroundColor,
-      };
-      bodyView.AddChidren(showdFunctionTypeRow);
+        /// <summary>
+        /// 绛涢�夋枃鏈樉绀�
+        /// </summary>
+        Button btnScreenText;
 
+        VerticalScrolViewLayout functionListView;
 
-      btnFloorDownIcon = new Button()
-      {
-        Width = Application.GetMinRealAverage(16),
-        Height = Application.GetMinRealAverage(16),
-        X = Application.GetRealWidth(16),
-        Y = Application.GetRealHeight(18),
-        UnSelectedImagePath = "Public/DownIcon.png",
-      };
-      showdFunctionTypeRow.AddChidren(btnFloorDownIcon);
+        Action<SecurityAlarm> refreshAction;
+        /// <summary>
+        /// 鏈湴鍔熻兘杞崲鐨勮緭鍑哄垪琛紙鐏厜銆佸満鏅級
+        /// </summary>
+        List<SecurityOutput> allocatedList = new List<SecurityOutput>();
 
-      btnFloor = new Button()
-      {
-        X = btnFloorDownIcon.Right,
-        Y = Application.GetRealHeight(18),
-        Width = Application.GetRealWidth(200),
-        Height = Application.GetMinRealAverage(16),
-        TextColor = CSS_Color.FirstLevelTitleColor,
-        TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-        TextAlignment = TextAlignment.CenterLeft,
-        Text = DB_ResidenceData.Instance.CurFloor.roomName,
-      };
-      showdFunctionTypeRow.AddChidren(btnFloor);
+        SecurityAlarm alarm;
 
-      #endregion
-
-      functionListView = new VerticalScrolViewLayout()
-      {
-        Y = showdFunctionTypeRow.Bottom,
-        Height = Application.GetRealHeight(530 - 100),
-        BackgroundColor = CSS_Color.BackgroundColor,
-      };
-      bodyView.AddChidren(functionListView);
-
-
-
-
-
-
-      foreach (var function in FunctionList.List.Functions)
-      {
-        if (!MainPage.SceneSupportFunctionList.Contains(function.spk))
+        public AddOutputPage(SecurityAlarm inOutput, Action<SecurityAlarm> action)
         {
-          continue;
+            bodyView = this;
+            refreshAction = action;
+            alarm = inOutput;
         }
-        if (function == null)
+
+
+        /// <summary>
+        /// 鍔犺浇鐣岄潰
+        /// </summary>
+        public void LoadPage()
         {
-          continue;
-        }
-        function.roomIds.Remove(null);
-        allocatedList.Add(function);
-      }
+            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
+            new TopViewDiv(bodyView, Language.StringByID(StringId.AddFunction)).LoadTopView();
 
-      LoadFunctionListRow(null);
-
-
-
-
-
-
-
-      var bottomView = new FrameLayout()
-      {
-        Y = Application.GetRealHeight(591),
-        Height = Application.GetRealHeight(100),
-        BackgroundColor = CSS_Color.MainBackgroundColor,
-        Radius = (uint)Application.GetRealWidth(22),
-      };
-      this.AddChidren(bottomView);
-
-      var btnConfrim = new Button()
-      {
-        X = Application.GetRealWidth(78),
-        Y = Application.GetRealHeight(12),
-        Width = Application.GetRealWidth(220),
-        Height = Application.GetRealWidth(44),
-        Radius = (uint)Application.GetRealWidth(22),
-        BackgroundColor = CSS_Color.MainColor,
-        TextID = StringId.Confirm,
-        TextSize = CSS_FontSize.SubheadingFontSize,
-        TextColor = CSS_Color.MainBackgroundColor,
-        TextAlignment = TextAlignment.Center,
-      };
-      bottomView.AddChidren(btnConfrim);
-      btnConfrim.MouseUpEventHandler = (sender, e) =>
-      {
-        securityAlarm.output = new List<SecurityOutput>();
-        foreach (var output in outputList)
-        {
-          if (output.addCondition)
-          {
-            securityAlarm.output.Add(output);
-          }
-        }
-        this.RemoveFromParent();
-        refreshAction?.Invoke(securityAlarm);
-      };
-
-
-
-
-
-
-    }
-
-
-
-
-    // <summary>
-    /// 鏄剧ず鍔熻兘Row
-    /// </summary>
-    void LoadFunctionListRow(List<Function> functions)
-    {
-      functionListView.RemoveAll();
-      if (functions == null)
-      {
-        functions = allocatedList;
-      }
-      foreach (var function in functions)
-      {
-        var output = securityAlarm.output.Find((obj) => obj.sid == function.sid);
-        if (output == null)
-        {
-          output = new SecurityOutput();
-          output.sid = function.sid;
-        }
-        else
-        {
-          output.addCondition = true;
-        }
-        outputList.Add(output);
-
-        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.GetRoomListName(),
-          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,
-        };
-        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;
-          if (btnChooseIcon.IsSelected)
-          {
-            output.addCondition = true;
-            if (output.status.Count == 0)
+            #region 鏄剧ず鐨勫姛鑳界被鍨嬪垏鎹㈠尯鍩�
+            showdFunctionTypeRow = new FrameLayout()
             {
-              ShowStateDialog(output, btnState, btnChooseIcon);
+                Y = Application.GetRealHeight(64),
+                Height = Application.GetRealHeight(62),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+            };
+            bodyView.AddChidren(showdFunctionTypeRow);
+
+
+            btnFloorDownIcon = new Button()
+            {
+                Width = Application.GetMinRealAverage(16),
+                Height = Application.GetMinRealAverage(16),
+                X = Application.GetRealWidth(16),
+                Y = Application.GetRealHeight(18),
+                UnSelectedImagePath = "Public/DownIcon.png",
+            };
+            showdFunctionTypeRow.AddChidren(btnFloorDownIcon);
+
+            btnFloor = new Button()
+            {
+                X = btnFloorDownIcon.Right,
+                Y = Application.GetRealHeight(18),
+                Width = Application.GetRealWidth(200),
+                Height = Application.GetMinRealAverage(16),
+                TextColor = CSS_Color.FirstLevelTitleColor,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                TextAlignment = TextAlignment.CenterLeft,
+                Text = DB_ResidenceData.Instance.CurFloor.roomName,
+            };
+            showdFunctionTypeRow.AddChidren(btnFloor);
+            LoadDialog_ChangeFloor();
+
+            #endregion
+
+            functionListView = new VerticalScrolViewLayout()
+            {
+                Y = showdFunctionTypeRow.Bottom,
+                Height = Application.GetRealHeight(530 - 100),
+                BackgroundColor = CSS_Color.BackgroundColor,
+            };
+            bodyView.AddChidren(functionListView);
+
+
+            SetData();
+
+            LoadFunctionListRow();
+
+            var bottomView = new FrameLayout()
+            {
+                Y = Application.GetRealHeight(591),
+                Height = Application.GetRealHeight(100),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+                Radius = (uint)Application.GetRealWidth(22),
+            };
+            this.AddChidren(bottomView);
+
+            var btnConfrim = new Button()
+            {
+                X = Application.GetRealWidth(78),
+                Y = Application.GetRealHeight(12),
+                Width = Application.GetRealWidth(220),
+                Height = Application.GetRealWidth(44),
+                Radius = (uint)Application.GetRealWidth(22),
+                BackgroundColor = CSS_Color.MainColor,
+                TextID = StringId.Confirm,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+                TextColor = CSS_Color.MainBackgroundColor,
+                TextAlignment = TextAlignment.Center,
+            };
+            bottomView.AddChidren(btnConfrim);
+            btnConfrim.MouseUpEventHandler = (sender, e) =>
+            {
+                this.RemoveFromParent();
+                refreshAction?.Invoke(alarm);
+            };
+
+        }
+
+        /// <summary>
+        /// 閰嶇疆鏁版嵁
+        /// </summary>
+        void SetData(string roomId = "")
+        {
+            allocatedList.Clear();
+            foreach (var function in FunctionList.List.GetLightList())
+            {
+                if (function == null)
+                {
+                    continue;
+                }
+                if (!string.IsNullOrEmpty(roomId) && roomId == "ALLSELECT")
+                {
+                    if (!function.roomIds.Contains(roomId))
+                    {
+                        continue;
+                    }
+                }
+                function.roomIds.Remove(null);
+                var tempStatus = new List<SecurityOutputStatus>();
+                tempStatus.Add(new SecurityOutputStatus() { key = FunctionAttributeKey.OnOff, value = "on" });
+                allocatedList.Add(new SecurityOutput
+                {
+                    target_type = "0",
+                    sid = function.sid,
+                    status = tempStatus,
+                    name = function.name,
+                    RoomName = function.GetRoomListName(),
+                });
             }
-          }
-          else
-          {
-            output.addCondition = false;
-          }
-        };
-        btnState.MouseUpEventHandler = (sender, e) =>
-        {
-          ShowStateDialog(output, btnState, btnChooseIcon);
-        };
 
 
-        if (output.addCondition)
-        {
-          btnChooseIcon.IsSelected = true;
-          btnState.Text = output.StateText();
+            foreach (var scene in FunctionList.List.scenes)
+            {
+                if (scene == null)
+                {
+                    continue;
+                }
+                if (!string.IsNullOrEmpty(roomId))
+                {
+                    if (!scene.roomIds.Contains(roomId))
+                    {
+                        continue;
+                    }
+                }
+                scene.roomIds.Remove(null);
+                var tempStatus = new List<SecurityOutputStatus>();
+                tempStatus.Add(new SecurityOutputStatus() { key = "value", value = "0" });
+                allocatedList.Add(new SecurityOutput
+                {
+                    target_type = "1",
+                    sid = scene.sid,
+                    status = tempStatus,
+                    name = scene.name,
+                    RoomName = scene.GetRoomListName(),
+                });
+            }
+
         }
 
 
-        functionListView.AddChidren(new Button()
+
+        // <summary>
+        /// 鏄剧ず鍔熻兘Row
+        /// </summary>
+        void LoadFunctionListRow()
         {
-          Gravity = Gravity.CenterHorizontal,
-          Width = Application.GetRealWidth(343),
-          Height = Application.GetRealWidth(1),
-          BackgroundColor = CSS_Color.DividingLineColor,
-        });
+            functionListView.RemoveAll();
+            foreach (var function in allocatedList)
+            {
+                var output = alarm.output.Find((obj) => obj.sid == function.sid);
+                if (output == null)
+                {
+                    output = new SecurityOutput()
+                    {
+                        status = new List<SecurityOutputStatus> { new SecurityOutputStatus {
+                         key = FunctionAttributeKey.OnOff,
+                         value = "on"
+                    } }
+                    };
+
+                    output.sid = function.sid;
+                }
+                //else
+                //{
+                //    output.addCondition = true;
+                //}
+
+                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,
+                };
+                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.input.Find((obj) =>
+                        obj.sid == output.sid
+                    );
+                    if (btnChooseIcon.IsSelected)
+                    {
+                        //input.addCondition = true;
+                        if (tempLocal == null)
+                            alarm.output.Add(output);
+                    }
+                    else
+                    {
+                        //input.addCondition = false;
+                        if (tempLocal != null)
+                        {
+                            alarm.output.Remove(output);
+                        }
+                    }
+                };
+                btnState.MouseUpEventHandler = (sender, e) =>
+                {
+                    ShowStateDialog(output, btnState, btnChooseIcon);
+                };
+
+                var localOutput = alarm.output.Find((obj) => obj.sid == output.sid);
+
+                if (localOutput != null)
+                {
+                    btnChooseIcon.IsSelected = true;
+                    btnState.Text = output.StateText();
+                }
 
 
+                functionListView.AddChidren(new Button()
+                {
+                    Gravity = Gravity.CenterHorizontal,
+                    Width = Application.GetRealWidth(343),
+                    Height = Application.GetRealWidth(1),
+                    BackgroundColor = CSS_Color.DividingLineColor,
+                });
 
-    private void ShowStateDialog(SecurityOutput output, Button btnState, Button btnChoose = null)
-    {
-      Dialog dialog = new Dialog();
 
-      FrameLayout contentView = new FrameLayout();
-      dialog.AddChidren(contentView);
-      contentView.MouseUpEventHandler = (sender, e) =>
-      {
-        dialog.Close();
-        if (output.status.Count == 0)
-        {
-          if (btnChoose != null)
-          {
-            btnChoose.IsSelected = false;
-          }
+            }
         }
-      };
-
-      VerticalScrolViewLayout optinView = new VerticalScrolViewLayout()
-      {
-        Gravity = Gravity.CenterHorizontal,
-        Y = Application.GetRealHeight(515),
-        Width = Application.GetRealWidth(343),
-        Height = Application.GetRealHeight(88),
-        Radius = (uint)Application.GetRealHeight(13),
-        BackgroundColor = CSS_Color.MainBackgroundColor,
-      };
-      contentView.AddChidren(optinView);
-
-      Button btnOpen = new Button()
-      {
-        Height = Application.GetRealHeight(44),
-        TextAlignment = TextAlignment.Center,
-        TextColor = CSS_Color.MainColor,
-        TextSize = CSS_FontSize.SubheadingFontSize,
-        TextID = StringId.On
-      };
-      optinView.AddChidren(btnOpen);
-
-      optinView.AddChidren(new Button()
-      {
-        Height = 1,
-        BackgroundColor = CSS_Color.DividingLineColor
-      });
-
-      Button btnClose = new Button()
-      {
-        Height = Application.GetRealHeight(44),
-        TextAlignment = TextAlignment.Center,
-        TextColor = CSS_Color.PromptingColor1,
-        TextID = StringId.OFF,
-        TextSize = CSS_FontSize.SubheadingFontSize,
-      };
-      optinView.AddChidren(btnClose);
 
 
-      Button btnCancel = new Button()
-      {
-        Gravity = Gravity.CenterHorizontal,
-        Y = optinView.Bottom + Application.GetRealHeight(8),
-        Width = Application.GetRealWidth(343),
-        Height = Application.GetRealHeight(44),
-        Radius = (uint)Application.GetRealHeight(13),
-        BackgroundColor = CSS_Color.MainBackgroundColor,
-        TextID = StringId.Cancel,
-        TextColor = CSS_Color.WarningColor,
-        IsBold = true,
-      };
-      contentView.AddChidren(btnCancel);
+        private void ShowStateDialog(SecurityOutput output, Button btnState, Button btnChoose = null)
+        {
+            Dialog dialog = new Dialog();
 
-      dialog.Show();
+            FrameLayout contentView = new FrameLayout();
+            dialog.AddChidren(contentView);
+            contentView.MouseUpEventHandler = (sender, e) =>
+            {
+                dialog.Close();
+                if (output.status.Count == 0)
+                {
+                    if (btnChoose != null)
+                    {
+                        btnChoose.IsSelected = false;
+                    }
+                }
+            };
 
-      btnOpen.MouseUpEventHandler = (sender, e) =>
-      {
-        btnState.Text = btnOpen.Text;
-        output.status = new List<SecurityOutputStatus>()
+            VerticalScrolViewLayout optinView = new VerticalScrolViewLayout()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Y = Application.GetRealHeight(515),
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealHeight(88),
+                Radius = (uint)Application.GetRealHeight(13),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+            };
+            contentView.AddChidren(optinView);
+
+            Button btnOpen = new Button()
+            {
+                Height = Application.GetRealHeight(44),
+                TextAlignment = TextAlignment.Center,
+                SelectedTextColor = CSS_Color.MainColor,
+                TextColor = CSS_Color.PromptingColor1,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+                TextID = StringId.On,
+            };
+            optinView.AddChidren(btnOpen);
+            optinView.AddChidren(new Button()
+            {
+                Height = 1,
+                BackgroundColor = CSS_Color.DividingLineColor
+            });
+
+            Button btnClose = new Button()
+            {
+                Height = Application.GetRealHeight(44),
+                TextAlignment = TextAlignment.Center,
+                SelectedTextColor = CSS_Color.MainColor,
+                TextColor = CSS_Color.PromptingColor1,
+                TextID = StringId.OFF,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+            };
+            optinView.AddChidren(btnClose);
+            if (output.status.Count > 0)
+            {
+                btnOpen.IsSelected = output.status[0].value.ToLower() == "on";
+                btnClose.IsSelected = !btnOpen.IsSelected;
+            }
+
+
+            Button btnCancel = new Button()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Y = optinView.Bottom + Application.GetRealHeight(8),
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealHeight(44),
+                Radius = (uint)Application.GetRealHeight(13),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+                TextID = StringId.Cancel,
+                TextColor = CSS_Color.WarningColor,
+                IsBold = true,
+            };
+            contentView.AddChidren(btnCancel);
+
+            dialog.Show();
+
+            btnOpen.MouseUpEventHandler = (sender, e) => {
+                btnState.Text = btnOpen.Text;
+                output.status = new List<SecurityOutputStatus>()
                 {
                     new SecurityOutputStatus()
                     {
@@ -371,73 +410,77 @@
                         value = "on",
                     }
                 };
-        output.addCondition = true;
-        if (btnChoose != null)
-        {
-          btnChoose.IsSelected = true;
-        }
-        dialog.Close();
-      };
+                var localInput = alarm.output.Find((obj) =>
+                   obj.sid == output.sid
+                );
+                if (localInput == null)
+                {
+                    btnChoose.IsSelected = true;
+                }
+                dialog.Close();
+            };
 
-      btnClose.MouseUpEventHandler = (sender, e) =>
-      {
-        btnState.Text = btnClose.Text;
-        output.status = new List<SecurityOutputStatus>()
-          {
+            btnClose.MouseUpEventHandler = (sender, e) =>
+            {
+                btnState.Text = btnClose.Text;
+                output.status = new List<SecurityOutputStatus>()
+                {
                     new SecurityOutputStatus()
                     {
                         key = FunctionAttributeKey.OnOff,
                         value = "off",
                     }
-          };
-        output.addCondition = true;
-        if (btnChoose != null)
-        {
-          btnChoose.IsSelected = true;
-        }
-        dialog.Close();
-      };
+                };
+                var localInput = alarm.output.Find((obj) =>
+                 obj.sid == output.sid
+                );
+                if (localInput == null)
+                {
+                    btnChoose.IsSelected = true;
+                }
+                dialog.Close();
+            };
 
-      btnCancel.MouseUpEventHandler = (sender, e) =>
-      {
-        dialog.Close();
-        if (output.status.Count == 0)
-        {
-          if (btnChoose != null)
-          {
-            btnChoose.IsSelected = false;
-          }
+            btnCancel.MouseUpEventHandler = (sender, e) =>
+            {
+                dialog.Close();
+                if (output.status.Count == 0)
+                {
+                    if (btnChoose != null)
+                    {
+                        btnChoose.IsSelected = false;
+                    }
+                }
+
+            };
+
         }
 
-      };
+
+
+
+        /// <summary>
+        /// 浣忓畢鍒楄〃鐐瑰嚮浜嬩欢
+        /// </summary>
+        void LoadDialog_ChangeFloor()
+        {
+            string nowSelectId = null;
+            btnFloor.MouseUpEventHandler = (sender, e) =>
+            {
+                var listAllFun = new List<Function>();
+                //listAllFun.AddRange(allocatedList);
+
+                //鏄剧ず涓嬫媺鐣岄潰
+                var form = new FloorRoomSelectPopupView();
+                form.ShowDeviceFunctionView(btnFloor, listAllFun, (selectId, listFun) =>
+                {
+                    SetData(selectId);
+                    //閲嶆柊鍒锋柊璁惧鍒楄〃
+                    this.LoadFunctionListRow();
+                }, nowSelectId);
+            };
+        }
+
 
     }
-
-
-
-
-    /// <summary>
-    /// 浣忓畢鍒楄〃鐐瑰嚮浜嬩欢
-    /// </summary>
-    void LoadDialog_ChangeFloor()
-    {
-      string nowSelectId = null;
-      btnFloor.MouseUpEventHandler += (sender, e) =>
-      {
-        var listAllFun = new List<Function>();
-        listAllFun.AddRange(allocatedList);
-
-              //鏄剧ず涓嬫媺鐣岄潰
-              var form = new FloorRoomSelectPopupView();
-        form.ShowDeviceFunctionView(btnFloor, listAllFun, (selectId, listFun) =>
-              {
-            nowSelectId = selectId;
-                  //閲嶆柊鍒锋柊璁惧鍒楄〃
-                  this.LoadFunctionListRow(listFun);
-          }, nowSelectId);
-      };
-    }
-
-
-  }
 }

--
Gitblit v1.8.0