陈嘉乐
2020-07-10 48ba446936b51fffafa7c3600c0dadc6ac0e8c20
ZigbeeApp/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs
@@ -65,64 +65,67 @@
        /// </summary>
        private void InitTabSwitchControl()
        {
            var frameBack = new FrameLayout();
            frameBack.Height = Application.GetRealHeight(1300);
            frameBack.Y = Application.GetRealHeight(444);
            frameBack.BackgroundColor = 0xa1ffffff;
            frameBack.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
            bodyFrameLayout.AddChidren(frameBack);
            //桌布控件
            frameLayoutDraw = new FrameLayout();
            frameLayoutDraw.Y = Application.GetRealHeight(590);
            frameLayoutDraw.Height = bodyFrameLayout.Height - Application.GetRealHeight(590);
            bodyFrameLayout.AddChidren(frameLayoutDraw);
            //临时的一个东西,用来计算真实值而已
            var btnTemp = new NormalViewControl(100, false);
            int realLogWidth = btnTemp.GetRealWidthByText(16, Language.StringByID(R.MyInternationalizationString.uSecurityLog));
            int realSensorWidth = btnTemp.GetRealWidthByText(16, Language.StringByID(R.MyInternationalizationString.uSensorStatu));
            btnTemp = null;
            frameLayoutDraw.Y = Application.GetRealHeight(181);
            frameLayoutDraw.Height = frameBack.Height - Application.GetRealHeight(181);
            frameBack.AddChidren(frameLayoutDraw);
            //安防记录(点击范围有点小,需要扩大它的点击范围)
            var frameLog = new FrameLayoutControl();
            var frameLog = new FrameLayoutStatuControl();
            frameLog.UseClickStatu = false;
            frameLog.Height = Application.GetRealHeight(123);
            frameLog.Width = realLogWidth;
            frameLog.X = Application.GetRealWidth(489) - realLogWidth;
            frameLog.Y = Application.GetRealHeight(467);
            bodyFrameLayout.AddChidren(frameLog);
            frameLog.Width = Application.GetRealWidth(273);
            frameLog.X = Application.GetRealWidth(259);
            frameLog.Y = Application.GetRealHeight(58);
            frameBack.AddChidren(frameLog);
            //标题
            var btnLog = new NormalViewControl(100, 63, true);
            btnLog.Width = realLogWidth;
            btnLog.TextAlignment = TextAlignment.CenterRight;
            btnLog.Width = frameLog.Width;
            btnLog.TextAlignment = TextAlignment.Center;
            btnLog.TextID = R.MyInternationalizationString.uSecurityLog;
            btnLog.TextColor = UserCenterColor.Current.TextGrayColor3;
            frameLog.AddChidren(btnLog, ChidrenBindMode.BindEventOnly);
            frameLog.AddChidren(btnLog, ChidrenBindMode.BindEvent);
            //底线
            var btnLogLine = new NormalViewControl(40, 10, true);
            btnLogLine.Y = Application.GetRealHeight(86);
            btnLogLine.X = btnLog.X + btnLog.Width / 2 - Application.GetRealWidth(40) / 2;
            btnLogLine.Radius = (uint)Application.GetRealHeight(10) / 2;
            btnLogLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
            frameLog.AddChidren(btnLogLine, ChidrenBindMode.BindEventOnly);
            frameLog.AddChidren(btnLogLine, ChidrenBindMode.BindEvent);
            btnLogLine.Visible = false;
            //传感器状态(点击范围有点小,需要扩大它的点击范围)
            var frameSensor = new FrameLayoutControl();
            var frameSensor = new FrameLayoutStatuControl();
            frameSensor.UseClickStatu = false;
            frameSensor.Height = frameLog.Height;
            frameSensor.Width = realSensorWidth;
            frameSensor.X = Application.GetRealWidth(550);
            frameSensor.Width = frameLog.Width;
            frameSensor.X = frameLog.Right;
            frameSensor.Y = frameLog.Y;
            bodyFrameLayout.AddChidren(frameSensor);
            frameBack.AddChidren(frameSensor);
            //标题
            var btnSensor = new NormalViewControl(100, 63, true);
            btnSensor.Width = realSensorWidth;
            btnSensor.Width = frameSensor.Width;
            btnSensor.TextID = R.MyInternationalizationString.uSensorStatu;
            btnSensor.TextSize = 16;
            btnSensor.TextAlignment = TextAlignment.Center;
            btnSensor.TextColor = UserCenterColor.Current.TextColor2;
            frameSensor.AddChidren(btnSensor, ChidrenBindMode.BindEventOnly);
            btnSensor.IsBold = true;
            frameSensor.AddChidren(btnSensor, ChidrenBindMode.BindEvent);
            //底线
            var btnSensorLine = new NormalViewControl(40, 10, true);
            btnSensorLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
            btnSensorLine.Y = btnLogLine.Y;
            btnSensorLine.X = btnSensor.X + btnSensor.Width / 2 - Application.GetRealWidth(40) / 2;
            btnSensorLine.Radius = (uint)Application.GetRealHeight(10) / 2;
            frameSensor.AddChidren(btnSensorLine, ChidrenBindMode.BindEventOnly);
            frameSensor.AddChidren(btnSensorLine, ChidrenBindMode.BindEvent);
            //安防记录Tab
            frameLog.ButtonClickEvent += (sender, e) =>
@@ -130,8 +133,10 @@
                //字体大小和颜色变更
                btnSensor.TextColor = UserCenterColor.Current.TextGrayColor3;
                btnSensor.TextSize = 14;
                btnSensor.IsBold = false;
                btnLog.TextColor = UserCenterColor.Current.TextColor2;
                btnLog.TextSize = 16;
                btnLog.IsBold = true;
                btnLogLine.Visible = true;
                btnSensorLine.Visible = false;
@@ -148,8 +153,10 @@
                //字体大小和颜色变更
                btnSensor.TextColor = UserCenterColor.Current.TextColor2;
                btnSensor.TextSize = 16;
                btnSensor.IsBold = true;
                btnLog.TextColor = UserCenterColor.Current.TextGrayColor3;
                btnLog.TextSize = 14;
                btnLog.IsBold = false;
                btnLogLine.Visible = false;
                btnSensorLine.Visible = true;
@@ -183,7 +190,7 @@
                btnIcon.ButtonClickEvent += (sender, e) =>
                {
                    //菜单控件
                    var frameMenu = new TopRightMenuControl(2);
                    var frameMenu = new TopRightMenuControl(2, 2);
                    //防区列表
                    string menu1 = Language.StringByID(R.MyInternationalizationString.uGarrisonAreaList);
                    frameMenu.AddRowMenu(menu1, "Item/GarrisonList.png", "Item/GarrisonListSelected.png", () =>
@@ -231,7 +238,7 @@
            topFrameLayout.AddChidren(btnShortCut);
            btnShortCut.InitControl();
            if (UserCenterResourse.Option.SafetyShortcut == true)
            if (UserCenterResourse.ResidenceOption.SafetyShortcut == true)
            {
                //使用快捷方式
                btnShortCut.IsSelected = true;
@@ -243,9 +250,11 @@
                    //确定取消主页的「安防」捷径?
                    this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uCancelSafetyShortcutMsg), () =>
                    {
                        UserCenterResourse.Option.SafetyShortcut = false;
                        UserCenterResourse.Option.Save();
                        UserCenterResourse.ResidenceOption.SafetyShortcut = false;
                        UserCenterResourse.ResidenceOption.Save();
                        btnShortCut.IsSelected = false;
                        //取消主页的「安防」捷径的话,主页需要重新刷新
                        UserView.UserPage.Instance.RefreshForm = true;
                    });
                }
                else
@@ -253,9 +262,11 @@
                    //确定创建「安防」捷径到主页?
                    this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uCreatSafetyShortcutMsg), () =>
                    {
                        UserCenterResourse.Option.SafetyShortcut = true;
                        UserCenterResourse.Option.Save();
                        UserCenterResourse.ResidenceOption.SafetyShortcut = true;
                        UserCenterResourse.ResidenceOption.Save();
                        btnShortCut.IsSelected = true;
                        //创建主页的「安防」捷径的话,主页需要重新刷新
                        UserView.UserPage.Instance.RefreshForm = true;
                    });
                }
            };
@@ -388,7 +399,7 @@
            this.dicSensorStatuView.Clear();
            //添加列表控件
            //添加列表控件
            frameLayoutDraw.RemoveAll();
            var listView = new VerticalFrameControl(35);
            listView.Height = frameLayoutDraw.Height;
@@ -421,6 +432,8 @@
                            }
                        }
                    }
                    //调整列表控件高度
                    listView.AdjustChidrenFrameHeight(listView.frameTable, Application.GetRealHeight(46));
                    //开启传感器报警监视
                    this.StartCheckDeviceAlarm();
                    //开启设备在线监测
@@ -445,7 +458,7 @@
            //自定义传感器状态控件
            var frameDevice = new SafetySensorStatuControl();
            listView.AddChidrenFrame(frameDevice);
            listView.AddChidren(frameDevice);
            frameDevice.InitControl(device);
            //添加阴影特效
            frameDevice.SetViewShadow(true);
@@ -481,7 +494,7 @@
                var control = this.dicSensorStatuView[mainkey];
                //获取传感器报警信息的翻译文本
                var msgInfo = HdlAlarmsLogic.Current.GetSensorAlarmInfo(device);
                Application.RunOnMainThread(() =>
                HdlThreadLogic.Current.RunMain(() =>
                {
                    control?.SetSensoReportInfo(msgInfo);
                });
@@ -540,7 +553,16 @@
                        //界面关闭
                        return;
                    }
                    Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, this.ReceiveDeviceStatuPush, ShowErrorMode.NO);
                    int statu = 0;
                    var list = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
                    if (statu != -1)
                    {
                        for (int i = 0; i < list.Count; i++)
                        {
                            //设置设备在线状态
                            this.ReceiveDeviceStatuPush(list[i]);
                        }
                    }
                }
            });
        }
@@ -581,7 +603,8 @@
                    Application.RunOnMainThread(() =>
                    {
                        //设置控件的在线状态文本效果
                        control?.SetOnlineStatu(device.IsOnline == 1);
                        bool bolOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(device);
                        control?.SetOnlineStatu(bolOnline);
                    });
                }
            }
@@ -667,7 +690,7 @@
                    //执行初始化
                    TodaySafeguardFrame = new SafeguardLogControl();
                    TodaySafeguardFrame.Y = Application.GetRealHeight(10);
                    listView.AddChidrenFrame(TodaySafeguardFrame);
                    listView.AddChidren(TodaySafeguardFrame);
                    TodaySafeguardFrame.InitControl(nowDayKey, nowDayData);
                    //初始化其他日期的安防记录控件
@@ -675,7 +698,7 @@
                    {
                        otherDaySafeguardFrame = new FrameLayout();
                        otherDaySafeguardFrame.Height = Application.GetRealHeight(10);
                        listView.AddChidrenFrame(otherDaySafeguardFrame);
                        listView.AddChidren(otherDaySafeguardFrame);
                        foreach (var dayText in dicInfo.Keys)
                        {
                            //执行初始化