| | |
| | | seekBarColor.SeekBarPadding = Application.GetRealWidth(60);
|
| | | seekBarColor.IsProgressTextShow = true;
|
| | | seekBarColor.ProgressBarColor = UserCenterColor.Current.Transparent;
|
| | | seekBarColor.ProgressBarUnEnableColor = UserCenterColor.Current.Transparent;
|
| | | seekBarColor.SeekBarBackgroundColor = UserCenterColor.Current.Transparent;
|
| | | seekBarColor.ProgressTextSize = 14;
|
| | | seekBarColor.ProgressTextColor = UserCenterColor.Current.TextGrayColor2;
|
| | |
| | | this.btnBuzzerSwitch = new IconBigViewControl(81, 81);
|
| | | btnBuzzerSwitch.UnSelectedImagePath = "Item/Switch.png";
|
| | | btnBuzzerSwitch.SelectedImagePath = "Item/SwitchSelected.png";
|
| | | btnBuzzerSwitch.IsSelected = ((ColorTemperatureLight)this.device).IsBuzzerRing;
|
| | | frameWhiteBack.AddChidren(btnBuzzerSwitch);
|
| | | btnBuzzerSwitch.InitControl();
|
| | | btnBuzzerSwitch.UseClickStatu = false;
|
| | |
| | | };
|
| | | btnMiniSwitch.IsSelected = ((LightBase)this.device).OnOffStatus == 1;
|
| | | this.canSetProgressValue = btnMiniSwitch.IsSelected;
|
| | | if (btnMiniSwitch.IsSelected == false)
|
| | | {
|
| | | //在没有打开夜灯开关之前,不允许滑动
|
| | | seekBarLight.Enable = false;
|
| | | seekBarColor.Enable = false;
|
| | | }
|
| | |
|
| | | //亮度开始滑动的事件
|
| | | seekBarLight.OnStartTrackingTouchEvent += (sender, e) =>
|
| | |
| | | {
|
| | | //当是打开状态时,网关说它会默认把亮度变成100%
|
| | | //以防万一,这里再次读取一下
|
| | | ((ColorTemperatureLight)device).ReadLevel();
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | ((ColorTemperatureLight)device).ReadLevel();
|
| | | System.Threading.Thread.Sleep(300);
|
| | | ((ColorTemperatureLight)device).ReadColorTemperature();
|
| | | });
|
| | |
|
| | | }
|
| | | }
|
| | | });
|
| | |
| | | //如果住宅是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | //((LightBase)this.device).OnOffStatus = isOpen == true ? 1 : 0;
|
| | | ////刷新开关状态
|
| | | //this.RefreshSwitchStatu(isOpen);
|
| | | ((ColorTemperatureLight)this.device).IsBuzzerRing = isOpen;
|
| | | //刷新开关状态
|
| | | this.RefreshSwitchStatu(isOpen);
|
| | | return;
|
| | | }
|
| | |
|
| | | //检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息
|
| | | this.StartCheckResponeResult(new List<ButtonBase> { this.btnBuzzerSwitch.btnIcon }, (result) =>
|
| | | this.btnBuzzerSwitch.CanClick = false;
|
| | | this.StartCheckResponeResult(new List<ButtonBase>(), (result) =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //接收到网关回复
|
| | | if (result == true)
|
| | | {
|
| | | this.btnBuzzerSwitch.IsSelected = isOpen;
|
| | | //bool statu = ((LightBase)this.device).OnOffStatus == 1;
|
| | | ////刷新开关状态
|
| | | //this.RefreshSwitchStatu(statu);
|
| | | }
|
| | | this.btnBuzzerSwitch.CanClick = true;
|
| | | });
|
| | | });
|
| | | //发送命令
|
| | |
| | | /// <param name="isOpen">打开状态</param>
|
| | | private void RefreshSwitchStatu(bool isOpen)
|
| | | {
|
| | | if (this.isColorProgressing == true)
|
| | | //刷新蜂鸣器开关状态
|
| | | bool isBuzzerRing = ((ColorTemperatureLight)this.device).IsBuzzerRing;
|
| | | if (this.btnBuzzerSwitch.IsSelected != isBuzzerRing)
|
| | | {
|
| | | //如果是色温滑动的话,不需要刷新界面
|
| | | return;
|
| | | this.btnBuzzerSwitch.IsSelected = isBuzzerRing;
|
| | | }
|
| | |
|
| | | if (isOpen == true)
|
| | | {
|
| | | //亮度是必须要刷新的 亮度 XX
|
| | |
| | | //当进度值在手动变更中时,不接收推送
|
| | | seekBarColor.Progress = (int)(((ColorTemperatureLight)this.device).ColorTemperature / 100);
|
| | | }
|
| | | this.btnMiniSwitch.IsSelected = true;
|
| | | if (this.btnMiniSwitch.IsSelected == false)
|
| | | {
|
| | | this.btnMiniSwitch.IsSelected = true;
|
| | | }
|
| | | //滑动条可以滑动
|
| | | seekBarLight.Enable = true;
|
| | | seekBarColor.Enable = true;
|
| | | }
|
| | | else
|
| | | {
|
| | | //变更字样:关闭
|
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close));
|
| | | this.btnMiniSwitch.IsSelected = false;
|
| | | if (this.btnMiniSwitch.IsSelected == true)
|
| | | {
|
| | | this.btnMiniSwitch.IsSelected = false;
|
| | | }
|
| | | //滑动条不可以滑动
|
| | | seekBarLight.Enable = false;
|
| | | seekBarColor.Enable = false;
|
| | | }
|
| | |
|
| | | //回复的结果说,处于打开状态才能发送
|