| | |
| | |
|
| | | var form = new BottomItemSelectForm();
|
| | | form.AddForm(Language.StringByID(R.MyInternationalizationString.uDirectionSelect), listText, nowSelectNo);
|
| | | form.FinishSelectEvent += async (index) =>
|
| | | form.FinishSelectEvent += (index) =>
|
| | | {
|
| | | //变更方向
|
| | | var result = await HdlDeviceCurtainLogic.Current.SetCurtainDirection(curtainDevice, index == 0 ? false : true);
|
| | | var result = HdlDeviceCurtainLogic.Current.SetCurtainDirection(curtainDevice, index == 0 ? false : true);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | |
| | | frameBack.AddChidren(btnSave);
|
| | | btnSave.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (this.receiveOpenlimit == true)
|
| | | //2020.05.17:追加虚拟住宅可以直接点击
|
| | | if (this.receiveOpenlimit == true || Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | //确认开限位点
|
| | | this.SaveOpenLimit();
|
| | |
| | | //数据变更,百分比
|
| | | curtainData.OpenLimitPersent = value;
|
| | | };
|
| | | //虚拟住宅不需要监听
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | //处理中
|
| | | bool checking = false;
|
| | | while (openSeekBar.Parent != null)
|
| | | {
|
| | | int nowValue = curtainData.OpenLimitPersent;
|
| | | if (oldProValue == nowValue || checking == true)
|
| | | if (oldProValue == nowValue)
|
| | | {
|
| | | //值不等才处理
|
| | | await Task.Delay(500);
|
| | | continue;
|
| | | }
|
| | | oldProValue = nowValue;
|
| | | checking = true;
|
| | |
|
| | | //将窗帘调整到指定百分比
|
| | | this.sendDiv = 1;
|
| | | curtainDevice.WcdGoToTiltValue(nowValue);
|
| | | checking = false;
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | {
|
| | | //确认当前位置为开限位?
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainOpenLimitMsg);
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, async () =>
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, () =>
|
| | | {
|
| | | decimal openValue = ((decimal)curtainData.OpenLimitPersent / 100) * curtainData.CurtainLength;
|
| | | decimal closeValue = ((decimal)curtainData.CloseLimitPersent / 100) * curtainData.CurtainLength;
|
| | | if (openValue < 0) { openValue = 0; }
|
| | | if (closeValue < 0) { closeValue = curtainData.CurtainLength; }
|
| | | //执行确认及覆盖上限位点
|
| | | var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit,
|
| | | (int)openValue, (int)closeValue);
|
| | | var result = HdlDeviceCurtainLogic.Current.SetAutoOpenCurtainLimitPoint(curtainDevice, (int)openValue, (int)closeValue, curtainData.CurtainLength);
|
| | | if (result == true)
|
| | | {
|
| | | this.receiveOpenlimit = false;
|
| | |
| | | frameBack.AddChidren(btnSave);
|
| | | btnSave.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (this.receiveCloseLimit == true)
|
| | | //2020.05.17:追加虚拟住宅可以直接点击
|
| | | if (this.receiveCloseLimit == true || Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | //保存合限位点
|
| | | this.SaveCloseLimit();
|
| | |
| | | //数据变更,百分比
|
| | | curtainData.CloseLimitPersent = value;
|
| | | };
|
| | | //虚拟住宅不需要监听
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | //处理中
|
| | | bool checking = false;
|
| | | while (closeSeekBar.Parent != null)
|
| | | {
|
| | | int nowValue = curtainData.CloseLimitPersent;
|
| | | if (oldProValue == nowValue || checking == true)
|
| | | if (oldProValue == nowValue)
|
| | | {
|
| | | //值不等才处理
|
| | | await Task.Delay(500);
|
| | | continue;
|
| | | }
|
| | | checking = true;
|
| | | oldProValue = nowValue;
|
| | |
|
| | | //将窗帘调整到指定百分比
|
| | | this.sendDiv = 2;
|
| | | curtainDevice.WcdGoToTiltValue(nowValue);
|
| | | checking = false;
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | {
|
| | | //确认当前位置为合限位?
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainCloseLimitMsg);
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, async () =>
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, () =>
|
| | | {
|
| | | decimal openValue = ((decimal)curtainData.OpenLimitPersent / 100) * curtainData.CurtainLength;
|
| | | decimal closeValue = ((decimal)curtainData.CloseLimitPersent / 100) * curtainData.CurtainLength;
|
| | | if (openValue < 0) { openValue = 0; }
|
| | | if (closeValue < 0) { closeValue = curtainData.CurtainLength; }
|
| | | //执行确认及覆盖上限位点
|
| | | var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit,
|
| | | (int)openValue, (int)closeValue);
|
| | | var result = HdlDeviceCurtainLogic.Current.SetAutoOpenCurtainLimitPoint(curtainDevice, (int)openValue, (int)closeValue, curtainData.CurtainLength);
|
| | |
|
| | | if (result == true)
|
| | | {
|
| | |
| | | rowReset.AddBottomLine();
|
| | | rowReset.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //如果当前是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //重置电机将初始化{0}方向与限位设置,确认继续?
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uResetElectricalMachineryMsg);
|
| | | msg = msg.Replace("{0}", "\r\n");
|
| | |
| | | /// <returns></returns>
|
| | | private bool InitCurtainDefultData()
|
| | | {
|
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | this.curtainData = new CurtainData();
|
| | | this.receiveOpenlimit = false;
|
| | | this.receiveCloseLimit = false;
|
| | | this.sendDiv = 0;
|
| | |
|
| | | //如果当前是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | var data = ModelData.DeviceModelDataLogic.Current.GetCurtainLimitPoint(curtainDevice);
|
| | | curtainData.Direction = data.Direction;
|
| | | curtainData.CurtainLength = data.curtainLength;
|
| | | curtainData.OpenLimitValue = data.upLimit;
|
| | | curtainData.CloseLimitValue = data.downLimit;
|
| | | return true;
|
| | | }
|
| | |
|
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | int receiptDataCount = 0;
|
| | | string mainkeys = LocalDevice.Current.GetDeviceMainKeys(curtainDevice);
|
| | |
| | | }
|
| | | //移除监听
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute");
|
| | |
|
| | | //备份窗帘数据
|
| | | if (this.backupCurtainData == true && curtainData.CurtainLength > 0)
|
| | | {
|
| | | this.backupCurtainData = false;
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | //方向备份
|
| | | await HdlDeviceCurtainLogic.Current.BackupCurtainDirection(curtainDevice, curtainData.Direction);
|
| | | //限位备份
|
| | | int uplimit = (int)(curtainData.OpenLimitValue / (curtainData.CurtainLength * 1.0) * 100);
|
| | | int downlimit = (int)(curtainData.CloseLimitValue / (curtainData.CurtainLength * 1.0) * 100);
|
| | | await HdlDeviceCurtainLogic.Current.BackupCurtainLimitPoint(curtainDevice, uplimit, downlimit);
|
| | | });
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|