using System; using Shared; using HDL_ON.Entity; using HDL_ON.UI.CSS; namespace HDL_ON.UI { public partial class FloorHeatingPage : FrameLayout { #region 控件集合 static FloorHeatingPage bodyView; /// /// 功能名称按钮 /// Button btnFunctionName; /// /// 房间楼层信息按钮 /// Button btnFromFoorAndRoom; /// /// 收藏按钮 /// Button btnCollection; /// /// 空调温度控制控件 /// DiyArcSeekBar arcBar; /// /// 减号按钮 /// Button btnMinus; /// /// 加号按钮 /// Button btnPlus; /// /// 温度按钮 /// Button btnTemp; Button btnTempUint; /// /// 室内温度按钮 /// Button btnIndoorTemp; /// /// 模式按钮 /// Button btnMode; /// /// 电源按钮 /// Button btnSwitch; /// /// 修改模式信息区域 /// //FrameLayout modeChangeView; /// /// 修改风速信息区域 /// //FrameLayout fanChangeView; #endregion #region 区域变量 FloorHeating fh; Button btnCollection_Out; Button btnFunctionName_Out; Button btnFromFloor_Out; /// /// 刷新显示信息 /// Action actionRefresh; #endregion public FloorHeatingPage(FloorHeating func) { bodyView = this; fh = func; } public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut) { bodyView.BackgroundColor = CSS_Color.BackgroundColor; btnCollection_Out = btnCollectionIcon; btnFunctionName_Out = btnFunctionNameOut; btnFromFloor_Out = btnFromFloorOut; FrameLayout controlView = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(88), Width = Application.GetRealWidth(327), Height = Application.GetRealHeight(526), BackgroundImagePath = "Public/Fragmentbg.png", }; bodyView.AddChidren(controlView); btnFunctionName = new Button() { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(14), Width = Application.GetRealWidth(270), Height = Application.GetRealHeight(37), TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, Text = fh.name, }; controlView.AddChidren(btnFunctionName); btnFromFoorAndRoom = new Button() { X = Application.GetRealWidth(16), Y = btnFunctionName.Bottom, Width = Application.GetRealWidth(270), Height = Application.GetRealHeight(21), TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, Text = fh.GetRoomListName() }; controlView.AddChidren(btnFromFoorAndRoom); btnCollection = new Button() { X = Application.GetRealWidth(273), Y = Application.GetRealHeight(14), Width = Application.GetMinRealAverage(40), Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", IsSelected = fh.collection }; controlView.AddChidren(btnCollection); arcBar = new DiyArcSeekBar() { Gravity = Gravity.CenterHorizontal, OpenAngle = 160, ThumbImagePath = fh.trait_on_off.value.ToString() == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png", ThumbImageHeight = Application.GetRealWidth(50), ProgressBarColor = fh.trait_on_off.value.ToString() == "on" ? CSS_Color.MainColor : CSS_Color.PromptingColor2, // 0xFFFC9C04 : CSS_Color.PromptingColor2, MinValue = 5, MaxValue = 35, IsClickable = fh.trait_on_off.value.ToString() == "on", ArcColor = CSS_Color.BackgroundColor, Progress = Convert.ToInt32(fh.trait_temp.value), #if __IOS__ Y = Application.GetRealHeight(120+25), Width = Application.GetRealWidth(260-40), Height = Application.GetRealWidth(260-40), SeekBarPadding = Application.GetRealWidth(8), #else Y = Application.GetRealHeight(120 + 40), Width = Application.GetRealWidth(260 - 40), Height = Application.GetRealWidth(260 - 40), SeekBarPadding = Application.GetRealWidth(7), #endif }; controlView.AddChidren(arcBar); btnTemp = new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(200), Width = Application.GetRealWidth(80), Height = Application.GetRealWidth(60), TextColor = CSS_Color.FirstLevelTitleColor, TextSize = 56, IsBold = true, Text = fh.trait_temp.value.ToString(), TextAlignment = TextAlignment.Center, }; controlView.AddChidren(btnTemp); btnTempUint = new Button() { X = btnTemp.Right, Y = btnTemp.Y, Width = Application.GetRealWidth(30), Height = Application.GetRealWidth(25), TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.EmphasisFontSize_Secondary, IsBold = true, TextAlignment = TextAlignment.CenterLeft, Text = fh.tempUnitString }; controlView.AddChidren(btnTempUint); btnIndoorTemp = new Button() { Gravity = Gravity.CenterHorizontal, Y = btnTemp.Bottom+ Application.GetRealWidth(10), Width = Application.GetRealWidth(100), Height = Application.GetRealHeight(20), Text = Language.StringByID(StringId.IndoorTemp) + "20°C", TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, }; controlView.AddChidren(btnIndoorTemp); btnMinus = new Button() { X = Application.GetRealWidth(21), Y = Application.GetRealHeight(263), Width = Application.GetRealWidth(32), Height = Application.GetRealWidth(32), UnSelectedImagePath = "Public/MinusSignIcon.png", }; controlView.AddChidren(btnMinus); btnPlus = new Button() { X = Application.GetRealWidth(275), Y = Application.GetRealHeight(263), Width = Application.GetRealWidth(32), Height = Application.GetRealWidth(32), UnSelectedImagePath = "Public/PlusSignIcon.png", }; controlView.AddChidren(btnPlus); btnMode = new Button() { X = Application.GetRealWidth(235), Y = Application.GetRealHeight(337), Width = Application.GetRealWidth(30), Height = Application.GetRealWidth(30), UnSelectedImagePath = fh.curModeImage, }; controlView.AddChidren(btnMode); btnSwitch = new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(462), Width = Application.GetRealWidth(40), Height = Application.GetRealWidth(40), UnSelectedImagePath = "Public/PowerClose.png", SelectedImagePath = "Public/PowerOpen.png", IsSelected = fh.trait_on_off.value.ToString() == "on" }; controlView.AddChidren(btnSwitch); LoadEventList(); new TopViewDiv(bodyView, Language.StringByID(StringId.LocationManagement)).LoadTopView_FunctionTop(fh, actionRefresh); } /// /// 加载修改模式区域 /// void LoadDiv_ChangeModeView() { Dialog dialog = new Dialog(); FrameLayout dialogView = new FrameLayout() { BackgroundColor = CSS_Color.DialogTransparentColor1, }; dialog.AddChidren(dialogView); FrameLayout modeChangeView; modeChangeView = new FrameLayout() { X = Application.GetRealWidth(185), Y = Application.GetRealHeight(128), Width = Application.GetRealWidth(160), Height = Application.GetRealHeight(287), BackgroundImagePath = "FunctionIcon/AC/DivBg1.png", AnimateSpeed = 0.3f, Animate = Animate.DownToUp, }; dialogView.AddChidren(modeChangeView); Button btnTitle; btnTitle = new Button() { X = Application.GetRealWidth(8 + 16), Y = Application.GetRealHeight(8), Width = Application.GetRealWidth(112), Height = Application.GetRealHeight(44), TextID = StringId.ChooseMode, TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.EmphasisFontSize_Secondary, }; modeChangeView.AddChidren(btnTitle); Button btnLine = new Button() { X = btnTitle.X, Y = btnTitle.Bottom, Width = Application.GetRealWidth(112), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.BackgroundColor, }; modeChangeView.AddChidren(btnLine); foreach (var m in fh.trait_mode.value_key) { Button btnModeIcon = new Button() { X = btnTitle.X, Y = Application.GetRealHeight(44 * (fh.trait_mode.value_key.IndexOf(m) + 1) + 10 + 8), Width = Application.GetRealWidth(24), Height = Application.GetRealWidth(24), IsSelected = fh.trait_mode.value.ToString() == m, }; modeChangeView.AddChidren(btnModeIcon); Button btnModeText = new Button() { X = Application.GetRealWidth(12) + btnModeIcon.Right, Y = Application.GetRealHeight(44 * (fh.trait_mode.value_key.IndexOf(m) + 1) + 8), Height = Application.GetRealHeight(44), Width = Application.GetRealWidth(70), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, SelectedTextColor = CSS_Color.MainColor, IsSelected = fh.trait_mode.value.ToString() == m, }; modeChangeView.AddChidren(btnModeText); switch (m) { case "day": btnModeIcon.SelectedImagePath = "FunctionIcon/AC/HeatingIcon.png"; btnModeIcon.UnSelectedImagePath = "FunctionIcon/AC/HeatingIconGray.png"; btnModeText.TextID = StringId.Day; break; case "night": btnModeIcon.SelectedImagePath = "FunctionIcon/FloorHeating/NightIcon.png"; btnModeIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/NightIconGray.png"; btnModeText.TextID = StringId.Night; break; case "away": btnModeIcon.SelectedImagePath = "FunctionIcon/FloorHeating/AwayIcon.png"; btnModeIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/AwayIconGray.png"; btnModeText.TextID = StringId.Away; break; case "timer": btnModeIcon.SelectedImagePath = "FunctionIcon/AC/AutoIcon.png"; btnModeIcon.UnSelectedImagePath = "FunctionIcon/AC/AutoIconGray.png"; btnModeText.TextID = StringId.Auto; break; case "normal": btnModeIcon.SelectedImagePath = "FunctionIcon/FloorHeating/OrdinaryIcon.png"; btnModeIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/OrdinaryIconGray.png"; btnModeText.TextID = StringId.Normal; break; } if (fh.trait_mode.value_key.IndexOf(m) < fh.trait_mode.value_key.Count - 1) { modeChangeView.AddChidren(new Button() { X = btnTitle.X, Y = btnModeText.Bottom, Width = Application.GetRealWidth(112), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.BackgroundColor, }); } LoadEvent_ChangeMode(dialog, dialogView, btnModeIcon, btnModeText, m); } dialogView.MouseUpEventHandler = (sender, e) => { dialog.Close(); }; dialog.Show(); } } }