wei
2021-03-04 2ae36ddb40d28c62b64a2fdd4c3033e7d65d5cfb
HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaFanPage.cs
old mode 100755 new mode 100644
@@ -78,6 +78,8 @@
            seekBarContr.MinValue = 1;
            seekBarContr.MaxValue = 15;
            FrameWhiteCentet1.AddChidren(seekBarContr);
            seekBarContr.Progress = this.fanData.SpeedLevel;
            this.btnNowGear.Text = this.fanData.SpeedLevel + Language.StringByID(StringId.Gear);
            //开关图标
            this.btnSwitch = new IconViewControl(40);
@@ -94,14 +96,10 @@
            //刷新界面状态
            this.RefreshFormStatu(false);
            int oldProgressValue = fanData.SpeedLevel;
            int nowProgressValue = fanData.SpeedLevel;
            //档
            var strView = Language.StringByID(StringId.Gear);
            seekBarContr.ProgressChangedEvent += (div, value) =>
            {
                nowProgressValue = value;
                this.btnNowGear.Text = value + strView;
                //滑动中
                if (div == 0) { this.fanData.IsProgressing = true; }
@@ -110,28 +108,10 @@
                {
                    this.fanData.IsProgressing = false;
                    this.fanData.ProgressEndTime = DateTime.Now;
                    //发送风速命令
                    this.SendSpeedComand(value);
                }
            };
            HdlThreadLogic.Current.RunThread(() =>
            {
                while (this.Parent != null)
                {
                    if (nowProgressValue != oldProgressValue)
                    {
                        //发送风速命令
                        this.SendSpeedComand(nowProgressValue);
                        oldProgressValue = nowProgressValue;
                    }
                    System.Threading.Thread.Sleep(1000);
                }
                //界面关闭时
                if (nowProgressValue != oldProgressValue)
                {
                    //发送风速命令
                    this.SendSpeedComand(nowProgressValue);
                }
            });
        }
        #endregion
@@ -229,14 +209,15 @@
        /// </summary>
        private void RefreshNowDeviceStatuMemory(Function i_LocalDevice)
        {
            foreach (var data in i_LocalDevice.attributes)
            for (int i = 0; i < i_LocalDevice.attributes.Count; i++)
            {
                var data = i_LocalDevice.attributes[i];
                //开关
                if (data.key == "on_off") { this.fanData.Open = data.realValue == "on"; }
                if (data.key == "on_off") { this.fanData.Open = data.state == "on"; }
                //风速档位
                else if (data.key == "fan_speed_percent")
                {
                    var value = data.realValue;
                    var value = data.state;
                    if (value != string.Empty)
                    {
                        this.fanData.SpeedLevel = Convert.ToInt32(value);