wei
2020-11-27 e53a1951d6aa07ad22aad9816da4703496fcbccd
HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
@@ -44,27 +44,27 @@
            switch (function.functionType)
            {
                case FunctionType.AC:
                    LoadFunctionRow(function.function.Find((obj) => obj.name == "set_temperature"));
                    LoadFunctionRow(function.function.Find((obj) => obj.name == "mode"));
                    LoadFunctionRow(function.function.Find((obj) => obj.name == "fan"));
                    LoadFunctionRow(function.function.Find((obj) => obj.key == "set_temperature"));
                    LoadFunctionRow(function.function.Find((obj) => obj.key == "mode"));
                    LoadFunctionRow(function.function.Find((obj) => obj.key == "fan"));
                    break;
                case FunctionType.FloorHeating:
                    LoadFunctionRow(function.function.Find((obj) => obj.name == "set_temperature"));
                    LoadFunctionRow(function.function.Find((obj) => obj.name == "mode"));
                    LoadFunctionRow(function.function.Find((obj) => obj.key == "set_temperature"));
                    LoadFunctionRow(function.function.Find((obj) => obj.key == "mode"));
                    break;
                case FunctionType.Curtain:
                    //无操作
                    break;
                case FunctionType.MotorCurtain:
                case FunctionType.RollingShutter:
                    LoadFunctionRow(function.function.Find((obj) => obj.name == "percent"));
                    LoadFunctionRow(function.function.Find((obj) => obj.key == "percent"));
                    break;
                case FunctionType.Relay:
                    //无操作
                    break;
                case FunctionType.Dimmer:
                case FunctionType.RGB:
                    LoadFunctionRow(function.function.Find((obj) => obj.name == "brightness"));
                    LoadFunctionRow(function.function.Find((obj) => obj.key == "brightness"));
                    break;
            }
@@ -116,7 +116,7 @@
        /// <summary>
        /// 加载功能Row
        /// </summary>
        void LoadFunctionRow(Trait trait)
        void LoadFunctionRow(FunctionAttributes trait)
        {
            if (trait == null)
                return;
@@ -127,7 +127,7 @@
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            contentView.AddChidren(row);
            if (trait.name != "on_off")
            if (trait.key != "on_off")
            {
                row.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
            }
@@ -162,7 +162,7 @@
            row.AddChidren(btnFunctionName);
            btnFunctionName.MouseUpEventHandler = (sender, e) =>
            {
                switch (trait.name)
                switch (trait.key)
                {
                    case "on_off":
                        LoadEditDialog_OnOff(trait, btnFunctionText);
@@ -282,7 +282,7 @@
        /// </summary>
        /// <param name="function"></param>
        /// <param name="btn"></param>
        void LoadEditDialog_OnOff(Trait trait, Button btn)
        void LoadEditDialog_OnOff(FunctionAttributes trait, Button btn)
        {
            Dialog dialog = new Dialog();
@@ -320,7 +320,7 @@
                SelectedTextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextID = StringId.On,
                IsSelected = function.trait_on_off.value.ToString() == "on"
                IsSelected = function.trait_on_off.curValue.ToString() == "on"
            };
            optionView.AddChidren(btnOn);
@@ -334,7 +334,7 @@
                SelectedTextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextID = StringId.OFF,
                IsSelected = function.trait_on_off.value.ToString() == "off"
                IsSelected = function.trait_on_off.curValue.ToString() == "off"
            };
            optionView.AddChidren(btnOff);
@@ -363,12 +363,12 @@
            };
            btnOn.MouseUpEventHandler = (sender, e) => {
                dialog.Close();
                trait.value = "on";
                trait.curValue = "on";
                btn.Text = trait.GetCurValueText() + trait.uintString;
            };
            btnOff.MouseUpEventHandler = (sender,e) =>{
                dialog.Close();
                trait.value = "off";
                trait.curValue = "off";
                btn.Text= trait.GetCurValueText() + trait.uintString;
            };
@@ -379,7 +379,7 @@
        /// </summary>
        /// <param name="function"></param>
        /// <param name="btn"></param>
        void LoadEditDialog_Temp(Trait trait, Button btn)
        void LoadEditDialog_Temp(FunctionAttributes trait, Button btn)
        {
            List<string> pickerItems = new List<string>();
            if(trait == null)
@@ -471,8 +471,8 @@
            }
            uIPickerView.setNPicker(pickerItems, null, null);
            optionBaseView.AddChidren(uIPickerView);
            uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5);
            string selectItem = trait.value.ToString() + trait.uintString;
            uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.curValue.ToString()), 4, 5);
            string selectItem = trait.curValue.ToString() + trait.uintString;
            dialog.Show();
