| | |
| | | /// </summary> |
| | | void LoadEvent_LightDimming(DiyImageSeekBar dimmerControlBar) |
| | | { |
| | | //if (function.functionType == FunctionType.Dimmer || function.functionType == FunctionType.RGB) |
| | | //{ |
| | | // if (dimmerControlBar == null) |
| | | // return; |
| | | // var light = function as Light; |
| | | // dimmerControlBar.OnProgressChangedEvent += (sender, e) => |
| | | // { |
| | | // if ((DateTime.Now - light.refreshTime).TotalMilliseconds > 200)//调光命令发送间隔事件 |
| | | // { |
| | | // new System.Threading.Thread(() => |
| | | // { |
| | | // light.refreshTime = DateTime.Now; |
| | | // light.brightness = e; |
| | | // Control.Send(CommandType_A.write, function); |
| | | // }) |
| | | // { IsBackground = true }.Start(); |
| | | // } |
| | | // }; |
| | | // dimmerControlBar.OnStopTrackingTouchEvent += (sender, e) => |
| | | // { |
| | | // light.brightness = dimmerControlBar.Progress; |
| | | // Control.Send(CommandType_A.write, function); |
| | | // }; |
| | | //} |
| | | if (function.functionType == FunctionType.Dimmer || function.functionType == FunctionType.RGB) |
| | | { |
| | | if (dimmerControlBar == null) |
| | | return; |
| | | |
| | | var light = function as Light; |
| | | dimmerControlBar.OnProgressChangedEvent += (sender, e) => |
| | | dimmerControlBar.OnStartTrackingTouchEvent = (sender, e) => { |
| | | onDimmerBar = true; |
| | | }; |
| | | dimmerControlBar.OnStopTrackingTouchEvent = (sender, e) => { |
| | | onDimmerBar = false; |
| | | light.brightness = dimmerControlBar.Progress; |
| | | Control.Send(CommandType_A.write, light); |
| | | }; |
| | | dimmerControlBar.OnProgressChangedEvent = (sender, e) => { |
| | | light.brightness = e; |
| | | light.on_off = e > 0 ? "on" : "off"; |
| | | |
| | | if (e == 0 || e == 100) |
| | | { |
| | | if ((DateTime.Now - light.refreshTime).TotalMilliseconds > 200)//调光命令发送间隔事件 |
| | | Control.Send(CommandType_A.write, light); |
| | | } |
| | | else |
| | | { |
| | | new System.Threading.Thread(() => |
| | | if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds) |
| | | { |
| | | light.refreshTime = DateTime.Now; |
| | | light.brightness = e; |
| | | Control.Send(CommandType_A.write, function); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Control.Send(CommandType_A.write, light); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | }; |
| | | dimmerControlBar.OnStopTrackingTouchEvent += (sender, e) => |
| | | else |
| | | { |
| | | light.brightness = dimmerControlBar.Progress; |
| | | Control.Send(CommandType_A.write, function); |
| | | }; |
| | | MainPage.Log("skip dimmer control!!"); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | |