From 66c72ee19b9e3543537621b8dd25685c9b5c03c4 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 02 八月 2022 14:05:30 +0800 Subject: [PATCH] RGB色盘优化,第三方平台对接功能 --- HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs | 151 +++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 117 insertions(+), 34 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs index 986a5d1..56c39d1 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs @@ -8,8 +8,10 @@ { public class Iot_BrandFunctionListPage :FrameLayout { - FrameLayout bodyView; + + FrameLayout contentView; + IntegratedBrand_Iot brand_Iot; @@ -36,7 +38,7 @@ page.LoadPage(brand_Iot); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; - new TopViewDiv(bodyView, "鍝佺墝鍚嶇О").LoadTopView_3tyIot(action); + new TopViewDiv(bodyView, brand_Iot.brandName).LoadTopView_3tyIot(action); bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; @@ -65,16 +67,43 @@ }; bodyView.AddChidren(btnTipText); - var contentView = new VerticalRefreshLayout() + contentView = new FrameLayout() { Y = Application.GetRealHeight(150), Height = Application.GetRealHeight(573), }; bodyView.AddChidren(contentView); - LoadDeviceFunctionControlZone(contentView); - + var waitPage = new Loading(); + contentView.AddChidren(waitPage); + waitPage.Start(""); + new System.Threading.Thread(() => + { + try + { + var pack = http.Get3tyIotDeviceFunctionList(brand_Iot.companyId); + if (pack != null) + { + if (pack.Code == StateCode.SUCCESS) + { + var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Function>>(pack.Data.ToString()); + Application.RunOnMainThread(() => + { + LoadDeviceFunctionControlZone(list); + }); + } + } + } + catch { } + finally + { + Application.RunOnMainThread(() => { + waitPage.Hide(); + waitPage.RemoveFromParent(); + }); + } + }) { IsBackground = true }.Start(); } @@ -82,26 +111,32 @@ /// <summary> /// 鍔犺浇璁惧鍔熻兘鏄剧ず鍖哄煙 /// </summary> - void LoadDeviceFunctionControlZone(VerticalRefreshLayout deviceFunctionView) + void LoadDeviceFunctionControlZone(List<Function> list) { + contentView.RemoveAll(); + + if (list.Count == 0) + { + NotListTipView(); + return; + } + + VerticalScrolViewLayout deviceFunctionView = new VerticalScrolViewLayout(); + contentView.AddChidren(deviceFunctionView); + #region ContextView var rowView = new FrameLayout(); try { int index = 0; - var list = new List<Function>(); - list.Add(new Function - { - spk = SPK.AcStandard, - name = "绌鸿皟" - }); - list.Add(new Function - { - spk = SPK.LightDimming, - name = "鐏厜" - }); + foreach (var function in list) { + if(function.homeId != DB_ResidenceData.Instance.CurrentRegion.id && function.homeId != "0") + { + continue; + } + if (index % 2 == 0) { rowView = new FrameLayout() @@ -143,24 +178,14 @@ var view = new FrameLayout(); deviceFunctionView.AddChidren(view); - var btnNoCollectionBg = new Button() - { - Y = Application.GetRealHeight(20), - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(180), - Height = Application.GetRealWidth(180), - Text = "娌℃湁浠讳綍璁惧" - }; - view.AddChidren(btnNoCollectionBg); - var btnNoCollectionTip = new Button() { Height = Application.GetRealHeight(42), - Y = btnNoCollectionBg.Bottom, + Y = Application.GetRealHeight(100), TextAlignment = TextAlignment.Center, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - TextID = StringId.TipNoFunctionCollcetion, + Text = "娌℃湁浠讳綍璁惧" }; view.AddChidren(btnNoCollectionTip); } @@ -215,20 +240,25 @@ function.collect = !function.collect; if (function.collect) { - btnName.IsSelected = btnIcon.IsSelected = btnBg.IsSelected = true; - var pack = http.Set3tyIotFunctionToHouse(function.deviceId, DB_ResidenceData.Instance.CurrentRegion.id); + var pack = http.Set3tyIotFunctionToHouse(function.deviceId, DB_ResidenceData.Instance.CurrentRegion.id,brand_Iot.companyId); if (pack != null) { - + if(pack.Code == StateCode.SUCCESS) + { + btnName.IsSelected = btnIcon.IsSelected = btnBg.IsSelected = true; + } } } else { btnName.IsSelected = btnIcon.IsSelected = btnBg.IsSelected = false; - var pack = http.Set3tyIotFunctionToHouse(function.deviceId, "0"); + var pack = http.Set3tyIotFunctionToHouse(function.deviceId, "0", brand_Iot.companyId); if (pack != null) { - + if (pack.Code == StateCode.SUCCESS) + { + btnName.IsSelected = btnIcon.IsSelected = btnBg.IsSelected = false; + } } } @@ -242,6 +272,59 @@ } + void NotListTipView() + { + contentView.RemoveAll(); + var btnTip = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(88), + Width = Application.GetRealWidth(180), + Height = Application.GetRealWidth(180), + UnSelectedImagePath = "TipNot.png", + }; + contentView.AddChidren(btnTip); + + var btnTipText = new Button() + { + Y = Application.GetRealHeight(252), + Height = Application.GetRealHeight(52), + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.FirstLevelTitleColor, + TextAlignment = TextAlignment.Center, + TextID = StringId.TipNotThirdPartyDevice, + }; + contentView.AddChidren(btnTipText); + + var btnAdd = new Button() + { + Y = Application.GetRealHeight(400), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(220), + Height = Application.GetRealWidth(44), + BackgroundColor = CSS_Color.MainColor, + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainBackgroundColor, + TextSize = CSS_FontSize.SubheadingFontSize, + IsBold = true, + Radius = (uint)Application.GetRealWidth(22), + BorderColor = 0x00000000, + BorderWidth = 0, + Text = "鏌ョ湅璁惧鏀寔鑼冨洿" + }; + contentView.AddChidren(btnAdd); + btnAdd.MouseUpEventHandler = (sender, e) => + { + //var page = new AddThirdPartyBrandListpage(brandList); + //MainPage.BasePageView.AddChidren(page); + //page.LoadPage(); + //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + + + } + HttpServerRequest http = new HttpServerRequest(); -- Gitblit v1.8.0