| | |
| | | if(view!= null) |
| | | { |
| | | view.btnSubHumidityValues.Text = temp.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString()) + "%"; |
| | | view.btnSubTempValues.Text = temp.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString()) + "%"; |
| | | view.btnSubTempValues.Text = temp.GetAttrState(AcstSub_AttrEnum.room_temp.ToString()) + "°"; |
| | | view.btnSubPower.IsSelected = temp.GetAttrState(AcstSub_AttrEnum.on_off.ToString()) == "on"; |
| | | } |
| | | }); |
| | |
| | | public void LoadPage() |
| | | { |
| | | var curTime = DateTime.Now; |
| | | string helloText = "上午好"; |
| | | string helloText = "上午好"; |
| | | if (Language.CurrentLanguage != "Chinese") |
| | | { |
| | | helloText = "Good morning"; |
| | | } |
| | | if (curTime.Hour >= 8 && curTime.Hour < 12) |
| | | { |
| | | helloText = "上午好"; |
| | | if (Language.CurrentLanguage != "Chinese") |
| | | { |
| | | helloText = "Good morning"; |
| | | } |
| | | curColor = CSS.CSS_Color.MainColor; |
| | | imageFolder = "blue"; |
| | | } |
| | | else if (curTime.Hour >= 12 && curTime.Hour < 18) |
| | | { |
| | | helloText = "下午好"; |
| | | if (Language.CurrentLanguage != "Chinese") |
| | | { |
| | | helloText = "Good afternoon"; |
| | | } |
| | | curColor = 0xFFE7914F; |
| | | imageFolder = "orange"; |
| | | } |
| | | else |
| | | { |
| | | helloText = "晚上好"; |
| | | if (Language.CurrentLanguage != "Chinese") |
| | | { |
| | | helloText = "Good evening"; |
| | | } |
| | | |
| | | curColor = 0xFF9175F3; |
| | | imageFolder = "purple"; |
| | | } |
| | |
| | | Width = Application.GetRealWidth(60 * sensorCount), |
| | | Gravity = Gravity.Center, |
| | | }; |
| | | infoContentView.AddChidren(sensorListView); |
| | | |
| | | if (sensorCount > 0) |
| | | { |
| | | infoContentView.AddChidren(sensorListView); |
| | | } |
| | | |
| | | if (tempObj != null) |
| | | { |
| | | sensorDiyView_Temp = new SensorDiyView(sensorListView, curColor, tempObj.state == "" ? "--" : tempObj.state, "°", "温度"); |
| | | 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, "%", "湿度"); |
| | | sensorDiyView_Humi = new SensorDiyView(sensorListView, curColor, humiObj.state == "" ? "--" : humiObj.state, "%", Language.StringByID(StringId.Humidity)); |
| | | } |
| | | if (pm25Obj != null) |
| | | { |
| | |
| | | { |
| | | energyCount++; |
| | | } |
| | | |
| | | var energyListView = new HorizontalScrolViewLayout() |
| | | { |
| | | Width = Application.GetRealWidth(100 * energyCount), |
| | | Gravity = Gravity.Center, |
| | | Visible = false, |
| | | }; |
| | | infoContentView.AddChidren(energyListView); |
| | | if (energyCount > 0) |
| | | { |
| | | infoContentView.AddChidren(energyListView); |
| | | } |
| | | if (totalObj != null) |
| | | { |
| | | sensorDiyView_EleActivePower = new SensorDiyView(energyListView, curColor, totalObj.state == "" ? "--" : totalObj.state , "KW", "用电功率", 100); |
| | | string text = "用电功率"; |
| | | if (Language.CurrentLanguage != "Chinese") |
| | | { |
| | | text = "Power"; |
| | | } |
| | | |
| | | sensorDiyView_EleActivePower = new SensorDiyView(energyListView, curColor, totalObj.state == "" ? "--" : totalObj.state , "KW", text, 100); |
| | | } |
| | | if (dayObj != null) |
| | | { |
| | | sensorDiyView_EleDay = new SensorDiyView(energyListView, curColor, dayObj.state == "" ? "--" : dayObj.state , "KW", "今日耗电",100); |
| | | 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) |
| | | { |
| | | sensorDiyView_EleMonth = new SensorDiyView(energyListView, curColor, monthObj.state == "" ? "--" : monthObj.state , "KWh", "本月耗电", 100); |
| | | 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); |
| | |
| | | energyListView.Visible = false; |
| | | } |
| | | }; |
| | | btnChangeClick.MouseUpEventHandler = changeInfoEvent; |
| | | |
| | | if (sensorCount > 0 && energyCount > 0) |
| | | { |
| | | btnChangeClick.MouseUpEventHandler = changeInfoEvent; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | |
| | | Height = Application.GetRealHeight(54), |
| | | }; |
| | | subTitleView.AddChidren(btnTitleText2); |
| | | if(Language.CurrentLanguage != "Chinese") |
| | | { |
| | | btnTitleText2.Text = "My Home"; |
| | | } |
| | | |
| | | int subFunctionCount = 0; |
| | | |
| | |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(100), |
| | | Text = "选择模式", |
| | | TextID = StringId.SelectScene, |
| | | TextSize = 16, |
| | | TextColor = CSS.CSS_Color.FirstLevelTitleColor, |
| | | IsBold = true, |
| | |
| | | BackgroundColor = CSS.CSS_Color.DividingLineColor, |
| | | }); |
| | | IconButton heatHumiIconButton = new IconButton("FunctionIcon/Acst/grey/ModeHeatHumiIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeHeatHumiIcon.png", |
| | | "制热除湿", curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.heat_humidity.ToString()); |
| | | 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(); |
| | |
| | | BackgroundColor = CSS.CSS_Color.DividingLineColor, |
| | | }); |
| | | IconButton humiIconButton = new IconButton("FunctionIcon/Acst/grey/ModeHumiIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeHumiIcon.png", |
| | | "加湿", curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.humidity.ToString()); |
| | | 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(); |
| | |
| | | IsSelected = function.trait_on_off.state == "on" |
| | | }; |
| | | bottomView.AddChidren(btnPowerControl); |
| | | btnPowerControl.MouseUpEventHandler = (sender, e) => { |
| | | btnPowerControl.IsSelected = !btnPowerControl.IsSelected; |
| | | btnPowerControl.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | string msg = btnPowerControl.IsSelected ? "确定关闭总开关吗?" : "确定打开总开关吗?"; |
| | | new PublicAssmebly().TipOptionMsg(StringId.Tip, msg, () => |
| | | { |
| | | btnPowerControl.IsSelected = !btnPowerControl.IsSelected; |
| | | |
| | | new System.Threading.Thread(() => { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, btnPowerControl.IsSelected ? "on" : "off"); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, btnPowerControl.IsSelected ? "on" : "off"); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }); |
| | | }; |
| | | |
| | | |
| | |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(100), |
| | | Text = "选择场景", |
| | | TextID = StringId.SelectScene, |
| | | TextSize = 16, |
| | | TextColor = CSS.CSS_Color.FirstLevelTitleColor, |
| | | IsBold = true, |
| | |
| | | BackgroundColor = CSS.CSS_Color.DividingLineColor, |
| | | }); |
| | | IconButton atHomeIconButton = new IconButton("FunctionIcon/Acst/grey/SceneAtHome.png", $"FunctionIcon/Acst/{imageFolder}/SceneAtHome.png", |
| | | "在家", curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.at_home.ToString()); |
| | | 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(); |
| | |
| | | BackgroundColor = CSS.CSS_Color.DividingLineColor, |
| | | }); |
| | | IconButton awayHomeIconButton = new IconButton("FunctionIcon/Acst/grey/SceneAwayHomeIcon.png", $"FunctionIcon/Acst/{imageFolder}/SceneAwayHomeIcon.png", |
| | | "离家", curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.leave_home.ToString()); |
| | | 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(); |
| | |
| | | BackgroundColor = CSS.CSS_Color.DividingLineColor, |
| | | }); |
| | | IconButton sleepIconButton = new IconButton("FunctionIcon/Acst/grey/SceneSleepIcon.png", $"FunctionIcon/Acst/{imageFolder}/SceneSleepIcon.png", |
| | | Language.StringByID(StringId.Humidity), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.sleep.ToString()); |
| | | 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(); |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = 0xFF1b3053, |
| | | TextSize = 13, |
| | | Text = sub.GetRoomListName(), |
| | | Text = sub.name, |
| | | }; |
| | | subFunctionView.AddChidren(btnRoomInfo); |
| | | |
| | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => { |
| | | var page = new AcstSubPage(sub,imageFolder); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | page.LoadPage(()=> { |
| | | btnRoomInfo.Text = sub.name; |
| | | }); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |