| | |
| | | /// <param name="i_listdevice">窗帘的回路</param>
|
| | | public void ShowForm(Rollershade i_CurtainDevice)
|
| | | {
|
| | | UserView.HomePage.Instance.ScrollEnabled = false;
|
| | | this.ScrollEnabled = false;
|
| | |
|
| | | this.curtainDevice = i_CurtainDevice;
|
| | |
|
| | |
| | | listView.Height = bodyFrameLayout.Height;
|
| | | bodyFrameLayout.AddChidren(listView);
|
| | |
|
| | | //导轨长度为0时
|
| | | if (curtainData.CurtainLength <= 0)
|
| | | {
|
| | | //电机数据异常,请重置电机
|
| | | this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uCurtainDataIsErrorPleaseResetCurtain));
|
| | | try
|
| | | {
|
| | | //设备异常补救 -> 添加重置电机行
|
| | | this.AddElectricalMachineryRow();
|
| | | return;
|
| | | }
|
| | | catch (Exception ex2) |
| | | {
|
| | | HdlLogLogic.Current.WriteLog(ex2, "开合帘补救异常1");
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | try
|
| | | {
|
| | | //添加方向行
|
| | |
| | | //设备异常补救 -> 添加重置电机行
|
| | | this.AddElectricalMachineryRow();
|
| | | }
|
| | | catch (Exception ex2) { HdlLogLogic.Current.WriteLog(ex2, "开合帘补救异常"); }
|
| | | catch (Exception ex2) { HdlLogLogic.Current.WriteLog(ex2, "开合帘补救异常2"); }
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | frameBack.AddChidren(btnProgressView);
|
| | |
|
| | | int progressValue = (int)(curtainData.OpenLimitValue / (curtainData.CurtainLength * 1.0) * 100);
|
| | | //设置百分比的初始值
|
| | | curtainData.OpenLimitPersent = progressValue;
|
| | | var btnProgress1 = new NormalViewControl(200, 50, true);
|
| | | btnProgress1.X = Application.GetRealWidth(200);
|
| | | btnProgress1.Y = btnProgressView.Y;
|
| | |
| | | frameBack.AddChidren(btnProgressView);
|
| | |
|
| | | int progressValue = (int)(curtainData.CloseLimitValue / (curtainData.CurtainLength * 1.0) * 100);
|
| | | //设置百分比的初始值
|
| | | curtainData.CloseLimitPersent = progressValue;
|
| | | var btnProgress1 = new NormalViewControl(200, 50, true);
|
| | | btnProgress1.X = Application.GetRealWidth(200);
|
| | | btnProgress1.Y = btnProgressView.Y;
|
| | |
| | | this.receiveCloseLimit = false;
|
| | | this.sendDiv = 0;
|
| | |
|
| | | bool receiptData = false;
|
| | | int receiptDataCount = 0;
|
| | | string mainkeys = LocalDevice.Current.GetDeviceMainKeys(curtainDevice);
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("CurtainDeviceAttribute", ReceiveComandDiv.A设备属性上报, (device) =>
|
| | | {
|
| | |
| | | //正向
|
| | | curtainData.Direction = false;
|
| | | }
|
| | | receiptDataCount++;
|
| | | }
|
| | | else if (attriBute.AttributeId == 1)
|
| | | {
|
| | | //窗帘总长
|
| | | curtainData.CurtainLength = attriBute.AttriButeData;
|
| | | receiptDataCount++;
|
| | | }
|
| | | else if (attriBute.AttributeId == 16)
|
| | | {
|
| | | //开限位
|
| | | curtainData.OpenLimitValue = attriBute.AttriButeData;
|
| | | receiptDataCount++;
|
| | | }
|
| | | else if (attriBute.AttributeId == 17)
|
| | | {
|
| | | //合限位
|
| | | curtainData.CloseLimitValue = attriBute.AttriButeData;
|
| | | //数据接收结束
|
| | | receiptData = true;
|
| | | receiptDataCount++;
|
| | | }
|
| | | }
|
| | | });
|
| | |
| | | HdlDeviceCurtainLogic.Current.SetGetCurtainLimitSettionComand(curtainDevice);
|
| | |
|
| | | int timeCount = 30;
|
| | | while (receiptData == false && timeCount >= 0)
|
| | | while (receiptDataCount != 4 && timeCount >= 0)
|
| | | {
|
| | | System.Threading.Thread.Sleep(100);
|
| | | timeCount--;
|
| | |
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute");
|
| | |
|
| | | //备份窗帘数据
|
| | | if (this.backupCurtainData == true)
|
| | | if (this.backupCurtainData == true && curtainData.CurtainLength > 0)
|
| | | {
|
| | | this.backupCurtainData = false;
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | |
| | | {
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute");
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("ReceiveLimitData");
|
| | |
|
| | | UserView.HomePage.Instance.ScrollEnabled = true;
|
| | |
|
| | | base.CloseFormBefore();
|
| | | }
|