| | |
| | | { |
| | | bodyView.dimmerBar.Progress = uFunction.brightness; |
| | | } |
| | | bodyView.dimmerBar.ProgressBarColor = uFunction.trait_on_off.curValue.ToString() == "on" ? CSS.CSS_Color.AuxiliaryColor1 : CSS.CSS_Color.PromptingColor2; |
| | | bodyView.btnSwitch.IsSelected = uFunction.trait_on_off.curValue.ToString() == "on"; |
| | | bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.light.GetRGBcolor()); |
| | | if (uFunction.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | bodyView.colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheel.png"; |
| | | bodyView.dimmerBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1; |
| | | bodyView.btnSwitch.IsSelected = true; |
| | | bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.light.GetRGBcolor()); |
| | | } |
| | | else |
| | | { |
| | | bodyView.colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png"; |
| | | bodyView.dimmerBar.ProgressBarColor = CSS.CSS_Color.PromptingColor2; |
| | | bodyView.btnSwitch.IsSelected = false; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | DateTime colorChangeTime = DateTime.MinValue; |
| | | colorPicker.ColorChaged += (sender2, e2) => { |
| | | if(light.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | | if ((DateTime.Now - colorChangeTime).TotalMilliseconds > 200) |
| | | { |
| | | light.SetRGBcolor(e2); |
| | |
| | | onDimmerBar = true; |
| | | }; |
| | | dimmerBar.OnStopTrackingTouchEvent = (sender, e) => { |
| | | onDimmerBar = false; |
| | | new System.Threading.Thread(() => { |
| | | System.Threading.Thread.Sleep(100); |
| | | onDimmerBar = false; |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | light.brightness = dimmerBar.Progress; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); |
| | | Control.Ins.SendWriteCommand(light, d); |
| | | light.fadeTime = barFadeTime.Progress; |
| | | //Control.Send(CommandType_A.write, light); |
| | | }; |
| | | dimmerBar.OnProgressChangedEvent = (sender, e) => { |
| | | light.fadeTime = 0; |
| | |
| | | /// </summary> |
| | | void LoadEvet_ChangeFadeTime() |
| | | { |
| | | barFadeTime.OnProgressChangedEvent = (sender, e) => |
| | | barFadeTime.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | light.fadeTime = e; |
| | | light.fadeTime = barFadeTime.Progress; |
| | | light.SaveFunctionData(true); |
| | | }; |
| | | } |
| | |
| | | light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, light.trait_on_off.curValue.ToString()); |
| | | if (btnSwitch.IsSelected) |
| | | { |
| | | d.Add(FunctionAttributeKey.Brightness, light.lastBrightness.ToString()); |
| | | } |
| | | else |
| | | { |
| | | light.lastBrightness = light.brightness; |
| | | } |
| | | Control.Ins.SendWriteCommand(light, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |