| | |
| | | /// <summary>
|
| | | /// 桌布控件,用于存放或者移除功能块控件(Tab控件专用)
|
| | | /// </summary>
|
| | | private FrameLayout frameLayoutDraw = null;
|
| | | private NormalFrameLayout frameLayoutDraw = null;
|
| | | /// <summary>
|
| | | /// 安防控件
|
| | | /// </summary>
|
| | |
| | | bodyFrameLayout.AddChidren(frameBack);
|
| | |
|
| | | //桌布控件
|
| | | frameLayoutDraw = new FrameLayout();
|
| | | frameLayoutDraw = new NormalFrameLayout();
|
| | | frameLayoutDraw.Y = Application.GetRealHeight(181);
|
| | | frameLayoutDraw.Height = frameBack.Height - Application.GetRealHeight(181);
|
| | | frameBack.AddChidren(frameLayoutDraw);
|
| | |
|
| | | //计算宽度使用
|
| | | var btnTemp = new ButtonBase();
|
| | | btnTemp.TextSize = 16;
|
| | | btnTemp.IsBold = true;
|
| | |
|
| | | btnTemp.TextID = R.MyInternationalizationString.uSecurityLog;
|
| | | int frameLogWidth = btnTemp.GetRealWidthByText() + Application.GetRealWidth(30);
|
| | |
|
| | | btnTemp.TextID = R.MyInternationalizationString.uSensorStatu;
|
| | | int frameSensorWidth = btnTemp.GetRealWidthByText() + Application.GetRealWidth(30);
|
| | |
|
| | | //安防记录(点击范围有点小,需要扩大它的点击范围)
|
| | | var frameLog = new FrameLayoutControl();
|
| | | var frameLog = new FrameLayoutStatuControl();
|
| | | frameLog.UseClickStatu = false;
|
| | | frameLog.Height = Application.GetRealHeight(123);
|
| | | frameLog.Width = Application.GetRealWidth(273);
|
| | | frameLog.X = Application.GetRealWidth(259);
|
| | | frameLog.Width = frameLogWidth;
|
| | | frameLog.X = (frameBack.Width - frameLogWidth - frameSensorWidth) / 2;
|
| | | frameLog.Y = Application.GetRealHeight(58);
|
| | | frameBack.AddChidren(frameLog);
|
| | | //标题
|
| | |
| | | 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.X = btnLog.X + btnLog.Width / 2 - Application.GetRealWidth(40) / 2;
|
| | | btnLogLine.Gravity = Gravity.CenterHorizontal;
|
| | | 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 = frameLog.Width;
|
| | | frameSensor.Width = frameSensorWidth;
|
| | | frameSensor.X = frameLog.Right;
|
| | | frameSensor.Y = frameLog.Y;
|
| | | frameBack.AddChidren(frameSensor);
|
| | |
| | | btnSensor.TextAlignment = TextAlignment.Center;
|
| | | btnSensor.TextColor = UserCenterColor.Current.TextColor2;
|
| | | btnSensor.IsBold = true;
|
| | | frameSensor.AddChidren(btnSensor, ChidrenBindMode.BindEventOnly);
|
| | | 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.X = btnSensor.X + btnSensor.Width / 2 - Application.GetRealWidth(40) / 2;
|
| | | btnSensorLine.Gravity = Gravity.CenterHorizontal;
|
| | | btnSensorLine.Radius = (uint)Application.GetRealHeight(10) / 2;
|
| | | frameSensor.AddChidren(btnSensorLine, ChidrenBindMode.BindEventOnly);
|
| | | frameSensor.AddChidren(btnSensorLine, ChidrenBindMode.BindEvent);
|
| | |
|
| | | //安防记录Tab
|
| | | frameLog.ButtonClickEvent += (sender, e) =>
|
| | |
| | | btnShortCut.UnSelectedImagePath = "Safeguard/SafetyShortcut.png";
|
| | | btnShortCut.SelectedImagePath = "Safeguard/SafetyShortcutSelected.png";
|
| | |
|
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
|
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
|
| | | {
|
| | | //快捷方式向左移动
|
| | | btnShortCut.X = Application.GetRealWidth(855);
|
| | |
| | |
|
| | | topFrameLayout.AddChidren(btnShortCut);
|
| | | btnShortCut.InitControl();
|
| | | if (UserCenterResourse.Option.SafetyShortcut == true)
|
| | | if (HdlUserCenterResourse.ResidenceOption.SafetyShortcut == true)
|
| | | {
|
| | | //使用快捷方式
|
| | | btnShortCut.IsSelected = true;
|
| | |
| | | //确定取消主页的「安防」捷径?
|
| | | this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uCancelSafetyShortcutMsg), () =>
|
| | | {
|
| | | UserCenterResourse.Option.SafetyShortcut = false;
|
| | | UserCenterResourse.Option.Save();
|
| | | HdlUserCenterResourse.ResidenceOption.SafetyShortcut = false;
|
| | | HdlUserCenterResourse.ResidenceOption.Save();
|
| | | btnShortCut.IsSelected = false;
|
| | | //取消主页的「安防」捷径的话,主页需要重新刷新
|
| | | UserView.UserPage.Instance.RefreshAllForm = true;
|
| | | });
|
| | | }
|
| | | else
|
| | |
| | | //确定创建「安防」捷径到主页?
|
| | | this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uCreatSafetyShortcutMsg), () =>
|
| | | {
|
| | | UserCenterResourse.Option.SafetyShortcut = true;
|
| | | UserCenterResourse.Option.Save();
|
| | | HdlUserCenterResourse.ResidenceOption.SafetyShortcut = true;
|
| | | HdlUserCenterResourse.ResidenceOption.Save();
|
| | | btnShortCut.IsSelected = true;
|
| | | //创建主页的「安防」捷径的话,主页需要重新刷新
|
| | | UserView.UserPage.Instance.RefreshAllForm = true;
|
| | | });
|
| | | }
|
| | | };
|
| | |
| | | this.CloseProgressBar();
|
| | |
|
| | | //数据初始化完成后
|
| | | Application.RunOnMainThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //初始化头部的那三个图标
|
| | | garrisonControl = new SafetyMasterControl();
|
| | |
| | | this.AddSensorStatuRow(listView, zoneId, Info);
|
| | |
|
| | | //收集传感器
|
| | | var tempDevice = Common.LocalDevice.Current.GetDevice(Info.MacAddr, Info.Epoint);
|
| | | var tempDevice = HdlDeviceCommonLogic.Current.GetDevice(Info.MacAddr, Info.Epoint);
|
| | | if (tempDevice != null)
|
| | | {
|
| | | listDevice.Add(tempDevice);
|
| | |
| | | /// <param name="sensorInfo">传感器的信息</param>
|
| | | private void AddSensorStatuRow(VerticalFrameControl listView, int zoneID, Safeguard.ZoneDeviceListData sensorInfo)
|
| | | {
|
| | | CommonDevice device = Common.LocalDevice.Current.GetDevice(sensorInfo.MacAddr, sensorInfo.Epoint);
|
| | | CommonDevice device = HdlDeviceCommonLogic.Current.GetDevice(sensorInfo.MacAddr, sensorInfo.Epoint);
|
| | | if (device == null)
|
| | | {
|
| | | return;
|
| | |
| | |
|
| | | //自定义传感器状态控件
|
| | | var frameDevice = new SafetySensorStatuControl();
|
| | | listView.AddChidrenFrame(frameDevice);
|
| | | listView.AddChidren(frameDevice);
|
| | | frameDevice.InitControl(device);
|
| | | //添加阴影特效
|
| | | frameDevice.SetViewShadow(true);
|
| | |
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device);
|
| | | this.dicSensorStatuView[mainkeys] = frameDevice;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | //传感器状态
|
| | | string mainkey = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | string mainkey = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device);
|
| | | if (this.dicSensorStatuView.ContainsKey(mainkey) == false)
|
| | | {
|
| | | return;
|
| | |
| | | //从设备列表中获取在线状态
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //首先获取这些传感器所在的网关
|
| | | var listWay = new List<ZbGateway>();
|
| | | foreach (var device in listDevice)
|
| | | {
|
| | | ZbGateway realWay = null;
|
| | | //是否存在真实物理网关
|
| | | if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, device.CurrentGateWayId) == false)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | listWay.Add(realWay);
|
| | | }
|
| | | foreach (var zbway in listWay)
|
| | | {
|
| | | if (this.Parent == null)
|
| | | {
|
| | | //界面关闭
|
| | | return;
|
| | | }
|
| | | int statu = 0;
|
| | | var list = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
|
| | | if (statu != -1)
|
| | | var deviceInfo = HdlDeviceCommonLogic.Current.ReadDeviceEpointDeviceInfo(device);
|
| | | if (deviceInfo != null)
|
| | | {
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | //设置设备在线状态
|
| | | this.ReceiveDeviceStatuPush(list[i]);
|
| | | }
|
| | | //设置设备在线状态
|
| | | this.ReceiveDeviceStatuPush(device, deviceInfo);
|
| | | }
|
| | | System.Threading.Thread.Sleep(50);
|
| | | }
|
| | | });
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 接受设备在线推送
|
| | | /// </summary>
|
| | | /// <param name="device"></param>
|
| | | private void ReceiveDeviceStatuPush(CommonDevice device)
|
| | | private void ReceiveDeviceStatuPush(CommonDevice device, CommonDevice.DeviceInfoData deviceInfo)
|
| | | {
|
| | | if (this.Parent == null)
|
| | | {
|
| | | //界面关闭
|
| | | return;
|
| | | }
|
| | |
|
| | | lock (objOnlineLock)
|
| | | string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device);
|
| | | if (this.dicSensorStatuView.ContainsKey(mainkeys) == true)
|
| | | {
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | if (this.dicSensorStatuView.ContainsKey(mainkeys) == true)
|
| | | CommonDevice Loacldevice = HdlDeviceCommonLogic.Current.GetDevice(mainkeys);
|
| | | if (Loacldevice == null)
|
| | | {
|
| | | CommonDevice Loacldevice = Common.LocalDevice.Current.GetDevice(mainkeys);
|
| | | if (Loacldevice == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //在线状态一样的话,不需要刷新
|
| | | if (Loacldevice.IsOnline == device.IsOnline)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //保存状态
|
| | | Loacldevice.IsOnline = device.IsOnline;
|
| | | Loacldevice.ReSave();
|
| | |
|
| | | //因为这是推送过来的,我不保证那一瞬间这个东西会不会被移除
|
| | | var control = this.dicSensorStatuView[mainkeys];
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //设置控件的在线状态文本效果
|
| | | control?.SetOnlineStatu(device.IsOnline == 1);
|
| | | });
|
| | | return;
|
| | | }
|
| | | //在线状态一样的话,不需要刷新
|
| | | if (Loacldevice.IsOnline == deviceInfo.IsOnline)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //保存状态
|
| | | Loacldevice.IsOnline = deviceInfo.IsOnline;
|
| | |
|
| | | //因为这是推送过来的,我不保证那一瞬间这个东西会不会被移除
|
| | | var control = this.dicSensorStatuView[mainkeys];
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //设置控件的在线状态文本效果
|
| | | bool bolOnline = HdlDeviceCommonLogic.Current.CheckDeviceIsOnline(device);
|
| | | control?.SetOnlineStatu(bolOnline);
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | dicAlarm = null;
|
| | |
|
| | | Application.RunOnMainThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (this.Parent == null)
|
| | | {
|
| | |
| | | //执行初始化
|
| | | TodaySafeguardFrame = new SafeguardLogControl();
|
| | | TodaySafeguardFrame.Y = Application.GetRealHeight(10);
|
| | | listView.AddChidrenFrame(TodaySafeguardFrame);
|
| | | listView.AddChidren(TodaySafeguardFrame);
|
| | | TodaySafeguardFrame.InitControl(nowDayKey, nowDayData);
|
| | |
|
| | | //初始化其他日期的安防记录控件
|
| | |
| | | {
|
| | | otherDaySafeguardFrame = new FrameLayout();
|
| | | otherDaySafeguardFrame.Height = Application.GetRealHeight(10);
|
| | | listView.AddChidrenFrame(otherDaySafeguardFrame);
|
| | | listView.AddChidren(otherDaySafeguardFrame);
|
| | | foreach (var dayText in dicInfo.Keys)
|
| | | {
|
| | | //执行初始化
|
| | |
| | | var info = HdlAlarmsLogic.Current.listSafetyAlarmInfo[0];
|
| | | if (device != null)
|
| | | {
|
| | | string mainkey1 = Common.LocalDevice.Current.GetDeviceMainKeys(info.DeviceAddr, info.DeviceEpoint);
|
| | | string mainkey2 = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | string mainkey1 = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(info.DeviceAddr, info.DeviceEpoint);
|
| | | string mainkey2 = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device);
|
| | | if (mainkey1 != mainkey2)
|
| | | {
|
| | | //不是同一个东西
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | Application.RunOnMainThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (this.TodaySafeguardFrame != null)
|
| | | {
|