| | |
| | | } |
| | | LoadFunctionRow(onOffStatus); |
| | | |
| | | if (sceneFunction.localFunction.spk == SPK.LightRGB) |
| | | if (sceneFunction.localFunction.spk == SPK.LightRGB || sceneFunction.localFunction.spk == SPK.GroupControl) |
| | | { |
| | | var colorfulStatus = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful); |
| | | if (colorfulStatus != null) |
| | | { |
| | | isColorful = true; |
| | | LoadColorfulRow(colorfulStatus); |
| | | } |
| | | //var colorfulStatus = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful); |
| | | //if (colorfulStatus != null) |
| | | //{ |
| | | // isColorful = true; |
| | | // LoadColorfulRow(colorfulStatus); |
| | | // isColorful = colorfulStatus.value == "on"; |
| | | //} |
| | | } |
| | | foreach (var attr in sceneFunction.status) |
| | | { |
| | |
| | | |
| | | btnConfrim.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (isOnStatus) |
| | | { |
| | | |
| | | if (sceneFunction.localFunction.spk == SPK.GroupControl) { |
| | | var colorBegin = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.ColorfulBegin); |
| | | if (colorBegin != null) |
| | | { |
| | | sceneFunction.status.Remove(colorBegin); |
| | | } |
| | | var colorEnd = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.ColorfulEnd); |
| | | if (colorEnd != null) |
| | | { |
| | | sceneFunction.status.Remove(colorEnd); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (isColorful) { } else { } |
| | | sceneFunction.status.Clear(); |
| | | sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.OnOff, value = "off" }); |
| | | if (isOnStatus) |
| | | { |
| | | if (isColorful) |
| | | { |
| | | sceneFunction.status.Clear(); |
| | | sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.OnOff, value = "on" }); |
| | | sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.Colorful, value = "on" }); |
| | | } |
| | | else |
| | | { |
| | | var isHasColorful = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful); |
| | | if (isHasColorful != null) |
| | | { |
| | | sceneFunction.status.Remove(isHasColorful); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sceneFunction.status.Clear(); |
| | | sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.OnOff, value = "off" }); |
| | | } |
| | | } |
| | | |
| | | var temp = scene.functions.Find((obj) => obj.sid == sceneFunction.sid); |
| | | |
| | | if (temp != null) |
| | |
| | | this.RemoveFromParent(); |
| | | } |
| | | }; |
| | | |
| | | |
| | | UpdataFunctionRow(); |
| | | } |
| | | |
| | | void UpdataFunctionRow() |
| | | { |
| | | for(var i =0;i< functionRowList.Count; i++) |
| | | contentView.RemoveAll(); |
| | | for (var i =0;i< functionRowList.Count; i++) |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | if (view.Tag != null) |
| | | { |
| | | if (view.Tag.ToString() == FunctionAttributeKey.OnOff) |
| | | { |
| | | contentView.AddChidren(view); |
| | | |
| | | } |
| | | if (isOnStatus) |
| | | { |
| | | if (view.Tag.ToString() != FunctionAttributeKey.OnOff) |
| | | { |
| | | if (isColorful) |
| | | if (isColorful && sceneFunction.localFunction.spk == SPK.LightRGB) |
| | | { |
| | | if(view.Tag.ToString() != FunctionAttributeKey.Colorful) |
| | | { |
| | |
| | | |
| | | dialog.Show(); |
| | | |
| | | pView.MouseUpEventHandler = (sender, e) => { |
| | | pView.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | btnCancel.MouseUpEventHandler = (sender, e) => { |
| | | btnCancel.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | btnOn.MouseUpEventHandler = (sender, e) => |
| | |
| | | MainPage.Log($"场景配置异常3:{ex.Message}"); |
| | | } |
| | | }; |
| | | btnOff.MouseUpEventHandler = (sender,e) =>{ |
| | | btnOff.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | trait.value = "off"; |
| | | isOnStatus = false; |
| | | try |
| | | { |
| | | sceneFunction.status.Find((obj) => obj.key == trait.key).value = "off"; |
| | |
| | | btn.Text = trait.GetValueText() + trait.GetUintString(); |
| | | if (trait.key == FunctionAttributeKey.OnOff) |
| | | { |
| | | isOnStatus = false; |
| | | var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); |
| | | if (temp == null) |
| | | { |
| | |
| | | { |
| | | MainPage.Log($"场景配置异常3:{ex.Message}"); |
| | | } |
| | | }; |
| | | }; |
| | | |
| | | } |
| | | |
| | |
| | | /// <param name="btn"></param> |
| | | void LoadEditDialog_CCT(SceneFunctionStatus trait, Button btn) |
| | | { |
| | | if (trait.min == 0) |
| | | { |
| | | switch (trait.key) |
| | | { |
| | | case FunctionAttributeKey.SetTemp: |
| | | trait.min = 16; |
| | | break; |
| | | case FunctionAttributeKey.CCT: |
| | | trait.min = 2700; |
| | | break; |
| | | } |
| | | } |
| | | if (trait.max == 0) |
| | | { |
| | | switch (trait.key) |
| | | { |
| | | case FunctionAttributeKey.SetTemp: |
| | | trait.max = 30; |
| | | break; |
| | | case FunctionAttributeKey.CCT: |
| | | trait.max = 6500; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | double temp = trait.min; |
| | | |
| | | double.TryParse(trait.value, out temp); |
| | | trait.value = temp.ToString(); |
| | | |