黄学彪
2019-11-25 160785587667cc0d927f85e44c139ec9dde13a9e
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 = 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 = 8;
            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>();
@@ -101,7 +115,8 @@
                    }
                    //变更高度
                    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 +128,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.btnTime.AddBottomShadow(this.frameTable);
        }
        #endregion
@@ -135,7 +152,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 +166,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;
@@ -251,8 +268,12 @@
            if (realHeight > 0)
            {
                //变更整个控件的真实高度 
                this.Height = realHeight;
                this.frameTable.Height = realHeight;
                this.Height = realHeight + Application.GetRealHeight(44);
            }
            //添加底部阴影特效
            this.btnTime.AddBottomShadow(this.frameTable);
            return value;
        }
@@ -272,7 +293,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,13 +301,13 @@
            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)
@@ -305,7 +326,7 @@
            rowFrame.AddChidren(btnMsg);
            //时间:时分秒
            var btnTime = new NormalViewControl(176, 58, true);
            btnTime.X = Application.GetRealWidth(829);
            btnTime.X = Application.GetRealWidth(772);
            btnTime.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnTime.TextAlignment = TextAlignment.CenterRight;
            btnTime.Text = alarmInfo.Time;