| | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (basePage.sensorDiyView_Temp != null) |
| | | basePage.sensorDiyView_Temp.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.room_temp.ToString()).state); |
| | | basePage.sensorDiyView_Temp.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.room_temp.ToString()).state,true); |
| | | if (basePage.sensorDiyView_Humi != null) |
| | | basePage.sensorDiyView_Humi.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.room_humidity.ToString()).state); |
| | | basePage.sensorDiyView_Humi.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.room_humidity.ToString()).state, true); |
| | | if (basePage.sensorDiyView_Pm25 != null) |
| | | basePage.sensorDiyView_Pm25.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.pm25.ToString()).state); |
| | | basePage.sensorDiyView_Pm25.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.pm25.ToString()).state,false); |
| | | if (basePage.sensorDiyView_Co2 != null) |
| | | basePage.sensorDiyView_Co2.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.co2.ToString()).state); |
| | | basePage.sensorDiyView_Co2.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.co2.ToString()).state, false); |
| | | if (basePage.sensorDiyView_Tvoc != null) |
| | | basePage.sensorDiyView_Tvoc.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.tvoc.ToString()).state); |
| | | basePage.sensorDiyView_Tvoc.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.tvoc.ToString()).state, false); |
| | | if (basePage.sensorDiyView_EleDay != null) |
| | | basePage.sensorDiyView_EleDay.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.day_electricity.ToString()).state); |
| | | basePage.sensorDiyView_EleDay.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.day_electricity.ToString()).state, false); |
| | | if (basePage.sensorDiyView_EleMonth != null) |
| | | basePage.sensorDiyView_EleMonth.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.month_electricity.ToString()).state); |
| | | basePage.sensorDiyView_EleMonth.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.month_electricity.ToString()).state, false); |
| | | if (basePage.sensorDiyView_EleActivePower != null) |
| | | basePage.sensorDiyView_EleActivePower.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.active_power.ToString()).state); |
| | | basePage.sensorDiyView_EleActivePower.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.active_power.ToString()).state, false); |
| | | |
| | | |
| | | |
| | |
| | | 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"; |
| | | }); |
| | | } |
| | | |
| | |
| | | }); |
| | | |
| | | #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) |
| | |
| | | { |
| | | sensorCount++; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 能耗数据统计 |
| | | int energyCount = 0; |
| | | var totalObj = function.GetAttribute(AcstParent_AttrEnum.active_power.ToString()); |
| | | if (totalObj != null) |
| | | { |
| | | energyCount++; |
| | | } |
| | | var dayObj = function.GetAttribute(AcstParent_AttrEnum.day_electricity.ToString()); |
| | | if (dayObj != null) |
| | | { |
| | | energyCount++; |
| | | } |
| | | var monthObj = function.GetAttribute(AcstParent_AttrEnum.month_electricity.ToString()); |
| | | if (monthObj != null) |
| | | { |
| | | energyCount++; |
| | | } |
| | | #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() |
| | | { |
| | |
| | | #endregion |
| | | |
| | | #region 能耗数据 |
| | | int energyCount = 0; |
| | | var totalObj = function.GetAttribute(AcstParent_AttrEnum.active_power.ToString()); |
| | | if (totalObj != null) |
| | | { |
| | | energyCount++; |
| | | } |
| | | var dayObj = function.GetAttribute(AcstParent_AttrEnum.day_electricity.ToString()); |
| | | if (dayObj != null) |
| | | { |
| | | energyCount++; |
| | | } |
| | | var monthObj = function.GetAttribute(AcstParent_AttrEnum.month_electricity.ToString()); |
| | | if (monthObj != null) |
| | | { |
| | | energyCount++; |
| | | } |
| | | var energyListView = new HorizontalScrolViewLayout() |
| | | { |
| | | Width = Application.GetRealWidth(100 * energyCount), |
| | | Gravity = Gravity.Center, |
| | | Visible = false, |
| | | Visible = sensorCount == 0 |
| | | }; |
| | | if (energyCount > 0) |
| | | { |
| | |
| | | { |
| | | text = "Power"; |
| | | } |
| | | |
| | | sensorDiyView_EleActivePower = new SensorDiyView(energyListView, curColor, totalObj.state == "" ? "--" : totalObj.state , "KW", text, 100); |
| | | } |
| | | if (dayObj != null) |
| | |
| | | { |
| | | text = "Power of today"; |
| | | } |
| | | sensorDiyView_EleDay = new SensorDiyView(energyListView, curColor, dayObj.state == "" ? "--" : dayObj.state , "KW", text,100); |
| | | sensorDiyView_EleDay = new SensorDiyView(energyListView, curColor, dayObj.state == "" ? "--" : dayObj.state, "KWh", text, 100); |
| | | } |
| | | if (monthObj != null) |
| | | { |
| | |
| | | infoView.AddChidren(btnChangeClick); |
| | | |
| | | bool showSensor = true; |
| | | EventHandler<MouseEventArgs> changeInfoEvent = (sender, e) => { |
| | | EventHandler<MouseEventArgs> changeInfoEvent = (sender, e) => |
| | | { |
| | | if (showSensor) |
| | | { |
| | | sensorListView.Visible = false; |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region 子控列表 |
| | |
| | | bottomView.AddChidren(btnModeControl); |
| | | btnModeControl.MouseUpEventHandler = (sender3, e3) => |
| | | { |
| | | if(function.trait_on_off.state == "off") |
| | | { |
| | | return; |
| | | } |
| | | //if(function.trait_on_off.state == "off") |
| | | //{ |
| | | // return; |
| | | //} |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | var dialogView = new FrameLayout(); |
| | |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | var dialogContentView = new FrameLayout() { |
| | | var dialogContentView = new VerticalScrolViewLayout() { |
| | | X = Application.GetRealWidth(34), |
| | | Y = Application.GetRealHeight(291), |
| | | Width = Application.GetRealWidth(148), |
| | |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(100), |
| | | TextID = StringId.SelectScene, |
| | | TextID = StringId.SelectMode, |
| | | TextSize = 16, |
| | | TextColor = CSS.CSS_Color.FirstLevelTitleColor, |
| | | IsBold = true, |
| | |
| | | }; |
| | | titleView.AddChidren(btnTitleText); |
| | | |
| | | if (function.GetAttribute(AcstParent_AttrEnum.mode.ToString()).value.Contains(AcstParent_Attr_ModeValueEnum.cool.ToString())) |
| | | { |
| | | #region 制冷 |
| | | var coolView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(2), |
| | | Y = titleView.Bottom, |
| | | Width = Application.GetRealWidth(144), |
| | | Height = Application.GetRealHeight(44), |
| | | }; |
| | |
| | | }); |
| | | 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(()=> { |
| | | coolIconButton.Click(() => |
| | | { |
| | | dialog.Close(); |
| | | btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeCoolIcon2.png"; |
| | | new System.Threading.Thread(() => { |
| | | 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(); |
| | | }) |
| | | { 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), |
| | | Y = coolView.Bottom, |
| | | Width = Application.GetRealWidth(144), |
| | | Height = Application.GetRealHeight(44), |
| | | }; |
| | |
| | | }); |
| | | 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(() => { |
| | | heatIconButton.Click(() => |
| | | { |
| | | dialog.Close(); |
| | | btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeHeatIcon2.png"; |
| | | new System.Threading.Thread(() => { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("mode", "heat"); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | |
| | | }); |
| | | heatView.AddChidren(heatIconButton); |
| | | #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), |
| | | Y = dehumiView.Bottom, |
| | | Width = Application.GetRealWidth(144), |
| | | Height = Application.GetRealHeight(44), |
| | | }; |
| | |
| | | }); |
| | | 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(() => { |
| | | fanIconButton.Click(() => |
| | | { |
| | | btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeFanIcon2.png"; |
| | | dialog.Close(); |
| | | new System.Threading.Thread(() => { |
| | | 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); |
| | |
| | | }); |
| | | fanView.AddChidren(fanIconButton); |
| | | #endregion |
| | | } |
| | | |
| | | if (function.GetAttribute(AcstParent_AttrEnum.mode.ToString()).value.Contains(AcstParent_Attr_ModeValueEnum.dry.ToString())) |
| | | { |
| | | #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.Dry), 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 |
| | | } |
| | | if (function.GetAttribute(AcstParent_AttrEnum.mode.ToString()).value.Contains(AcstParent_Attr_ModeValueEnum.heat_humidity.ToString())) |
| | | { |
| | | |
| | | #region 制热除湿 |
| | | var heatHumiView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(2), |
| | | Y = fanView.Bottom, |
| | | Width = Application.GetRealWidth(144), |
| | | Height = Application.GetRealHeight(44), |
| | | }; |
| | |
| | | }); |
| | | 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(() => { |
| | | heatHumiIconButton.Click(() => |
| | | { |
| | | btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeHeatHumiIcon2.png"; |
| | | dialog.Close(); |
| | | new System.Threading.Thread(() => { |
| | | 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); |
| | |
| | | }); |
| | | heatHumiView.AddChidren(heatHumiIconButton); |
| | | #endregion |
| | | } |
| | | |
| | | if (function.GetAttribute(AcstParent_AttrEnum.mode.ToString()).value.Contains(AcstParent_Attr_ModeValueEnum.humidity.ToString())) |
| | | { |
| | | #region 加湿 |
| | | var humiView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(2), |
| | | Y = heatHumiView.Bottom, |
| | | Width = Application.GetRealWidth(144), |
| | | Height = Application.GetRealHeight(44), |
| | | }; |
| | |
| | | }); |
| | | 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(() => { |
| | | humiIconButton.Click(() => |
| | | { |
| | | btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeHumiIcon2.png"; |
| | | dialog.Close(); |
| | | new System.Threading.Thread(() => { |
| | | 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); |
| | |
| | | }); |
| | | humiView.AddChidren(humiIconButton); |
| | | #endregion |
| | | } |
| | | |
| | | dialog.Show(); |
| | | }; |
| | |
| | | |
| | | btnWorkSceneControl.MouseUpEventHandler = (sender2, e2) => |
| | | { |
| | | if (function.trait_on_off.state == "off") |
| | | { |
| | | return; |
| | | } |
| | | //if (function.trait_on_off.state == "off") |
| | | //{ |
| | | // return; |
| | | //} |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | var dialogView = new FrameLayout(); |
| | |
| | | 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", |
| | |
| | | }; |
| | | titleView.AddChidren(btnTitleText); |
| | | |
| | | if (function.GetAttribute(AcstParent_AttrEnum.scene.ToString()).value.Contains(AcstParent_Attr_SceneValueEnum.at_home.ToString())) |
| | | { |
| | | #region 在家 |
| | | var atHomeView = new FrameLayout() |
| | | var atHomeView = new VerticalScrolViewLayout() |
| | | { |
| | | X = Application.GetRealWidth(2), |
| | | Y = titleView.Bottom, |
| | | //Y = titleView.Bottom, |
| | | Width = Application.GetRealWidth(144), |
| | | Height = Application.GetRealHeight(44), |
| | | }; |
| | |
| | | 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(() => { |
| | | atHomeIconButton.Click(() => |
| | | { |
| | | btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAtHome2.png"; |
| | | dialog.Close(); |
| | | new System.Threading.Thread(() => { |
| | | 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); |
| | |
| | | }); |
| | | atHomeView.AddChidren(atHomeIconButton); |
| | | #endregion |
| | | } |
| | | |
| | | |
| | | if (function.GetAttribute(AcstParent_AttrEnum.scene.ToString()).value.Contains(AcstParent_Attr_SceneValueEnum.leave_home.ToString())) |
| | | { |
| | | #region 离家 |
| | | var awayHomeView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(2), |
| | | Y = atHomeView.Bottom, |
| | | //Y = atHomeView.Bottom, |
| | | Width = Application.GetRealWidth(144), |
| | | Height = Application.GetRealHeight(44), |
| | | }; |
| | |
| | | }); |
| | | 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(() => { |
| | | awayHomeIconButton.Click(() => |
| | | { |
| | | btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAwayHomeIcon2.png"; |
| | | dialog.Close(); |
| | | new System.Threading.Thread(() => { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("scene", "leave_home"); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | |
| | | }); |
| | | awayHomeView.AddChidren(awayHomeIconButton); |
| | | #endregion |
| | | } |
| | | |
| | | |
| | | if (function.GetAttribute(AcstParent_AttrEnum.scene.ToString()).value.Contains(AcstParent_Attr_SceneValueEnum.sleep.ToString())) |
| | | { |
| | | |
| | | #region 睡眠 |
| | | var sleepView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(2), |
| | | Y = awayHomeView.Bottom, |
| | | //Y = awayHomeView.Bottom, |
| | | Width = Application.GetRealWidth(144), |
| | | Height = Application.GetRealHeight(44), |
| | | }; |
| | |
| | | }); |
| | | 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(() => { |
| | | sleepIconButton.Click(() => |
| | | { |
| | | btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneSleepIcon2.png"; |
| | | dialog.Close(); |
| | | new System.Threading.Thread(() => { |
| | | 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(); |
| | | }; |
| | |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = color, |
| | | TextSize = 20, |
| | | Text = value + unitString, |
| | | Text = value, |
| | | }; |
| | | contentView.AddChidren(btnValue); |
| | | |
| | |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = 0xFF949AA5, |
| | | TextSize = 12, |
| | | Text = text, |
| | | Text = text + "(" + unitString+")", |
| | | }; |
| | | contentView.AddChidren(btnText); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | public void UpdateValue(string value) |
| | | public void UpdateValue(string value,bool isInt) |
| | | { |
| | | if (value.Contains(".") && isInt) |
| | | { |
| | | value = value.Remove(value.IndexOf('.'), value.Length - value.IndexOf('.')); |
| | | } |
| | | btnValue.Text = value + unitString; |
| | | } |
| | | } |