| | |
| | | /// 列表控件
|
| | | /// </summary>
|
| | | private VerticalListControl listView = null;
|
| | | /// <summary>
|
| | | /// 开限位的进度条
|
| | | /// </summary>
|
| | | private HorizontalSeekBar openSeekBar = null;
|
| | | /// <summary>
|
| | | /// 合限位的进度条
|
| | | /// </summary>
|
| | | private HorizontalSeekBar closeSeekBar = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | listText.Add(Language.StringByID(R.MyInternationalizationString.uForwardDirection));//正向
|
| | | listText.Add(Language.StringByID(R.MyInternationalizationString.uReverseDirection));//反向
|
| | |
|
| | | var form = new BottomDialogSelectForm();
|
| | | var form = new BottomItemSelectForm();
|
| | | form.AddForm(Language.StringByID(R.MyInternationalizationString.uDirectionSelect), listText, nowSelectNo);
|
| | | form.FinishSelectEvent += async (index) =>
|
| | | {
|
| | |
| | | btnProgress1.Text = progressValue + "%";
|
| | | frameBack.AddChidren(btnProgress1);
|
| | | //进度条
|
| | | var seekBar = new HorizontalSeekBar();
|
| | | seekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46);
|
| | | seekBar.Gravity = Gravity.CenterHorizontal;
|
| | | seekBar.Width = Application.GetRealWidth(962);
|
| | | seekBar.Height = Application.GetRealHeight(84);
|
| | | seekBar.Max = 100;
|
| | | seekBar.BackgroundColor = 0xfff5f5f5;
|
| | | seekBar.ThumbColor = Common.ZigbeeColor.Current.GXCButtonBlueColor;
|
| | | seekBar.ProgressColor = 0xff288bfd;
|
| | | seekBar.Progress = progressValue;
|
| | | frameBack.AddChidren(seekBar);
|
| | | this.openSeekBar = new HorizontalSeekBar();
|
| | | openSeekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46);
|
| | | openSeekBar.Gravity = Gravity.CenterHorizontal;
|
| | | openSeekBar.Width = Application.GetRealWidth(962);
|
| | | openSeekBar.Height = Application.GetRealHeight(84);
|
| | | openSeekBar.Max = 100;
|
| | | openSeekBar.BackgroundColor = 0xfff5f5f5;
|
| | | openSeekBar.ThumbColor = Common.ZigbeeColor.Current.GXCButtonBlueColor;
|
| | | openSeekBar.ProgressColor = 0xff288bfd;
|
| | | openSeekBar.Progress = progressValue;
|
| | | frameBack.AddChidren(openSeekBar);
|
| | |
|
| | | var btnTemp1 = new NormalViewControl(200, 50, true);
|
| | | btnTemp1.X = ControlCommonResourse.XXLeft;
|
| | |
| | | int waitTime = 4;//500毫秒为单位
|
| | | bool startWait = false;
|
| | | bool checking = false;
|
| | | seekBar.ProgressChanged += (sender, value) =>
|
| | | openSeekBar.ProgressChanged += (sender, value) =>
|
| | | {
|
| | | //值继续改变,则等待时间还原
|
| | | waitTime = 4;
|
| | | //开限位不能大于合限位
|
| | | if (value > closeSeekBar.Progress)
|
| | | {
|
| | | openSeekBar.Progress = closeSeekBar.Progress;
|
| | | return;
|
| | | }
|
| | | if (checking == false)
|
| | | {
|
| | | startWait = true;
|
| | |
| | | };
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | while (seekBar.Parent != null)
|
| | | while (openSeekBar.Parent != null)
|
| | | {
|
| | | if (startWait == false)
|
| | | {
|
| | |
| | | startWait = false;
|
| | | checking = true;
|
| | |
|
| | | var value = seekBar.Progress;
|
| | | var value = curtainData.OpenLimitPersent;
|
| | | if (oldValue == value)
|
| | | {
|
| | | //相同数值
|
| | |
| | | }
|
| | | }
|
| | | });
|
| | | |
| | | //var oldTime = DateTime.Now;
|
| | | //var oldValue = 0;
|
| | | //seekBar.MouseUpEventHandler += async (sender, e) =>
|
| | | //{
|
| | | // if ((DateTime.Now - oldTime).TotalSeconds <= 1)
|
| | | // {
|
| | | // //最少需要2秒间隔
|
| | | // return;
|
| | | // }
|
| | | // var value = seekBar.Progress;
|
| | | // if (oldValue == value)
|
| | | // {
|
| | | // //相同数值
|
| | | // return;
|
| | | // }
|
| | | // oldValue = value;
|
| | | // oldTime = DateTime.Now;
|
| | |
|
| | | // if (curtainData.DeleteOpenLimit == true)
|
| | | // {
|
| | | // //重置开限位点
|
| | | // var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.UpLimit);
|
| | | // if (result == false)
|
| | | // {
|
| | | // return;
|
| | | // }
|
| | | // curtainData.DeleteOpenLimit = false;
|
| | | // }
|
| | | // receiveUplimit = "1";
|
| | | // //将窗帘调整到指定百分比
|
| | | // curtainDevice.WcdGoToTiltValue(value);
|
| | | //};
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | btnProgress1.Text = progressValue + "%";
|
| | | frameBack.AddChidren(btnProgress1);
|
| | | //进度条
|
| | | var seekBar = new HorizontalSeekBar();
|
| | | seekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46);
|
| | | seekBar.Gravity = Gravity.CenterHorizontal;
|
| | | seekBar.Width = Application.GetRealWidth(962);
|
| | | seekBar.Height = Application.GetRealHeight(84);
|
| | | seekBar.Max = 100;
|
| | | seekBar.BackgroundColor = 0xfff5f5f5;
|
| | | seekBar.ThumbColor = Common.ZigbeeColor.Current.GXCButtonBlueColor;
|
| | | seekBar.ProgressColor = 0xff288bfd;
|
| | | seekBar.Progress = progressValue;
|
| | | frameBack.AddChidren(seekBar);
|
| | | this.closeSeekBar = new HorizontalSeekBar();
|
| | | closeSeekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46);
|
| | | closeSeekBar.Gravity = Gravity.CenterHorizontal;
|
| | | closeSeekBar.Width = Application.GetRealWidth(962);
|
| | | closeSeekBar.Height = Application.GetRealHeight(84);
|
| | | closeSeekBar.Max = 100;
|
| | | closeSeekBar.BackgroundColor = 0xfff5f5f5;
|
| | | closeSeekBar.ThumbColor = Common.ZigbeeColor.Current.GXCButtonBlueColor;
|
| | | closeSeekBar.ProgressColor = 0xff288bfd;
|
| | | closeSeekBar.Progress = progressValue;
|
| | | frameBack.AddChidren(closeSeekBar);
|
| | |
|
| | | var btnTemp1 = new NormalViewControl(200, 50, true);
|
| | | btnTemp1.X = ControlCommonResourse.XXLeft;
|
| | |
| | | int waitTime = 4;//500毫秒为单位
|
| | | bool startWait = false;
|
| | | bool checking = false;
|
| | | seekBar.ProgressChanged += (sender, value) =>
|
| | | closeSeekBar.ProgressChanged += (sender, value) =>
|
| | | {
|
| | | //值继续改变,则等待时间还原
|
| | | waitTime = 4;
|
| | | //合限位不能小于合限位
|
| | | if (value < openSeekBar.Progress)
|
| | | {
|
| | | closeSeekBar.Progress = openSeekBar.Progress;
|
| | | return;
|
| | | }
|
| | | if (checking == false)
|
| | | {
|
| | | startWait = true;
|
| | |
| | | };
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | while (seekBar.Parent != null)
|
| | | while (closeSeekBar.Parent != null)
|
| | | {
|
| | | if (startWait == false)
|
| | | {
|
| | |
| | | startWait = false;
|
| | | checking = true;
|
| | |
|
| | | var value = seekBar.Progress;
|
| | | var value = curtainData.CloseLimitPersent;
|
| | | if (oldValue == value)
|
| | | {
|
| | | //相同数值
|
| | |
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | //var oldTime = DateTime.Now;
|
| | | //var oldValue = 0;
|
| | | //seekBar.MouseUpEventHandler += async (sender, e) =>
|
| | | //{
|
| | | // if ((DateTime.Now - oldTime).TotalSeconds <= 1)
|
| | | // {
|
| | | // //最少需要2秒间隔
|
| | | // return;
|
| | | // }
|
| | | // var value = seekBar.Progress;
|
| | | // if (oldValue == value)
|
| | | // {
|
| | | // //相同数值
|
| | | // return;
|
| | | // }
|
| | | // oldValue = value;
|
| | | // oldTime = DateTime.Now;
|
| | |
|
| | | // if (curtainData.DeleteCloseLimit == true)
|
| | | // {
|
| | | // //重置合限位点
|
| | | // var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.DownLimit);
|
| | | // if (result == false)
|
| | | // {
|
| | | // return;
|
| | | // }
|
| | | // curtainData.DeleteCloseLimit = false;
|
| | | // }
|
| | | // receiveDownLimit = "1";
|
| | | // //将窗帘调整到指定百分比
|
| | | // curtainDevice.WcdGoToTiltValue(value);
|
| | | //};
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | |
|
| | | bool receiptData = false;
|
| | | string mainkeys = LocalDevice.Current.GetDeviceMainKeys(curtainDevice);
|
| | | HdlDeviceAttributeLogic.Current.AddAttributeEvent("CurtainDeviceAttribute", "DeviceStatusReport", (device) =>
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("CurtainDeviceAttribute", ReceiveComandDiv.A设备属性上报, (device) =>
|
| | | {
|
| | | string checkKey = LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | if (mainkeys != checkKey || device.DeviceStatusReport.CluterID != 258)
|
| | |
| | | return false;
|
| | | }
|
| | | //移除监听
|
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("CurtainDeviceAttribute");
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute");
|
| | |
|
| | | //备份窗帘数据
|
| | | if (this.backupCurtainData == true)
|
| | |
| | | /// </summary>
|
| | | private void ReceiveLimitData()
|
| | | {
|
| | | if (HdlDeviceAttributeLogic.Current.IsEsixt("ReceiveLimitData") == true)
|
| | | if (HdlGatewayReceiveLogic.Current.IsEsixt("ReceiveLimitData") == true)
|
| | | {
|
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("ReceiveLimitData");
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("ReceiveLimitData");
|
| | | }
|
| | | string mainkeys = LocalDevice.Current.GetDeviceMainKeys(curtainDevice);
|
| | | HdlDeviceAttributeLogic.Current.AddAttributeEvent("ReceiveLimitData", "DeviceStatusReport", (device) =>
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("ReceiveLimitData", ReceiveComandDiv.A设备属性上报, (device) =>
|
| | | {
|
| | | string checkKey = LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | if (mainkeys != checkKey || device.DeviceStatusReport.CluterID != 258)
|
| | |
| | | if (receiveUplimit == "1")
|
| | | {
|
| | | receiveUplimit = "0";
|
| | | openSeekBar.Progress = curtainData.OpenLimitPersent;
|
| | | //确认当前位置{0}为开限位?
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainOpenLimitMsg);
|
| | | msg = msg.Replace("{0}", curtainData.OpenLimitPersent + "%");
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, async () =>
|
| | | {
|
| | | //执行确认及覆盖上限位点
|
| | | await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit,
|
| | | var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit,
|
| | | curtainData.OpenLimitPersent, curtainData.CloseLimitPersent);
|
| | | if (result == true)
|
| | | {
|
| | | curtainData.DeleteOpenLimit = true;
|
| | | }
|
| | | });
|
| | | }
|
| | | //合限位
|
| | | else if (receiveDownLimit == "1")
|
| | | {
|
| | | receiveDownLimit = "0";
|
| | | closeSeekBar.Progress = curtainData.CloseLimitPersent;
|
| | | //确认当前位置{0}为合限位?
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainCloseLimitMsg);
|
| | | msg = msg.Replace("{0}", curtainData.CloseLimitPersent + "%");
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, async () =>
|
| | | {
|
| | | //执行确认及覆盖合限位点
|
| | | await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit,
|
| | | var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit,
|
| | | curtainData.OpenLimitPersent, curtainData.CloseLimitPersent);
|
| | | if (result == true)
|
| | | {
|
| | | curtainData.DeleteCloseLimit = true;
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | |
| | | /// <summary>
|
| | | /// 界面关闭
|
| | | /// </summary>
|
| | | public override void CloseForm()
|
| | | public override void CloseFormBefore()
|
| | | {
|
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("CurtainDeviceAttribute");
|
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("ReceiveLimitData");
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute");
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("ReceiveLimitData");
|
| | |
|
| | | UserView.HomePage.Instance.ScrollEnabled = true;
|
| | |
|
| | | base.CloseForm();
|
| | | base.CloseFormBefore();
|
| | | }
|
| | |
|
| | | #endregion
|