From fb4b2750f73856dfe871667865e606f919360fdc Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 27 十月 2022 13:22:33 +0800 Subject: [PATCH] 光伏更新,金茂绿建科技系统更新,俄语更新 --- HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs | 806 ++++++++++++++++++++++++++++++-------------------------- 1 files changed, 431 insertions(+), 375 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs index 774698a..8f2b256 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs @@ -160,7 +160,7 @@ basePage.btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneSleepIcon2.png"; break; } - basePage.btnModeControl.IsSelected = basePage.btnWorkSceneControl.IsSelected = basePage.btnPowerControl.IsSelected = temp.trait_on_off.state == "on"; + basePage.btnModeControl.IsSelected = basePage.btnWorkSceneControl.IsSelected = basePage.btnPowerControl.IsSelected = temp.GetAttrState("on_off") == "on"; }); } @@ -359,24 +359,8 @@ }); #region 鏁版嵁 - var infoView = new FrameLayout() - { - Y = topView.Bottom, - Height = Application.GetRealHeight(104), - BackgroundColor = CSS.CSS_Color.MainBackgroundColor, - }; - bodyView.AddChidren(infoView); - var infoContentView = new FrameLayout() - { - Gravity = Gravity.Center, - Width = Application.GetRealWidth(343), - Height = Application.GetRealHeight(72), - BackgroundImagePath = $"FunctionIcon/Acst/{imageFolder}/MsgViewBg.png", - }; - infoView.AddChidren(infoContentView); - - #region 浼犳劅鍣ㄦ暟鎹� + #region 浼犳劅鍣ㄦ暟鎹�昏 int sensorCount = 0; var tempObj = function.GetAttribute(AcstParent_AttrEnum.room_temp.ToString()); if (tempObj != null) @@ -403,40 +387,10 @@ { sensorCount++; } - - var sensorListView = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(60 * sensorCount), - Gravity = Gravity.Center, - }; - if (sensorCount > 0) - { - infoContentView.AddChidren(sensorListView); - } - - if (tempObj != null) - { - sensorDiyView_Temp = new SensorDiyView(sensorListView, curColor, tempObj.state == "" ? "--" : tempObj.state, "掳", Language.StringByID(StringId.Temp)); - } - if (humiObj != null) - { - sensorDiyView_Humi = new SensorDiyView(sensorListView, curColor, humiObj.state == "" ? "--" : humiObj.state, "%", Language.StringByID(StringId.Humidity)); - } - if (pm25Obj != null) - { - sensorDiyView_Pm25 = new SensorDiyView(sensorListView, curColor, pm25Obj.state == "" ? "--" : pm25Obj.state, "", "PM2.5"); - } - if (co2Obj != null) - { - sensorDiyView_Co2 = new SensorDiyView(sensorListView, curColor, co2Obj.state == "" ? "--" : co2Obj.state, "", "CO2"); - } - if (tvocObj != null) - { - sensorDiyView_Tvoc = new SensorDiyView(sensorListView, curColor, tvocObj.state == "" ? "--" : tvocObj.state, "", "TVOC"); - } #endregion - #region 鑳借�楁暟鎹� + + #region 鑳借�楁暟鎹粺璁� int energyCount = 0; var totalObj = function.GetAttribute(AcstParent_AttrEnum.active_power.ToString()); if (totalObj != null) @@ -453,71 +407,128 @@ { energyCount++; } - var energyListView = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(100 * energyCount), - Gravity = Gravity.Center, - Visible = false, - }; - if (energyCount > 0) - { - infoContentView.AddChidren(energyListView); - } - if (totalObj != null) - { - string text = "鐢ㄧ數鍔熺巼"; - if (Language.CurrentLanguage != "Chinese") - { - text = "Power"; - } - - sensorDiyView_EleActivePower = new SensorDiyView(energyListView, curColor, totalObj.state == "" ? "--" : totalObj.state , "KW", text, 100); - } - if (dayObj != null) - { - string text = "浠婃棩鑰楃數"; - if (Language.CurrentLanguage != "Chinese") - { - text = "Power of today"; - } - sensorDiyView_EleDay = new SensorDiyView(energyListView, curColor, dayObj.state == "" ? "--" : dayObj.state , "KW", text,100); - } - if (monthObj != null) - { - string text = "鏈湀鑰楃數"; - if (Language.CurrentLanguage != "Chinese") - { - text = "Power of month"; - } - sensorDiyView_EleMonth = new SensorDiyView(energyListView, curColor, monthObj.state == "" ? "--" : monthObj.state , "KWh", text, 100); - } - - - var btnChangeClick = new Button(); - infoView.AddChidren(btnChangeClick); - - bool showSensor = true; - EventHandler<MouseEventArgs> changeInfoEvent = (sender, e) => { - if (showSensor) - { - sensorListView.Visible = false; - showSensor = false; - energyListView.Visible = true; - } - else - { - sensorListView.Visible = true; - showSensor = true; - energyListView.Visible = false; - } - }; - if (sensorCount > 0 && energyCount > 0) - { - btnChangeClick.MouseUpEventHandler = changeInfoEvent; - } - #endregion + if (energyCount > 0 || sensorCount > 0) + { + var infoView = new FrameLayout() + { + Y = topView.Bottom, + Height = Application.GetRealHeight(104), + BackgroundColor = CSS.CSS_Color.MainBackgroundColor, + }; + bodyView.AddChidren(infoView); + + var infoContentView = new FrameLayout() + { + Gravity = Gravity.Center, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(72), + BackgroundImagePath = $"FunctionIcon/Acst/{imageFolder}/MsgViewBg.png", + }; + infoView.AddChidren(infoContentView); + + #region 浼犳劅鍣ㄦ暟鎹� + + var sensorListView = new HorizontalScrolViewLayout() + { + Width = Application.GetRealWidth(60 * sensorCount), + Gravity = Gravity.Center, + }; + if (sensorCount > 0) + { + infoContentView.AddChidren(sensorListView); + } + + if (tempObj != null) + { + sensorDiyView_Temp = new SensorDiyView(sensorListView, curColor, tempObj.state == "" ? "--" : tempObj.state, "掳", Language.StringByID(StringId.Temp)); + } + if (humiObj != null) + { + sensorDiyView_Humi = new SensorDiyView(sensorListView, curColor, humiObj.state == "" ? "--" : humiObj.state, "%", Language.StringByID(StringId.Humidity)); + } + if (pm25Obj != null) + { + sensorDiyView_Pm25 = new SensorDiyView(sensorListView, curColor, pm25Obj.state == "" ? "--" : pm25Obj.state, "", "PM2.5"); + } + if (co2Obj != null) + { + sensorDiyView_Co2 = new SensorDiyView(sensorListView, curColor, co2Obj.state == "" ? "--" : co2Obj.state, "", "CO2"); + } + if (tvocObj != null) + { + sensorDiyView_Tvoc = new SensorDiyView(sensorListView, curColor, tvocObj.state == "" ? "--" : tvocObj.state, "", "TVOC"); + } + #endregion + + #region 鑳借�楁暟鎹� + var energyListView = new HorizontalScrolViewLayout() + { + Width = Application.GetRealWidth(100 * energyCount), + Gravity = Gravity.Center, + Visible = false, + }; + if (energyCount > 0) + { + infoContentView.AddChidren(energyListView); + } + if (totalObj != null) + { + string text = "鐢ㄧ數鍔熺巼"; + if (Language.CurrentLanguage != "Chinese") + { + text = "Power"; + } + + sensorDiyView_EleActivePower = new SensorDiyView(energyListView, curColor, totalObj.state == "" ? "--" : totalObj.state, "KW", text, 100); + } + if (dayObj != null) + { + string text = "浠婃棩鑰楃數"; + if (Language.CurrentLanguage != "Chinese") + { + text = "Power of today"; + } + sensorDiyView_EleDay = new SensorDiyView(energyListView, curColor, dayObj.state == "" ? "--" : dayObj.state, "KW", text, 100); + } + if (monthObj != null) + { + string text = "鏈湀鑰楃數"; + if (Language.CurrentLanguage != "Chinese") + { + text = "Power of month"; + } + sensorDiyView_EleMonth = new SensorDiyView(energyListView, curColor, monthObj.state == "" ? "--" : monthObj.state, "KWh", text, 100); + } + + + var btnChangeClick = new Button(); + infoView.AddChidren(btnChangeClick); + + bool showSensor = true; + EventHandler<MouseEventArgs> changeInfoEvent = (sender, e) => + { + if (showSensor) + { + sensorListView.Visible = false; + showSensor = false; + energyListView.Visible = true; + } + else + { + sensorListView.Visible = true; + showSensor = true; + energyListView.Visible = false; + } + }; + if (sensorCount > 0 && energyCount > 0) + { + btnChangeClick.MouseUpEventHandler = changeInfoEvent; + } + + #endregion + } #endregion #region 瀛愭帶鍒楄〃 @@ -644,7 +655,7 @@ dialog.Close(); }; - var dialogContentView = new FrameLayout() { + var dialogContentView = new VerticalScrolViewLayout() { X = Application.GetRealWidth(34), Y = Application.GetRealHeight(291), Width = Application.GetRealWidth(148), @@ -672,191 +683,217 @@ }; titleView.AddChidren(btnTitleText); - #region 鍒跺喎 - var coolView = new FrameLayout() + if (function.GetAttribute(AcstParent_AttrEnum.mode.ToString()).value.Contains(AcstParent_Attr_ModeValueEnum.cool.ToString())) { - X = Application.GetRealWidth(2), - Y = titleView.Bottom, - Width = Application.GetRealWidth(144), - Height = Application.GetRealHeight(44), - }; - dialogContentView.AddChidren(coolView); - coolView.AddChidren(new Button - { - Width = Application.GetRealWidth(112), - Gravity = Gravity.CenterHorizontal, - Height = 1, - BackgroundColor = CSS.CSS_Color.DividingLineColor, - }); - IconButton coolIconButton = new IconButton("FunctionIcon/Acst/grey/ModeCoolIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeCoolIcon.png", - Language.StringByID(StringId.Cool),curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == "cool"); - coolIconButton.Click(()=> { - dialog.Close(); - btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeCoolIcon2.png"; - new System.Threading.Thread(() => { - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add(AcstParent_AttrEnum.mode.ToString(), AcstParent_Attr_ModeValueEnum.cool.ToString()); - Control.Ins.SendWriteCommand(function, d); - }) { IsBackground = true }.Start(); - }); - coolView.AddChidren(coolIconButton); - #endregion + #region 鍒跺喎 + var coolView = new FrameLayout() + { + X = Application.GetRealWidth(2), + Width = Application.GetRealWidth(144), + Height = Application.GetRealHeight(44), + }; + dialogContentView.AddChidren(coolView); + coolView.AddChidren(new Button + { + Width = Application.GetRealWidth(112), + Gravity = Gravity.CenterHorizontal, + Height = 1, + BackgroundColor = CSS.CSS_Color.DividingLineColor, + }); + IconButton coolIconButton = new IconButton("FunctionIcon/Acst/grey/ModeCoolIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeCoolIcon.png", + Language.StringByID(StringId.Cool), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == "cool"); + coolIconButton.Click(() => + { + dialog.Close(); + btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeCoolIcon2.png"; + new System.Threading.Thread(() => + { + Dictionary<string, string> d = new Dictionary<string, string>(); + d.Add(AcstParent_AttrEnum.mode.ToString(), AcstParent_Attr_ModeValueEnum.cool.ToString()); + Control.Ins.SendWriteCommand(function, d); + }) + { IsBackground = true }.Start(); + }); + coolView.AddChidren(coolIconButton); + #endregion + } + if (function.GetAttribute(AcstParent_AttrEnum.mode.ToString()).value.Contains(AcstParent_Attr_ModeValueEnum.heat.ToString())) + { + #region 鍒剁儹 + var heatView = new FrameLayout() + { + X = Application.GetRealWidth(2), + Width = Application.GetRealWidth(144), + Height = Application.GetRealHeight(44), + }; + dialogContentView.AddChidren(heatView); + heatView.AddChidren(new Button + { + Width = Application.GetRealWidth(112), + Gravity = Gravity.CenterHorizontal, + Height = 1, + BackgroundColor = CSS.CSS_Color.DividingLineColor, + }); + IconButton heatIconButton = new IconButton("FunctionIcon/Acst/grey/ModeHeatIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeHeatIcon.png", + Language.StringByID(StringId.Heat), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == "heat"); + heatIconButton.Click(() => + { + dialog.Close(); + btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeHeatIcon2.png"; + new System.Threading.Thread(() => + { + Dictionary<string, string> d = new Dictionary<string, string>(); + d.Add("mode", "heat"); + Control.Ins.SendWriteCommand(function, d); + }) + { IsBackground = true }.Start(); + }); + heatView.AddChidren(heatIconButton); + #endregion + } + if (function.GetAttribute(AcstParent_AttrEnum.mode.ToString()).value.Contains(AcstParent_Attr_ModeValueEnum.humidity.ToString())) + { - #region 鍒剁儹 - var heatView = new FrameLayout() - { - X = Application.GetRealWidth(2), - Y = coolView.Bottom, - Width = Application.GetRealWidth(144), - Height = Application.GetRealHeight(44), - }; - dialogContentView.AddChidren(heatView); - heatView.AddChidren(new Button - { - Width = Application.GetRealWidth(112), - Gravity = Gravity.CenterHorizontal, - Height = 1, - BackgroundColor = CSS.CSS_Color.DividingLineColor, - }); - IconButton heatIconButton = new IconButton("FunctionIcon/Acst/grey/ModeHeatIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeHeatIcon.png", - Language.StringByID(StringId.Heat), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == "heat"); - heatIconButton.Click(() => { - dialog.Close(); - btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeHeatIcon2.png"; - new System.Threading.Thread(() => { - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("mode", "heat"); - Control.Ins.SendWriteCommand(function, d); - }) - { IsBackground = true }.Start(); - }); - heatView.AddChidren(heatIconButton); - #endregion + #region 闄ゆ箍 + var dehumiView = new FrameLayout() + { + X = Application.GetRealWidth(2), + Width = Application.GetRealWidth(144), + Height = Application.GetRealHeight(44), + }; + dialogContentView.AddChidren(dehumiView); + dehumiView.AddChidren(new Button + { + Width = Application.GetRealWidth(112), + Gravity = Gravity.CenterHorizontal, + Height = 1, + BackgroundColor = CSS.CSS_Color.DividingLineColor, + }); + IconButton dehumiIconButton = new IconButton("FunctionIcon/Acst/grey/ModeDeHumiIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeDeHumiIcon.png", + Language.StringByID(StringId.Humidity), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.dry.ToString()); + dehumiIconButton.Click(() => + { + btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeDeHumiIcon2.png"; + dialog.Close(); + new System.Threading.Thread(() => + { + Dictionary<string, string> d = new Dictionary<string, string>(); + d.Add("mode", AcstParent_Attr_ModeValueEnum.dry.ToString()); + Control.Ins.SendWriteCommand(function, d); + }) + { IsBackground = true }.Start(); + }); + dehumiView.AddChidren(dehumiIconButton); + #endregion + } - #region 闄ゆ箍 - var dehumiView = new FrameLayout() + if (function.GetAttribute(AcstParent_AttrEnum.mode.ToString()).value.Contains(AcstParent_Attr_ModeValueEnum.fan.ToString())) { - X = Application.GetRealWidth(2), - Y = heatView.Bottom, - Width = Application.GetRealWidth(144), - Height = Application.GetRealHeight(44), - }; - dialogContentView.AddChidren(dehumiView); - dehumiView.AddChidren(new Button - { - Width = Application.GetRealWidth(112), - Gravity = Gravity.CenterHorizontal, - Height = 1, - BackgroundColor = CSS.CSS_Color.DividingLineColor, - }); - IconButton dehumiIconButton = new IconButton("FunctionIcon/Acst/grey/ModeDeHumiIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeDeHumiIcon.png", - Language.StringByID(StringId.Humidity), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.dry.ToString()); - dehumiIconButton.Click(() => { - btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeDeHumiIcon2.png"; - dialog.Close(); - new System.Threading.Thread(() => { - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("mode", AcstParent_Attr_ModeValueEnum.dry.ToString()); - Control.Ins.SendWriteCommand(function, d); - }) - { IsBackground = true }.Start(); - }); - dehumiView.AddChidren(dehumiIconButton); - #endregion + #region 閫氶 + var fanView = new FrameLayout() + { + X = Application.GetRealWidth(2), + Width = Application.GetRealWidth(144), + Height = Application.GetRealHeight(44), + }; + dialogContentView.AddChidren(fanView); + fanView.AddChidren(new Button + { + Width = Application.GetRealWidth(112), + Gravity = Gravity.CenterHorizontal, + Height = 1, + BackgroundColor = CSS.CSS_Color.DividingLineColor, + }); + IconButton fanIconButton = new IconButton("FunctionIcon/Acst/grey/ModeFanIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeFanIcon.png", + Language.StringByID(StringId.Ventilated), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.fan.ToString()); + fanIconButton.Click(() => + { + btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeFanIcon2.png"; + dialog.Close(); + new System.Threading.Thread(() => + { + Dictionary<string, string> d = new Dictionary<string, string>(); + d.Add("mode", AcstParent_Attr_ModeValueEnum.fan.ToString()); + Control.Ins.SendWriteCommand(function, d); + }) + { IsBackground = true }.Start(); + }); + fanView.AddChidren(fanIconButton); + #endregion + } - #region 閫氶 - var fanView = new FrameLayout() + if (function.GetAttribute(AcstParent_AttrEnum.mode.ToString()).value.Contains(AcstParent_Attr_ModeValueEnum.heat_humidity.ToString())) { - X = Application.GetRealWidth(2), - Y = dehumiView.Bottom, - Width = Application.GetRealWidth(144), - Height = Application.GetRealHeight(44), - }; - dialogContentView.AddChidren(fanView); - fanView.AddChidren(new Button - { - Width = Application.GetRealWidth(112), - Gravity = Gravity.CenterHorizontal, - Height = 1, - BackgroundColor = CSS.CSS_Color.DividingLineColor, - }); - IconButton fanIconButton = new IconButton("FunctionIcon/Acst/grey/ModeFanIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeFanIcon.png", - Language.StringByID(StringId.Ventilated), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.fan.ToString()); - fanIconButton.Click(() => { - btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeFanIcon2.png"; - dialog.Close(); - new System.Threading.Thread(() => { - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("mode", AcstParent_Attr_ModeValueEnum.fan.ToString()); - Control.Ins.SendWriteCommand(function, d); - }) - { IsBackground = true }.Start(); - }); - fanView.AddChidren(fanIconButton); - #endregion - #region 鍒剁儹闄ゆ箍 - var heatHumiView = new FrameLayout() - { - X = Application.GetRealWidth(2), - Y = fanView.Bottom, - Width = Application.GetRealWidth(144), - Height = Application.GetRealHeight(44), - }; - dialogContentView.AddChidren(heatHumiView); - heatHumiView.AddChidren(new Button - { - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(112), - Height = 1, - BackgroundColor = CSS.CSS_Color.DividingLineColor, - }); - IconButton heatHumiIconButton = new IconButton("FunctionIcon/Acst/grey/ModeHeatHumiIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeHeatHumiIcon.png", - Language.StringByID(StringId.HeatingAndDehumidification), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.heat_humidity.ToString()); - heatHumiIconButton.Click(() => { - btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeHeatHumiIcon2.png"; - dialog.Close(); - new System.Threading.Thread(() => { - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("mode", AcstParent_Attr_ModeValueEnum.heat_humidity.ToString()); - Control.Ins.SendWriteCommand(function, d); - }) - { IsBackground = true }.Start(); - }); - heatHumiView.AddChidren(heatHumiIconButton); - #endregion + #region 鍒剁儹闄ゆ箍 + var heatHumiView = new FrameLayout() + { + X = Application.GetRealWidth(2), + Width = Application.GetRealWidth(144), + Height = Application.GetRealHeight(44), + }; + dialogContentView.AddChidren(heatHumiView); + heatHumiView.AddChidren(new Button + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(112), + Height = 1, + BackgroundColor = CSS.CSS_Color.DividingLineColor, + }); + IconButton heatHumiIconButton = new IconButton("FunctionIcon/Acst/grey/ModeHeatHumiIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeHeatHumiIcon.png", + Language.StringByID(StringId.HeatingAndDehumidification), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.heat_humidity.ToString()); + heatHumiIconButton.Click(() => + { + btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeHeatHumiIcon2.png"; + dialog.Close(); + new System.Threading.Thread(() => + { + Dictionary<string, string> d = new Dictionary<string, string>(); + d.Add("mode", AcstParent_Attr_ModeValueEnum.heat_humidity.ToString()); + Control.Ins.SendWriteCommand(function, d); + }) + { IsBackground = true }.Start(); + }); + heatHumiView.AddChidren(heatHumiIconButton); + #endregion + } - #region 鍔犳箍 - var humiView = new FrameLayout() + if (function.GetAttribute(AcstParent_AttrEnum.mode.ToString()).value.Contains(AcstParent_Attr_ModeValueEnum.humidity.ToString())) { - X = Application.GetRealWidth(2), - Y = heatHumiView.Bottom, - Width = Application.GetRealWidth(144), - Height = Application.GetRealHeight(44), - }; - dialogContentView.AddChidren(humiView); - humiView.AddChidren(new Button - { - Width = Application.GetRealWidth(112), - Gravity = Gravity.CenterHorizontal, - Height = 1, - BackgroundColor = CSS.CSS_Color.DividingLineColor, - }); - IconButton humiIconButton = new IconButton("FunctionIcon/Acst/grey/ModeHumiIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeHumiIcon.png", - Language.StringByID(StringId.Humidification), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.humidity.ToString()); - humiIconButton.Click(() => { - btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeHumiIcon2.png"; - dialog.Close(); - new System.Threading.Thread(() => { - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("mode", AcstParent_Attr_ModeValueEnum.humidity.ToString()); - Control.Ins.SendWriteCommand(function, d); - }) - { IsBackground = true }.Start(); - }); - humiView.AddChidren(humiIconButton); - #endregion + + #region 鍔犳箍 + var humiView = new FrameLayout() + { + X = Application.GetRealWidth(2), + Width = Application.GetRealWidth(144), + Height = Application.GetRealHeight(44), + }; + dialogContentView.AddChidren(humiView); + humiView.AddChidren(new Button + { + Width = Application.GetRealWidth(112), + Gravity = Gravity.CenterHorizontal, + Height = 1, + BackgroundColor = CSS.CSS_Color.DividingLineColor, + }); + IconButton humiIconButton = new IconButton("FunctionIcon/Acst/grey/ModeHumiIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeHumiIcon.png", + Language.StringByID(StringId.Humidification), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.humidity.ToString()); + humiIconButton.Click(() => + { + btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeHumiIcon2.png"; + dialog.Close(); + new System.Threading.Thread(() => + { + Dictionary<string, string> d = new Dictionary<string, string>(); + d.Add("mode", AcstParent_Attr_ModeValueEnum.humidity.ToString()); + Control.Ins.SendWriteCommand(function, d); + }) + { IsBackground = true }.Start(); + }); + humiView.AddChidren(humiIconButton); + #endregion + } dialog.Show(); }; @@ -918,10 +955,11 @@ dialog.Close(); }; - var dialogContentView = new FrameLayout() + var dialogContentView = new VerticalScrolViewLayout() { X = Application.GetRealWidth(194), Y = Application.GetRealHeight(419), + ScrollEnabled = false, Width = Application.GetRealWidth(148), Height = Application.GetRealHeight(191), BackgroundImagePath = "FunctionIcon/Acst/BgChooseScene.png", @@ -948,98 +986,116 @@ }; titleView.AddChidren(btnTitleText); - #region 鍦ㄥ - var atHomeView = new FrameLayout() + if (function.GetAttribute(AcstParent_AttrEnum.scene.ToString()).value.Contains(AcstParent_Attr_SceneValueEnum.at_home.ToString())) { - X = Application.GetRealWidth(2), - Y = titleView.Bottom, - Width = Application.GetRealWidth(144), - Height = Application.GetRealHeight(44), - }; - dialogContentView.AddChidren(atHomeView); - atHomeView.AddChidren(new Button - { - Width = Application.GetRealWidth(112), - Gravity = Gravity.CenterHorizontal, - Height = 1, - BackgroundColor = CSS.CSS_Color.DividingLineColor, - }); - IconButton atHomeIconButton = new IconButton("FunctionIcon/Acst/grey/SceneAtHome.png", $"FunctionIcon/Acst/{imageFolder}/SceneAtHome.png", + #region 鍦ㄥ + var atHomeView = new VerticalScrolViewLayout() + { + X = Application.GetRealWidth(2), + //Y = titleView.Bottom, + Width = Application.GetRealWidth(144), + Height = Application.GetRealHeight(44), + }; + dialogContentView.AddChidren(atHomeView); + atHomeView.AddChidren(new Button + { + Width = Application.GetRealWidth(112), + Gravity = Gravity.CenterHorizontal, + Height = 1, + BackgroundColor = CSS.CSS_Color.DividingLineColor, + }); + + IconButton atHomeIconButton = new IconButton("FunctionIcon/Acst/grey/SceneAtHome.png", $"FunctionIcon/Acst/{imageFolder}/SceneAtHome.png", Language.StringByID(StringId.AtHome), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.at_home.ToString()); - atHomeIconButton.Click(() => { - btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAtHome2.png"; - dialog.Close(); - new System.Threading.Thread(() => { - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add(AcstParent_AttrEnum.scene.ToString(), AcstParent_Attr_SceneValueEnum.at_home.ToString()); - Control.Ins.SendWriteCommand(function, d); - }) - { IsBackground = true }.Start(); - }); - atHomeView.AddChidren(atHomeIconButton); - #endregion + atHomeIconButton.Click(() => + { + btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAtHome2.png"; + dialog.Close(); + new System.Threading.Thread(() => + { + Dictionary<string, string> d = new Dictionary<string, string>(); + d.Add(AcstParent_AttrEnum.scene.ToString(), AcstParent_Attr_SceneValueEnum.at_home.ToString()); + Control.Ins.SendWriteCommand(function, d); + }) + { IsBackground = true }.Start(); + }); + atHomeView.AddChidren(atHomeIconButton); + #endregion + } - #region 绂诲 - var awayHomeView = new FrameLayout() + if (function.GetAttribute(AcstParent_AttrEnum.scene.ToString()).value.Contains(AcstParent_Attr_SceneValueEnum.leave_home.ToString())) { - X = Application.GetRealWidth(2), - Y = atHomeView.Bottom, - Width = Application.GetRealWidth(144), - Height = Application.GetRealHeight(44), - }; - dialogContentView.AddChidren(awayHomeView); - awayHomeView.AddChidren(new Button - { - Width = Application.GetRealWidth(112), - Gravity = Gravity.CenterHorizontal, - Height = 1, - BackgroundColor = CSS.CSS_Color.DividingLineColor, - }); - IconButton awayHomeIconButton = new IconButton("FunctionIcon/Acst/grey/SceneAwayHomeIcon.png", $"FunctionIcon/Acst/{imageFolder}/SceneAwayHomeIcon.png", - Language.StringByID(StringId.AwayHome), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.leave_home.ToString()); - awayHomeIconButton.Click(() => { - btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAwayHomeIcon2.png"; - dialog.Close(); - new System.Threading.Thread(() => { - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("scene", "leave_home"); - Control.Ins.SendWriteCommand(function, d); - }) - { IsBackground = true }.Start(); - }); - awayHomeView.AddChidren(awayHomeIconButton); - #endregion + #region 绂诲 + var awayHomeView = new FrameLayout() + { + X = Application.GetRealWidth(2), + //Y = atHomeView.Bottom, + Width = Application.GetRealWidth(144), + Height = Application.GetRealHeight(44), + }; + dialogContentView.AddChidren(awayHomeView); + awayHomeView.AddChidren(new Button + { + Width = Application.GetRealWidth(112), + Gravity = Gravity.CenterHorizontal, + Height = 1, + BackgroundColor = CSS.CSS_Color.DividingLineColor, + }); + IconButton awayHomeIconButton = new IconButton("FunctionIcon/Acst/grey/SceneAwayHomeIcon.png", $"FunctionIcon/Acst/{imageFolder}/SceneAwayHomeIcon.png", + Language.StringByID(StringId.AwayHome), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.leave_home.ToString()); + awayHomeIconButton.Click(() => + { + btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAwayHomeIcon2.png"; + dialog.Close(); + new System.Threading.Thread(() => + { + Dictionary<string, string> d = new Dictionary<string, string>(); + d.Add("scene", "leave_home"); + Control.Ins.SendWriteCommand(function, d); + }) + { IsBackground = true }.Start(); + }); + awayHomeView.AddChidren(awayHomeIconButton); + #endregion + } - #region 鐫$湢 - var sleepView = new FrameLayout() + + if (function.GetAttribute(AcstParent_AttrEnum.scene.ToString()).value.Contains(AcstParent_Attr_SceneValueEnum.sleep.ToString())) { - X = Application.GetRealWidth(2), - Y = awayHomeView.Bottom, - Width = Application.GetRealWidth(144), - Height = Application.GetRealHeight(44), - }; - dialogContentView.AddChidren(sleepView); - sleepView.AddChidren(new Button - { - Height = 1, - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(112), - BackgroundColor = CSS.CSS_Color.DividingLineColor, - }); - IconButton sleepIconButton = new IconButton("FunctionIcon/Acst/grey/SceneSleepIcon.png", $"FunctionIcon/Acst/{imageFolder}/SceneSleepIcon.png", - Language.StringByID(StringId.Sleep), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.sleep.ToString()); - sleepIconButton.Click(() => { - btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneSleepIcon2.png"; - dialog.Close(); - new System.Threading.Thread(() => { - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("scene", "sleep"); - Control.Ins.SendWriteCommand(function, d); - }) - { IsBackground = true }.Start(); - }); - sleepView.AddChidren(sleepIconButton); + + #region 鐫$湢 + var sleepView = new FrameLayout() + { + X = Application.GetRealWidth(2), + //Y = awayHomeView.Bottom, + Width = Application.GetRealWidth(144), + Height = Application.GetRealHeight(44), + }; + dialogContentView.AddChidren(sleepView); + sleepView.AddChidren(new Button + { + Height = 1, + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(112), + BackgroundColor = CSS.CSS_Color.DividingLineColor, + }); + IconButton sleepIconButton = new IconButton("FunctionIcon/Acst/grey/SceneSleepIcon.png", $"FunctionIcon/Acst/{imageFolder}/SceneSleepIcon.png", + Language.StringByID(StringId.Sleep), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.sleep.ToString()); + sleepIconButton.Click(() => + { + btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneSleepIcon2.png"; + dialog.Close(); + new System.Threading.Thread(() => + { + Dictionary<string, string> d = new Dictionary<string, string>(); + d.Add("scene", "sleep"); + Control.Ins.SendWriteCommand(function, d); + }) + { IsBackground = true }.Start(); + }); + sleepView.AddChidren(sleepIconButton); + } #endregion dialog.Show(); }; -- Gitblit v1.8.0