From af4101b1d8461331bc3163b738fc75d4bf67c85c Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 28 七月 2020 17:47:44 +0800 Subject: [PATCH] 2020-07-28-1 --- HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 201 ++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 145 insertions(+), 56 deletions(-) diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs index 1a064c6..8bc0bf6 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs @@ -64,9 +64,14 @@ #endregion + + List<Room> roomsShowed; + public ClassificationPage() { bodyView = this; + roomsShowed = new List<Room>(); + roomsShowed.AddRange(DB_ResidenceData.residenceData.rooms); } public void LoadPage() @@ -172,7 +177,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextAlignment = TextAlignment.CenterLeft, - Text = UserConfig.Instance.CurFoor, + Text = OnAppConfig.Instance.CurFoor, }; roomFloorChangeView.AddChidren(btnFloor); /// <summary> @@ -190,7 +195,6 @@ roomFloorChangeView.AddChidren(btnSwitchDipaly); #endregion - /// <summary> /// 鎴块棿鍒楄〃鍖哄煙 /// </summary> @@ -201,8 +205,20 @@ BackgroundColor = CSS_Color.MainBackgroundColor, }; roomPageView.AddChidren(roomListView); + LoadRoomRows(); + roomListView.AddChidren(new Button() { Height = Application.GetRealHeight(20) });//澶珮瑙嗗浘锛屽皢瀵艰埅浜嗛伄鎸$殑閮ㄥ垎瀹屾暣鏄剧ず + #endregion - foreach (var room in DB_ResidenceData.residenceData.rooms) + LoadDialog_ChangeFloor(); + } + + /// <summary> + /// 鍔犺浇鎴块棿鍒楄〃鍖哄煙 + /// </summary> + void LoadRoomRows () + { + roomListView.RemoveAll(); + foreach (var room in roomsShowed) { var roomView = new FrameLayout() { @@ -256,7 +272,7 @@ Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), - UnSelectedImagePath = "Public/InfoIcon/TempIcon.png", + UnSelectedImagePath = "Public/DeviceInfoIcon/TempIcon.png", }; environmentalView.AddChidren(btnTempIcon); @@ -279,7 +295,7 @@ Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), - UnSelectedImagePath = "Public/InfoIcon/HumidityIcon.png", + UnSelectedImagePath = "Public/DeviceInfoIcon/HumidityIcon.png", }; environmentalView.AddChidren(btnHumidityIcon); @@ -302,7 +318,7 @@ Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), - UnSelectedImagePath = "Public/InfoIcon/Pm25Icon.png", + UnSelectedImagePath = "Public/DeviceInfoIcon/Pm25Icon.png", }; environmentalView.AddChidren(btnPm25Icon); @@ -328,10 +344,10 @@ Width = Application.GetMinRealAverage(58), Height = Application.GetMinRealAverage(58), UnSelectedImagePath = "Classification/Room/AllCloseIcon.png", - Tag = "AllClose" + Tag = "AllClose", + Visible = false }; roomView.AddChidren(btnAllClose); - LoadEvent_CloseAllFunction(btnAllClose, room); var btn = new Button() @@ -348,11 +364,6 @@ }; } - - roomListView.AddChidren(new Button() { Height = Application.GetRealHeight(20) });//澶珮瑙嗗浘锛屽皢瀵艰埅浜嗛伄鎸$殑閮ㄥ垎瀹屾暣鏄剧ず - #endregion - - LoadDialog_ChangeFloor(); } /// <summary> @@ -459,7 +470,7 @@ int functionOnCount = 0; switch (item) { - case FunctionCategory.Light: + case ShowFunction.Light: #region Light btnName.TextID = StringId.Lights; functionCount = DB_ResidenceData.residenceData.functionList.lights.Count; @@ -472,6 +483,7 @@ Height = Application.GetRealWidth(32), SelectedImagePath = "Public/PowerOpen.png", UnSelectedImagePath = "Public/PowerClose.png", + IsSelected = functionCount == functionOnCount }; functionView.AddChidren(btnLightPower); btnLightPower.MouseUpEventHandler = (sender, e) => { @@ -485,7 +497,7 @@ }; #endregion break; - case FunctionCategory.AC: + case ShowFunction.AC: #region AC btnName.TextID = StringId.AC; functionCount = DB_ResidenceData.residenceData.functionList.aCs.Count; @@ -498,6 +510,7 @@ Height = Application.GetRealWidth(32), SelectedImagePath = "Public/PowerOpen.png", UnSelectedImagePath = "Public/PowerClose.png", + IsSelected = functionCount == functionOnCount }; functionView.AddChidren(btnAcPower); btnAcPower.MouseUpEventHandler = (sender, e) => { @@ -511,7 +524,7 @@ }; #endregion break; - case FunctionCategory.Curtain: + case ShowFunction.Curtain: #region Curtain btnName.TextID = StringId.Curtain; functionCount = DB_ResidenceData.residenceData.functionList.curtains.Count; @@ -525,6 +538,7 @@ Height = Application.GetRealWidth(32), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png", + IsSelected = functionCount == functionOnCount }; functionView.AddChidren(btnClose); @@ -549,68 +563,126 @@ }; #endregion break; - case FunctionCategory.FloorHeating: + case ShowFunction.FloorHeating: + #region 鍦扮儹 btnName.TextID = StringId.FloorHeating; + functionCount = DB_ResidenceData.residenceData.functionList.floorHeatings.Count; + functionOnCount = DB_ResidenceData.residenceData.functionList.floorHeatings.FindAll((obj) => obj.on_off == "on").Count; + Button btnFhPower = new Button() + { + X = Application.GetRealWidth(120), + Y = specialList.Contains(index) ? Application.GetRealWidth(160) : Application.GetRealWidth(117), + Width = Application.GetRealWidth(32), + Height = Application.GetRealWidth(32), + SelectedImagePath = "Public/PowerOpen.png", + UnSelectedImagePath = "Public/PowerClose.png", + IsSelected = functionCount == functionOnCount + }; + functionView.AddChidren(btnFhPower); + btnFhPower.MouseUpEventHandler = (sender, e) => { + LoadEvent_SwitchFunction(btnFhPower, item); + }; + btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { + var skipView = new FunctionPage(); + MainPage.BasePageView.AddChidren(skipView); + skipView.LoadPage(StringId.FloorHeating); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + #endregion break; - case FunctionCategory.DoorLock: + case ShowFunction.DoorLock: btnName.TextID = StringId.DoorLock; break; - case FunctionCategory.Electric: + case ShowFunction.Electric: + #region 鐢靛櫒 btnName.TextID = StringId.Electric; + functionCount = DB_ResidenceData.residenceData.functionList.electricals.Count; + functionOnCount = DB_ResidenceData.residenceData.functionList.electricals.FindAll((obj) => obj.on_off == "on").Count; + Button btnElectricPower = new Button() + { + X = Application.GetRealWidth(120), + Y = specialList.Contains(index) ? Application.GetRealWidth(160) : Application.GetRealWidth(117), + Width = Application.GetRealWidth(32), + Height = Application.GetRealWidth(32), + SelectedImagePath = "Public/PowerOpen.png", + UnSelectedImagePath = "Public/PowerClose.png", + IsSelected = functionCount == functionOnCount + }; + functionView.AddChidren(btnElectricPower); + btnElectricPower.MouseUpEventHandler = (sender, e) => { + LoadEvent_SwitchFunction(btnElectricPower, item); + }; + btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { + var skipView = new FunctionPage(); + MainPage.BasePageView.AddChidren(skipView); + skipView.LoadPage(StringId.Electric); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + #endregion break; - case FunctionCategory.EnergyMonitoring: + case ShowFunction.EnergyMonitoring: btnName.TextID = StringId.EnergyMonitoring; break; - case FunctionCategory.Environmental: - btnName.TextID = StringId.Environmental; + case ShowFunction.Environmental: + #region 鐜鏁版嵁 + btnName.TextID = StringId.EnvironmentalData; + btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { + var skipView = new EnvironmentalSciencePage(); + MainPage.BasePageView.AddChidren(skipView); + skipView.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + #endregion break; - case FunctionCategory.FreshAir: + case ShowFunction.FreshAir: btnName.TextID = StringId.FreshAir; break; - case FunctionCategory.Music: + case ShowFunction.Music: btnName.TextID = StringId.Music; + btnFunctionViewBg.MouseUpEventHandler = (sender, e) => + { + var musicMain = new HDL_ON.UI.Music.MusicMain(); + MainPage.BasePageView.AddChidren(musicMain); + musicMain.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + break; - case FunctionCategory.Panel: + case ShowFunction.Panel: btnName.TextID = StringId.Panel; break; - case FunctionCategory.SecurityMonitoring: + case ShowFunction.SecurityMonitoring: btnName.TextID = StringId.SecurityMonitoring; break; - case FunctionCategory.Sensor: + case ShowFunction.Sensor: btnName.TextID = StringId.Sensor; + break; - case FunctionCategory.VideoIntercom: + case ShowFunction.VideoIntercom: btnName.TextID = StringId.VideoIntercom; break; } - - Button btnFunctionCount = new Button() + if (item != ShowFunction.Environmental) { - X = Application.GetRealWidth(16), - Y = btnName.Bottom, - Width = Application.GetRealWidth(120), - Height = Application.GetRealHeight(24), - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.TextFontSize, - TextAlignment = TextAlignment.CenterLeft, - Text = functionOnCount + "/" + functionCount, - Tag = item + "_onCount" - }; - functionView.AddChidren(btnFunctionCount); - - - - + Button btnFunctionCount = new Button() + { + X = Application.GetRealWidth(16), + Y = btnName.Bottom, + Width = Application.GetRealWidth(120), + Height = Application.GetRealHeight(24), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.CenterLeft, + Text = functionOnCount + "/" + functionCount, + Tag = item + "_onCount" + }; + functionView.AddChidren(btnFunctionCount); + } index++; } - - - #endregion - } - #region 鍒囨崲妤煎眰 /// <summary> @@ -631,7 +703,7 @@ X = Application.GetRealWidth(10), Y = Application.GetRealHeight(100), Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(190), + Height = Application.GetRealHeight(203), BackgroundImagePath = "PersonalCenter/HomeListbg.png", }; dialogBody.AddChidren(dispalyView); @@ -639,15 +711,18 @@ var contentView = new VerticalScrolViewLayout() { X = Application.GetRealWidth(8), - Y = Application.GetRealHeight(10), + Y = Application.GetRealHeight(15), Width = Application.GetRealWidth(150), - Height = Application.GetRealHeight(44 * 4), + Height = Application.GetRealHeight(45 * 4), }; dispalyView.AddChidren(contentView); List<string> chooseList = new List<string>(); chooseList.Add(Language.StringByID(StringId.All)); - chooseList.AddRange(DB_ResidenceData.residenceData.floors); + foreach (var f in DB_ResidenceData.residenceData.floors) + { + chooseList.Add(f.name); + } foreach (var floor in chooseList) { @@ -680,9 +755,23 @@ btnHomeName.MouseUpEventHandler += (senderH, en) => { dialog.Close(); - btnFloor.Text = floor; - UserConfig.Instance.SaveUserConfig(); + roomsShowed.Clear(); + if (floor == Language.StringByID(StringId.All)) + { + roomsShowed.AddRange(DB_ResidenceData.residenceData.rooms); + } + else + { + foreach (var room in DB_ResidenceData.residenceData.rooms) + { + if (room.floor == floor) + { + roomsShowed.Add(room); + } + } + } + LoadRoomRows(); }; } -- Gitblit v1.8.0