| | |
| | | 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);
|
| | |
| | |
|
| | | //刷新界面状态
|
| | | 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; }
|
| | |
| | | {
|
| | | 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
|
| | |
| | | /// </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);
|