From f77a3add1e7ab266e473da9128bbe5758ba3a890 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期日, 20 十二月 2020 19:29:03 +0800 Subject: [PATCH] Merge branch 'NewFilePath' into CJL --- HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 53 insertions(+), 3 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs index 6699d3e..74d498c 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs @@ -11,6 +11,7 @@ FrameLayout bodyView; VerticalScrolViewLayout contentView; Button btnOnText; + Button btnBrightnessText; Scene scene; @@ -122,6 +123,15 @@ btnConfrim.MouseUpEventHandler = (sender, e) => { var temp = scene.functions.Find((obj) => obj.sid == sceneFunction.sid); + if (sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness) != null) + { + try + { + //涓�绔彛涓嶆敮鎸佸紑鍏冲�间笌浜害鍊间竴璧峰鐞嗭紝闇�瑕佸皢寮�鍏冲�肩Щ闄ゆ帀 + sceneFunction.status.Remove(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff)); + } + catch { } + } if (temp != null) { temp = sceneFunction; @@ -142,6 +152,11 @@ { DAL.Server.IMessageCommon.Current.ShowErrorInfoAlter(result); } + } + else + { + refreshAction(); + this.RemoveFromParent(); } }; } @@ -165,7 +180,7 @@ { row.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); } - Button btnBrightnessRight = new Button() + Button btnRight = new Button() { X = Application.GetRealWidth(339), Gravity = Gravity.CenterVertical, @@ -173,7 +188,7 @@ Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; - row.AddChidren(btnBrightnessRight); + row.AddChidren(btnRight); var btnFunctionText = new Button() { @@ -185,7 +200,13 @@ }; row.AddChidren(btnFunctionText); if (sceneStatus.key == FunctionAttributeKey.OnOff) + { btnOnText = btnFunctionText; + } + else if (sceneStatus.key == FunctionAttributeKey.Brightness) + { + btnBrightnessText = btnFunctionText; + } var btnFunctionName = new Button() { @@ -390,12 +411,32 @@ trait.value = "on"; sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = "on"; btn.Text = FunctionList.List.GetValueText(trait.key, trait.value) + FunctionList.List.GetUintString(trait.key); + + var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); + if (temp != null) + { + if (temp.value == "0") + { + temp.value = "100"; + } + btnBrightnessText.Text = FunctionList.List.GetValueText(temp.key, temp.value) + "%"; + } }; btnOff.MouseUpEventHandler = (sender,e) =>{ dialog.Close(); trait.value = "off"; sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = "off"; btn.Text= FunctionList.List.GetValueText(trait.key,trait.value) + FunctionList.List.GetUintString(trait.key); + + var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); + if (temp != null) + { + if (temp.value != "0") + { + temp.value = "0"; + } + btnBrightnessText.Text = FunctionList.List.GetValueText(temp.key, temp.value) + "%"; + } }; } @@ -407,6 +448,10 @@ /// <param name="btn"></param> void LoadEditDialog_Temp(SceneFunctionStatus trait, Button btn) { + double temp = 16; + double.TryParse(trait.value, out temp); + trait.value = temp.ToString(); + List<string> pickerItems = new List<string>(); if(trait == null) { @@ -479,7 +524,12 @@ uIPickerView.setNPicker(pickerItems, null, null); optionBaseView.AddChidren(uIPickerView); uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5); - string selectItem = trait.value.ToString() + FunctionList.List.GetUintString(trait.key); + + string selectItem = pickerItems[0]; + if (pickerItems.Contains(trait.value + FunctionList.List.GetUintString(trait.key))) + { + selectItem = trait.value.ToString() + FunctionList.List.GetUintString(trait.key); + } dialog.Show(); -- Gitblit v1.8.0