| | |
| | | /// </summary>
|
| | | public Common.Room nowSelectRoom = null;
|
| | | /// <summary>
|
| | | /// 标记它是由哪个控件调起的
|
| | | /// </summary>
|
| | | public ViewGroup RowOrCardControl = null;
|
| | | /// <summary>
|
| | | /// 状态控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnStatu = null;
|
| | |
| | | /// <summary>
|
| | | /// 是否获取网关反馈的结果 0:没有获取得到 1:已经获取得到
|
| | | /// </summary>
|
| | | private int ResponeResult = 0;
|
| | | public int ResponeResult = 0;
|
| | | /// <summary>
|
| | | /// 当前端点的功能类型
|
| | | /// </summary>
|
| | |
| | | btnMore.InitControl();
|
| | | btnMore.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var detailInfo = new DeviceDetailInfoForm();
|
| | | detailInfo.AddForm(device, nowSelectRoom);
|
| | | //获取设备属于【晾衣架】
|
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice> { device });
|
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.Airer)
|
| | | {
|
| | | var form = new Shared.Phone.UserCenter.Device.DeviceFunctionSettionForm();
|
| | | form.AddForm(device, true);
|
| | | }
|
| | | else
|
| | | {
|
| | | var detailInfo = new DeviceDetailInfoForm();
|
| | | detailInfo.AddForm(device, nowSelectRoom);
|
| | | }
|
| | |
|
| | | };
|
| | |
|
| | | //初始化中部信息
|
| | |
| | | frameWhiteBack.Gravity = Gravity.CenterHorizontal;
|
| | | bodyFrameLayout.AddChidren(frameWhiteBack);
|
| | |
|
| | | if (this.device.Type == DeviceType.TemperatureSensor)
|
| | | {
|
| | | //获取设备类型
|
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | | //空气质量传感器 ,卡片比较大
|
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
|
| | | {
|
| | | frameWhiteBack.Y = Application.GetRealHeight(98);
|
| | | }
|
| | | }
|
| | |
|
| | | //设备名称
|
| | | this.btnDeviceName = new NormalViewControl(100, 60, true);
|
| | | btnDeviceName.Y = Application.GetRealHeight(46);
|
| | |
| | | frameRoomBlack.Height = Application.GetRealHeight(138);
|
| | | frameRoomBlack.Width = frameWhiteBack.Width;
|
| | | frameRoomBlack.BackgroundColor = 0xff232323;
|
| | | frameRoomBlack.Radius= (uint)Application.GetRealHeight(17);
|
| | | frameRoomBlack.Radius = (uint)Application.GetRealHeight(17);
|
| | | frameRoomBlack.Gravity = Gravity.BottomCenter;
|
| | | frameWhiteBack.AddChidren(frameRoomBlack);
|
| | |
|
| | |
| | | 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) =>
|
| | | {
|
| | | string mainKey2 = Common.LocalDevice.Current.GetDeviceMainKeys(report);
|
| | | if (mainKeys != mainKey2)
|
| | |
|
| | | if (this.device.Type == DeviceType.Airer && this.device.DeviceAddr == report.DeviceAddr)
|
| | | {
|
| | | //不是同一个东西
|
| | | return;
|
| | | //晾衣架特殊:5个回路代表不同的功能,但是默认本地只显示了第一个回路
|
| | | //所以条件特殊判断
|
| | | //检测结果
|
| | | if (this.CheckResponeResultStatu(ReceiveComandDiv.A设备属性上报, report) == true)
|
| | | {
|
| | | //结果已经接收到
|
| | | this.ResponeResult = 1;
|
| | | }
|
| | | }
|
| | | //检测结果
|
| | | if (this.CheckResponeResultStatu(ReceiveComandDiv.A设备属性上报, report) == true)
|
| | | else
|
| | | {
|
| | | //结果已经接收到
|
| | | this.ResponeResult = 1;
|
| | | if (mainKeys != mainKey2)
|
| | | {
|
| | | //不是同一个东西
|
| | | return;
|
| | | }
|
| | | //检测结果
|
| | | if (this.CheckResponeResultStatu(ReceiveComandDiv.A设备属性上报, report) == true)
|
| | | {
|
| | | //结果已经接收到
|
| | | this.ResponeResult = 1;
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | public override void CloseFormBefore()
|
| | | {
|
| | | string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(this.device);
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceDetailCardControl" + mainKeys);
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceDetailCardAttribute" + mainKeys);
|
| | |
|
| | | //回调函数
|