From e1a8f2f7e4d850beedeb1469610b878c1427e976 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 15 十二月 2021 09:01:53 +0800
Subject: [PATCH] 更新
---
HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs | 202 ++++++++++++++++++++++++++++++--------------------
1 files changed, 122 insertions(+), 80 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs
index 9aac9de..4f7abb9 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs
@@ -29,17 +29,19 @@
VerticalScrolViewLayout functionListView;
- SecurityAlarm securityAlarm;
Action<SecurityAlarm> refreshAction;
- List<SecurityOutput> outputList = new List<SecurityOutput>();
+ /// <summary>
+ /// 鏈湴鍔熻兘杞崲鐨勮緭鍑哄垪琛紙鐏厜銆佸満鏅級
+ /// </summary>
+ List<SecurityOutput> allocatedList = new List<SecurityOutput>();
- List<Function> allocatedList = new List<Function>();
+ SecurityAlarm alarm;
- public AddOutputPage(SecurityAlarm function, Action<SecurityAlarm> action)
+ public AddOutputPage(SecurityAlarm inOutput, Action<SecurityAlarm> action)
{
bodyView = this;
- securityAlarm = function;
refreshAction = action;
+ alarm = inOutput;
}
@@ -83,43 +85,22 @@
Text = DB_ResidenceData.Instance.CurFloor.roomName,
};
showdFunctionTypeRow.AddChidren(btnFloor);
+ LoadDialog_ChangeFloor();
#endregion
functionListView = new VerticalScrolViewLayout()
{
Y = showdFunctionTypeRow.Bottom,
- Height = Application.GetRealHeight(530 -100),
+ Height = Application.GetRealHeight(530 - 100),
BackgroundColor = CSS_Color.BackgroundColor,
};
bodyView.AddChidren(functionListView);
+ SetData();
-
-
-
- foreach (var function in FunctionList.List.Functions)
- {
- if (!MainPage.SceneSupportFunctionList.Contains(function.spk))
- {
- continue;
- }
- if (function == null)
- {
- continue;
- }
- function.roomIds.Remove(null);
- allocatedList.Add(function);
- }
-
- LoadFunctionListRow(null);
-
-
-
-
-
-
+ LoadFunctionListRow();
var bottomView = new FrameLayout()
{
@@ -146,51 +127,97 @@
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);
+ 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(),
+ });
+ }
+
+
+ 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(),
+ });
+ }
+
+ }
// <summary>
/// 鏄剧ず鍔熻兘Row
/// </summary>
- void LoadFunctionListRow(List<Function> functions)
+ void LoadFunctionListRow()
{
functionListView.RemoveAll();
- if (functions == null)
+ foreach (var function in allocatedList)
{
- functions = allocatedList;
- }
- foreach (var function in functions)
- {
- var output = securityAlarm.output.Find((obj) => obj.sid == function.sid);
+ 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;
- }
- outputList.Add(output);
FrameLayout functionRow = new FrameLayout()
{
@@ -217,7 +244,7 @@
Y = Application.GetRealHeight(24),
Width = Application.GetRealWidth(200),
Height = Application.GetRealHeight(41),
- Text = function.GetRoomListName(),
+ Text = function.RoomName,
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.PromptingColor1,
TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
@@ -230,9 +257,9 @@
TextAlignment = TextAlignment.CenterRight,
TextSize = CSS_FontSize.TextFontSize,
TextColor = CSS_Color.PromptingColor1,
+ Text = output.StateText()
};
functionRow.AddChidren(btnState);
-
Button btnChooseIcon = new Button()
{
@@ -247,17 +274,24 @@
btnChooseIcon.MouseUpEventHandler = (sender, e) => {
btnChooseIcon.IsSelected = !btnChooseIcon.IsSelected;
+ var tempLocal = alarm.output.Find((obj) =>
+ obj.sid == output.sid
+ );
+ if (tempLocal == null && !string.IsNullOrEmpty(output.spk))
+ {
+ ShowStateDialog(output, btnState, btnChooseIcon);
+ }
if (btnChooseIcon.IsSelected)
{
- output.addCondition = true;
- if (output.status.Count == 0)
- {
- ShowStateDialog(output, btnState,btnChooseIcon);
- }
+ if (tempLocal == null)
+ alarm.output.Add(output);
}
else
{
- output.addCondition = false;
+ if (tempLocal != null)
+ {
+ alarm.output.Remove(output);
+ }
}
};
btnState.MouseUpEventHandler = (sender, e) =>
@@ -265,8 +299,9 @@
ShowStateDialog(output, btnState, btnChooseIcon);
};
+ var localOutput = alarm.output.Find((obj) => obj.sid == output.sid);
- if (output.addCondition)
+ if (localOutput != null)
{
btnChooseIcon.IsSelected = true;
btnState.Text = output.StateText();
@@ -284,7 +319,6 @@
}
}
-
private void ShowStateDialog(SecurityOutput output, Button btnState, Button btnChoose = null)
@@ -320,12 +354,12 @@
{
Height = Application.GetRealHeight(44),
TextAlignment = TextAlignment.Center,
- TextColor = CSS_Color.MainColor,
+ SelectedTextColor = CSS_Color.MainColor,
+ TextColor = CSS_Color.PromptingColor1,
TextSize = CSS_FontSize.SubheadingFontSize,
- TextID = StringId.On
+ TextID = StringId.Open,
};
optinView.AddChidren(btnOpen);
-
optinView.AddChidren(new Button()
{
Height = 1,
@@ -336,11 +370,17 @@
{
Height = Application.GetRealHeight(44),
TextAlignment = TextAlignment.Center,
+ SelectedTextColor = CSS_Color.MainColor,
TextColor = CSS_Color.PromptingColor1,
- TextID = StringId.OFF,
+ TextID = StringId.Close,
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()
@@ -369,8 +409,10 @@
value = "on",
}
};
- output.addCondition = true;
- if (btnChoose != null)
+ var localInput = alarm.output.Find((obj) =>
+ obj.sid == output.sid
+ );
+ if (localInput == null)
{
btnChoose.IsSelected = true;
}
@@ -388,8 +430,10 @@
value = "off",
}
};
- output.addCondition = true;
- if (btnChoose != null)
+ var localInput = alarm.output.Find((obj) =>
+ obj.sid == output.sid
+ );
+ if (localInput == null)
{
btnChoose.IsSelected = true;
}
@@ -412,26 +456,24 @@
}
-
-
/// <summary>
/// 浣忓畢鍒楄〃鐐瑰嚮浜嬩欢
/// </summary>
void LoadDialog_ChangeFloor()
{
string nowSelectId = null;
- btnFloor.MouseUpEventHandler += (sender, e) =>
+ btnFloor.MouseUpEventHandler = (sender, e) =>
{
var listAllFun = new List<Function>();
- listAllFun.AddRange(allocatedList);
+ //listAllFun.AddRange(allocatedList);
//鏄剧ず涓嬫媺鐣岄潰
var form = new FloorRoomSelectPopupView();
form.ShowDeviceFunctionView(btnFloor, listAllFun, (selectId, listFun) =>
{
- nowSelectId = selectId;
+ SetData(selectId);
//閲嶆柊鍒锋柊璁惧鍒楄〃
- this.LoadFunctionListRow(listFun);
+ this.LoadFunctionListRow();
}, nowSelectId);
};
}
--
Gitblit v1.8.0