From 18a7f9f40e5fab3bee5d4ac3d8fd0273dea052d6 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期日, 26 四月 2020 12:05:28 +0800
Subject: [PATCH] 先上传一个非最新的版本
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafeguardLogControl.cs | 129 ++++++++++++++++++++++++++++---------------
1 files changed, 84 insertions(+), 45 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafeguardLogControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafeguardLogControl.cs
index 966b91e..e74e709 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafeguardLogControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafeguardLogControl.cs
@@ -23,6 +23,14 @@
/// 鍚勯槻鍖虹殑琛屾帶浠�
/// </summary>
private Dictionary<int, List<FrameLayout>> dicRowFrame = new Dictionary<int, List<FrameLayout>>();
+ /// <summary>
+ /// 妗屽竷鎺т欢
+ /// </summary>
+ private FrameLayout frameTable = null;
+ /// <summary>
+ /// 寮�鏀捐繖涓帶浠跺嚭鏉�,鏈夌偣鐢�
+ /// </summary>
+ private NormalViewControl btnTime = null;
#endregion
@@ -33,9 +41,7 @@
/// </summary>
public SafeguardLogControl()
{
- this.BackgroundColor = UserCenterColor.Current.White;
- this.Radius = (uint)Application.GetMinRealAverage(17);
- this.Height = Application.GetRealHeight(260);
+ this.Height = Application.GetRealHeight(260 + 44);
}
/// <summary>
@@ -45,31 +51,39 @@
/// <param name="dicInfo">闃插尯鎶ヨ淇℃伅</param>
public void InitControl(string dayText, Dictionary<int, List<SafeguardAlarmInfo>> dicInfo)
{
+ this.frameTable = new FrameLayout();
+ frameTable.Gravity = Gravity.CenterHorizontal;
+ frameTable.Radius = (uint)Application.GetRealHeight(17);
+ frameTable.Height= Application.GetRealHeight(260);
+ frameTable.Width = Application.GetRealWidth(968);
+ frameTable.BackgroundColor = UserCenterColor.Current.White;
+ this.AddChidren(frameTable);
+
//璁板綍鏃堕棿
- var btnTime = new NormalViewControl(300, 58, true);
- btnTime.X = Application.GetRealWidth(92);
+ this.btnTime = new NormalViewControl(300, 58, true);
+ btnTime.X = Application.GetRealWidth(35);
btnTime.Y = Application.GetRealHeight(29);
btnTime.TextColor = UserCenterColor.Current.TextGrayColor3;
btnTime.TextID = R.MyInternationalizationString.uRecordTime;
- this.AddChidren(btnTime);
+ this.frameTable.AddChidren(btnTime);
//鏃ユ湡
string month = dayText.Substring(4, 2);
string day = dayText.Substring(6, 2);
var btnDay = new NormalViewControl(300, 58, true);
- btnDay.X = this.Width - Application.GetRealWidth(300 + 89);
+ btnDay.X = frameTable.Width - Application.GetRealWidth(300 + 35);
btnDay.Y = btnTime.Y;
btnDay.TextColor = UserCenterColor.Current.TextColor2;
btnDay.TextAlignment = TextAlignment.CenterRight;
btnDay.Text = month + Language.StringByID(R.MyInternationalizationString.Month) + day + Language.StringByID(R.MyInternationalizationString.Day);
- this.AddChidren(btnDay);
+ this.frameTable.AddChidren(btnDay);
//绾�
var btnLine = new NormalViewControl(Application.GetRealWidth(904), ControlCommonResourse.BottomLineHeight, false);
- btnLine.X = Application.GetRealWidth(86);
+ btnLine.X = Application.GetRealWidth(29);
btnLine.Y = Application.GetRealHeight(98);
btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
- this.AddChidren(btnLine);
+ this.frameTable.AddChidren(btnLine);
//棰勫垱寤轰簲澶ч槻鍖虹殑妗屽竷
var listId = new List<int>() { 1, 2, 4, 5, 3 };
@@ -79,7 +93,7 @@
var frame1 = new FrameLayout();
frame1.Height = Application.GetRealHeight(10);
frame1.Y = tempY == 0 ? Application.GetRealHeight(98) : tempY;
- this.AddChidren(frame1);
+ this.frameTable.AddChidren(frame1);
dicFrame[listId[i]] = frame1;
dicRowFrame[listId[i]] = new List<FrameLayout>();
@@ -91,17 +105,23 @@
var listRow = dicRowFrame[listId[i]];
foreach (var alarmInfo in dicInfo[listId[i]])
{
- //娣诲姞鎶ヨ淇℃伅
- var contr = this.AddAlarmInfoControl(alarmInfo);
- if (listRow.Count != 0)
+ //涓�鏉′俊鎭噷闈紝瀹冨彲鑳藉寘鍚涓姤璀�
+ var listMsg = HdlAlarmsLogic.Current.GetSensorListAlarmMsg(alarmInfo);
+ foreach (var strMsg in listMsg)
{
- contr.Y = listRow[listRow.Count - 1].Bottom + Application.GetRealHeight(23);
+ //娣诲姞鎶ヨ淇℃伅鎺т欢
+ var contr = this.AddAlarmInfoControl(alarmInfo, strMsg);
+ if (listRow.Count != 0)
+ {
+ contr.Y = listRow[listRow.Count - 1].Bottom + Application.GetRealHeight(23);
+ }
+ listRow.Add(contr);
}
- listRow.Add(contr);
}
//鍙樻洿楂樺害
frame1.Height = listRow[listRow.Count - 1].Bottom + Application.GetRealHeight(55);
- this.Height = frame1.Bottom;
+ this.frameTable.Height = frame1.Bottom;
+ this.Height = frame1.Bottom + Application.GetRealHeight(44);
tempY = frame1.Bottom;
}
else
@@ -113,13 +133,15 @@
if (dicInfo == null || dicInfo.Count == 0)
{
//浠婃棩鏃犱换浣曟姤璀﹁褰�
- btnMsg = new NormalViewControl(this.Width, Application.GetRealHeight(58), false);
- btnMsg.Y = btnLine.Bottom + Application.GetRealHeight(29);
+ btnMsg = new NormalViewControl(frameTable.Width, Application.GetRealHeight(60), false);
+ btnMsg.Y = btnLine.Bottom + Application.GetRealHeight(28);
btnMsg.TextColor = UserCenterColor.Current.TextGrayColor3;
btnMsg.TextID = R.MyInternationalizationString.uNowDayNotHadAlarmLog;
btnMsg.TextAlignment = TextAlignment.Center;
- this.AddChidren(btnMsg);
+ this.frameTable.AddChidren(btnMsg);
}
+ //娣诲姞搴曢儴闃村奖鐗规晥
+ this.frameTable.SetViewShadow(true);
}
#endregion
@@ -135,7 +157,7 @@
FrameLayout frame = dicFrame[zoneId];
//鍥炬爣
var btnIcon = new IconViewControl(69);
- btnIcon.X = Application.GetRealWidth(86);
+ btnIcon.X = Application.GetRealWidth(29);
btnIcon.Y = Application.GetRealHeight(23);
//鍙細鏄�1~5
if (zoneId == 1 || zoneId == 2)
@@ -149,13 +171,13 @@
frame.AddChidren(btnIcon);
//闃插尯鍚�
var btnName = new NormalViewControl(400, 58, true);
- btnName.X = Application.GetRealWidth(167);
+ btnName.X = Application.GetRealWidth(109);
btnName.Y = Application.GetRealHeight(35);
btnName.Text = HdlSafeguardLogic.Current.GetGarrisonText(zoneId);
frame.AddChidren(btnName);
//宸插惎鍔�
var btnStatu = new NormalViewControl(300, 46, true);
- btnStatu.X = frame.Width - Application.GetRealWidth(300 + 89);
+ btnStatu.X = frame.Width - Application.GetRealWidth(300 + 35);
btnStatu.Y = Application.GetRealHeight(35);
btnStatu.TextSize = 12;
btnStatu.TextColor = UserCenterColor.Current.TextGrayColor1;
@@ -176,8 +198,34 @@
/// <summary>
/// 娣诲姞鎶ヨ淇℃伅
/// </summary>
+ /// <param name="alarmInfo"></param>
/// <returns></returns>
public int AddSafeguardAlarmInfo(SafeguardAlarmInfo alarmInfo)
+ {
+ if (dicFrame.ContainsKey(alarmInfo.ZoneId) == false)
+ {
+ return -1;
+ }
+ //涓�鏉′俊鎭噷闈紝瀹冨彲鑳藉寘鍚涓姤璀�
+ var listMsg = HdlAlarmsLogic.Current.GetSensorListAlarmMsg(alarmInfo);
+ int valueCount = 0;
+ foreach (var strMsg in listMsg)
+ {
+ //涓�涓姤璀︿俊鎭紝涓�涓帶浠�
+ int value = this.AddSafeguardAlarmInfo2(alarmInfo, strMsg);
+ //杩欎釜value鏄帶浠跺鍔犵殑楂樺害鍊�
+ valueCount += value;
+ }
+ return valueCount;
+ }
+
+ /// <summary>
+ /// 娣诲姞鎶ヨ淇℃伅(涓�涓姤璀︿俊鎭紝涓�涓帶浠�)
+ /// </summary>
+ /// <param name="alarmInfo"></param>
+ /// <param name="strMsg">閽堝涓�鏉℃暟鎹噷闈㈠寘鍚涓姤璀︾殑闂锛岃拷鍔犵殑鎶ヨ鏂囨湰</param>
+ /// <returns></returns>
+ private int AddSafeguardAlarmInfo2(SafeguardAlarmInfo alarmInfo, string strMsg)
{
if (dicFrame.ContainsKey(alarmInfo.ZoneId) == false)
{
@@ -206,7 +254,7 @@
}
//娣诲姞鎶ヨ淇℃伅鎺т欢
- var frameRow = this.AddAlarmInfoControl(alarmInfo);
+ var frameRow = this.AddAlarmInfoControl(alarmInfo, strMsg);
if (listRow.Count >= 100)
{
//绉婚櫎鏈�鍚庝竴涓�
@@ -251,8 +299,12 @@
if (realHeight > 0)
{
//鍙樻洿鏁翠釜鎺т欢鐨勭湡瀹為珮搴�
- this.Height = realHeight;
+ this.frameTable.Height = realHeight;
+ this.Height = realHeight + Application.GetRealHeight(44);
}
+ //娣诲姞搴曢儴闃村奖鐗规晥
+ this.frameTable.SetViewShadow(true);
+
return value;
}
@@ -261,7 +313,7 @@
/// </summary>
/// <param name="alarmInfo"></param>
/// <returns></returns>
- private FrameLayout AddAlarmInfoControl(SafeguardAlarmInfo alarmInfo)
+ private FrameLayout AddAlarmInfoControl(SafeguardAlarmInfo alarmInfo, string strMsg)
{
var frame = dicFrame[alarmInfo.ZoneId];
@@ -272,7 +324,7 @@
//鎴块棿
var btnRoom = new NormalViewControl(165, 58, true);
- btnRoom.X = Application.GetRealWidth(92);
+ btnRoom.X = Application.GetRealWidth(35);
btnRoom.TextColor = UserCenterColor.Current.TextGrayColor3;
btnRoom.Text = alarmInfo.RoomName;
rowFrame.AddChidren(btnRoom);
@@ -280,32 +332,19 @@
string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(alarmInfo.DeviceAddr, alarmInfo.DeviceEpoint);
var device = Common.LocalDevice.Current.GetDevice(mainkeys);
var btnDevice = new NormalViewControl(271, 58, true);
- btnDevice.X = Application.GetRealWidth(256);
+ btnDevice.X = Application.GetRealWidth(199);
btnDevice.TextColor = UserCenterColor.Current.TextGrayColor3;
btnDevice.Text = device == null ? alarmInfo.DeviceName : Common.LocalDevice.Current.GetDeviceEpointName(device);
rowFrame.AddChidren(btnDevice);
//鎶ヨ淇℃伅
var btnMsg = new NormalViewControl(303, 58, true);
- btnMsg.X = Application.GetRealWidth(527);
+ btnMsg.X = Application.GetRealWidth(469);
btnMsg.TextColor = UserCenterColor.Current.TextGrayColor3;
- //鐢垫睜鐢甸噺
- if (alarmInfo.BatteryMsg != null)
- {
- btnMsg.Text = alarmInfo.BatteryMsg;
- }
- //琚媶鎶ヨ
- else if (alarmInfo.DemolishmentMsg != null)
- {
- btnMsg.Text = alarmInfo.DemolishmentMsg;
- }
- else
- {
- btnMsg.Text = alarmInfo.AlarmMsg;
- }
+ btnMsg.Text = strMsg;
rowFrame.AddChidren(btnMsg);
//鏃堕棿锛氭椂鍒嗙
- var btnTime = new NormalViewControl(176, 58, true);
- btnTime.X = Application.GetRealWidth(829);
+ var btnTime = new NormalViewControl(190, 58, true);
+ btnTime.X = Application.GetRealWidth(758);
btnTime.TextColor = UserCenterColor.Current.TextGrayColor3;
btnTime.TextAlignment = TextAlignment.CenterRight;
btnTime.Text = alarmInfo.Time;
--
Gitblit v1.8.0