| | |
| | | /// <summary>
|
| | | /// 界面关闭事件
|
| | | /// </summary>
|
| | | public Action<CommonDevice, Common.Room> FormCloseEvent = null;
|
| | | public Action<CommonDevice> FormCloseEvent = null;
|
| | | /// <summary>
|
| | | /// 设备对象
|
| | | /// </summary>
|
| | | public CommonDevice device = null;
|
| | | /// <summary>
|
| | | /// 房间对象
|
| | | /// 当前选择的房间对象(再次刷新界面时,这个东西有可能是null)
|
| | | /// </summary>
|
| | | public Common.Room room = null;
|
| | | public Common.Room nowSelectRoom = null;
|
| | | /// <summary>
|
| | | /// 标记它是由哪个控件调起的
|
| | | /// </summary>
|
| | | public ViewGroup RowOrCardControl = null;
|
| | | /// <summary>
|
| | | /// 状态控件
|
| | | /// </summary>
|
| | |
| | | /// <summary>
|
| | | /// 是否获取网关反馈的结果 0:没有获取得到 1:已经获取得到
|
| | | /// </summary>
|
| | | private int ResponeResult = 0;
|
| | | public int ResponeResult = 0;
|
| | | /// <summary>
|
| | | /// 当前端点的功能类型
|
| | | /// </summary>
|
| | |
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | /// <param name="i_device">设备对象</param>
|
| | | /// <param name="i_room">房间</param>
|
| | | /// <param name="i_nowSelectRoom">房间</param>
|
| | | /// <param name="i_backWidth">白色背景的宽度(非真实值)</param>
|
| | | /// <param name="i_backHeight">白色背景的高度(非真实值)</param>
|
| | | public void ShowForm(CommonDevice i_device, Common.Room i_room, int i_backWidth, int i_backHeight)
|
| | | public void ShowForm(CommonDevice i_device, Common.Room i_nowSelectRoom, int i_backWidth, int i_backHeight)
|
| | | {
|
| | | this.CurrentText = Language.StringByID(R.MyInternationalizationString.Current) + " ";
|
| | | this.room = i_room;
|
| | | this.nowSelectRoom = i_nowSelectRoom;
|
| | | this.backFrameWidth = i_backWidth;
|
| | | this.backFrameHeight = i_backHeight;
|
| | |
|
| | |
| | | btnMore.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var detailInfo = new DeviceDetailInfoForm();
|
| | | detailInfo.AddForm(device, room);
|
| | | detailInfo.AddForm(device, nowSelectRoom);
|
| | | };
|
| | |
|
| | | //初始化中部信息
|
| | |
| | | btnRoomName.TextSize = 12;
|
| | | btnRoomName.TextColor = UserCenterColor.Current.White;
|
| | | btnRoomName.Gravity = Gravity.CenterVertical;
|
| | | btnRoomName.Text = this.room.Name;
|
| | | if (this.nowSelectRoom != null)
|
| | | {
|
| | | btnRoomName.Text = this.nowSelectRoom.Name;
|
| | | }
|
| | | else
|
| | | {
|
| | | //未分配
|
| | | btnRoomName.TextID = R.MyInternationalizationString.uDeviceNotAssignedRoom;
|
| | | }
|
| | | frameRoomBlack.AddChidren(btnRoomName);
|
| | |
|
| | | //收藏
|
| | |
| | | this.ResponeResult = 0;
|
| | |
|
| | | //先让指定控件不能点击
|
| | | var listSelect = new List<bool>();
|
| | | foreach (var myContr in listControl)
|
| | | {
|
| | | myContr.CanClick = false;
|
| | | listSelect.Add(myContr.IsSelected);
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | int waitime = 30;
|
| | | int waitime = 40;
|
| | | while (waitime > 0)
|
| | | {
|
| | | System.Threading.Thread.Sleep(100);
|
| | |
| | | break;
|
| | | }
|
| | | waitime--;
|
| | | //2秒的时候,还是接受不到的话,强制再次刷新设备状态
|
| | | if (waitime == 20)
|
| | | {
|
| | | //从新发送获取设备的状态(强制)
|
| | | this.device.HadReadDeviceStatu = false;
|
| | | if (this.RowOrCardControl != null)
|
| | | {
|
| | | this.RowOrCardControl.GetType().InvokeMember("SendStatuComand", System.Reflection.BindingFlags.InvokeMethod, null, this.RowOrCardControl, null);
|
| | | }
|
| | | }
|
| | | }
|
| | | if (waitime <= 0)
|
| | | if (waitime <= 0 && this.Parent != null)
|
| | | {
|
| | | //没有获取得到结果
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | var msgContr = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.FAIL));
|
| | | msgContr.Show();
|
| | | //变更回原来的状态
|
| | | for (int i = 0; i < listSelect.Count; i++)
|
| | | {
|
| | | if (listSelect[i] != listControl[i].IsSelected)
|
| | | {
|
| | | listControl[i].IsSelected = listSelect[i];
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | | //开关按钮可以再点击
|
| | |
| | | private void AddDeviceReportEvent()
|
| | | {
|
| | | string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(this.device);
|
| | | //节点反馈
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceDetailCardControl" + mainKeys, ReceiveComandDiv.A节点控制反馈, (report) =>
|
| | | {
|
| | | string mainKey2 = Common.LocalDevice.Current.GetDeviceMainKeys(report);
|
| | | if (mainKeys != mainKey2)
|
| | | {
|
| | | //不是同一个东西
|
| | | return;
|
| | | }
|
| | | //检测结果
|
| | | if (this.CheckResponeResultStatu(ReceiveComandDiv.A节点控制反馈, report) == true)
|
| | | {
|
| | | //结果已经接收到
|
| | | this.ResponeResult = 1;
|
| | | }
|
| | | });
|
| | | //属性上报
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceDetailCardAttribute" + mainKeys, ReceiveComandDiv.A设备属性上报, (report) =>
|
| | | {
|
| | |
| | | public override int FormActionAgainEvent()
|
| | | {
|
| | | //如果不是喜爱房间的话,它的房间有可能被切换了
|
| | | if (this.room.IsLove == false)
|
| | | if (this.nowSelectRoom == null || this.nowSelectRoom.IsLove == false)
|
| | | {
|
| | | this.room = HdlRoomLogic.Current.GetRoomByDevice(this.device);
|
| | | this.nowSelectRoom = HdlRoomLogic.Current.GetRoomByDevice(this.device);
|
| | | }
|
| | | //如果功能类型变更了
|
| | | if (this.nowDeviceFuncType != this.device.DfunctionType)
|
| | |
| | | this.btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(this.device);
|
| | | btnDeviceName.Width = btnDeviceName.GetRealWidthByText();
|
| | | btnDeviceName.Gravity = Gravity.CenterHorizontal;
|
| | |
|
| | | this.btnRoomName.Text = this.room.Name;
|
| | | if (this.nowSelectRoom == null)
|
| | | {
|
| | | //未分配
|
| | | this.btnRoomName.TextID = R.MyInternationalizationString.uDeviceNotAssignedRoom;
|
| | | }
|
| | | else
|
| | | {
|
| | | this.btnRoomName.Text = this.nowSelectRoom.Name;
|
| | | }
|
| | | }
|
| | |
|
| | | return 1;
|
| | |
| | | public override void CloseFormBefore()
|
| | | {
|
| | | string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(this.device);
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceDetailCardControl" + mainKeys);
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceDetailCardAttribute" + mainKeys);
|
| | |
|
| | | //回调函数
|
| | | this.FormCloseEvent?.Invoke(this.device, this.room);
|
| | | this.FormCloseEvent?.Invoke(this.device);
|
| | | this.FormCloseEvent = null;
|
| | |
|
| | | base.CloseFormBefore();
|
| | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 设置PM2.5传感器状态文本(不需要指定【当前两个字】)
|
| | | /// </summary>
|
| | | /// <param name="text"></param>
|
| | | public void SetPmTwoPointFiveStatuText(string text)
|
| | | {
|
| | | this.btnStatu.Text = text;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 重新设置设备名字控件和状态控件的Y轴
|
| | | /// </summary>
|
| | | /// <param name="i_NameY">设备名字控件的Y轴(真实值)</param>
|