From 4fef29b9ab9f2632f15a0d45005f92d91de5d4e5 Mon Sep 17 00:00:00 2001 From: Davin <591807572@qq.com> Date: 星期四, 27 七月 2023 14:26:59 +0800 Subject: [PATCH] feature 萤石sdk更新 --- HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs | 107 +++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 86 insertions(+), 21 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs index 9f5c0ef..08bfede 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs @@ -1903,14 +1903,15 @@ } 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) { @@ -1981,17 +1982,43 @@ 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) @@ -2030,11 +2057,15 @@ this.RemoveFromParent(); } }; + + + UpdataFunctionRow(); } void UpdataFunctionRow() { - for(var i =0;i< functionRowList.Count; i++) + contentView.RemoveAll(); + for (var i =0;i< functionRowList.Count; i++) { try { @@ -2045,11 +2076,16 @@ { 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) { @@ -2544,11 +2580,13 @@ 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) => @@ -2609,10 +2647,10 @@ 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"; @@ -2627,6 +2665,7 @@ 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) { @@ -2664,7 +2703,7 @@ { MainPage.Log($"鍦烘櫙閰嶇疆寮傚父3锛歿ex.Message}"); } - }; + }; } @@ -3161,7 +3200,33 @@ /// <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(); -- Gitblit v1.8.0