@@ -489,7 +489,7 @@
            btnConfrim.MouseUpEventHandler = (sender, e) => {
                dialog.Close();
                btn.Text = selectItem;
                trait.value = selectItem.Replace(trait.uintString,"");
                trait.curValue = selectItem.Replace(trait.uintString,"");
            };
        }
@@ -500,7 +500,7 @@
        /// </summary>
        /// <param name="function"></param>
        /// <param name="btn"></param>
        void LoadEditDialog_Percent(Trait trait, Button btn)
        void LoadEditDialog_Percent(FunctionAttributes trait, Button btn)
        {
            if (trait == null)
            {
@@ -598,7 +598,7 @@
                ProgressTextColor = CSS_Color.FirstLevelTitleColor,
                ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                MaxValue = 100,
                Progress = trait.value.ToString().Replace("{}", "") == "" ? 0 : Convert.ToInt32( trait.value),
                Progress = trait.curValue.ToString().Replace("{}", "") == "" ? 0 : Convert.ToInt32( trait.curValue),
                SeekBarPadding = Application.GetRealWidth(20),
            };
            optionBaseView.AddChidren(controlBar);
@@ -631,8 +631,8 @@
            };
            btnConfrim.MouseUpEventHandler = (sender, e) => {
                dialog.Close();
                trait.value = controlBar.Progress;
                btn.Text = trait.value + trait.uintString;
                trait.curValue = controlBar.Progress;
                btn.Text = trait.curValue + trait.uintString;
            };
        }
@@ -641,7 +641,7 @@
        /// <summary>
        /// 加载功能属性数据选择弹窗
        /// </summary>
        void LoadEditDialog_FunctionPar(Trait trait, Button btn)
        void LoadEditDialog_FunctionPar(FunctionAttributes trait, Button btn)
        {
            Button lastButton = new Button();
            var lastData = "";
@@ -656,10 +656,10 @@
            var optionBaseView = new FrameLayout()
            {
                Y = Application.GetRealHeight(579 - 50 * trait.value_key.Count),
                Y = Application.GetRealHeight(579 - 50 * trait.value.Count),
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(50 * trait.value_key.Count + 50),
                Height = Application.GetRealHeight(50 * trait.value.Count + 50),
                AnimateSpeed = 0.3f,
                Animate = Animate.DownToUp,
                BackgroundColor = CSS_Color.MainBackgroundColor,
@@ -710,7 +710,7 @@
            };
            topView.AddChidren(btnConfrim);
            int hei = 1;
            foreach (var m in trait.value_key)
            foreach (var m in trait.value)
            {
                var row = new FrameLayout()
                {
@@ -718,7 +718,7 @@
                    Height = Application.GetRealHeight(50),
                };
                optionBaseView.AddChidren(row);
                if (trait.value_key.Count > hei)
                if (trait.value.Count > hei)
                {
                    optionBaseView.AddChidren(new Button()
                    {
@@ -742,7 +742,7 @@
                };
                row.AddChidren(btnChoose);
                if (trait.value.ToString() == m)
                if (trait.curValue.ToString() == m)
                {
                    lastButton = btnChoose;
                    btnChoose.IsSelected = true;
@@ -784,7 +784,7 @@
            };
            btnConfrim.MouseUpEventHandler = (sender, e) => {
                dialog.Close();
                trait.value = lastData;
                trait.curValue = lastData;
                btn.Text = lastText;
            };