From 6d73bf6e816570291865674bef8bce8972e4de3f Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期三, 01 十二月 2021 16:32:57 +0800 Subject: [PATCH] 2021-12-01-01 --- HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs | 65 +++++++++++++++++++++++++++----- 1 files changed, 55 insertions(+), 10 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs index a876af9..68ac66b 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs @@ -1,5 +1,6 @@ 锘縰sing System; using System.Collections.Generic; +using HDL_ON.DAL.Server; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; @@ -17,7 +18,7 @@ brand = integratedBrand; } - public void LoadPage() + public void LoadPage(VerticalRefreshLayout refreshView) { new TopViewDiv(bodyView, Language.StringByID(StringId.AddDevice)).LoadTopView(); bodyView.BackgroundColor = CSS_Color.BackgroundColor; @@ -32,27 +33,35 @@ - Load3tyBrandDeviceList(); + Load3tyBrandDeviceList(refreshView); + contentView.BeginHeaderRefreshingAction = () => + { + contentView.EndHeaderRefreshing(); + Load3tyBrandDeviceList(refreshView); + }; } - void Load3tyBrandDeviceList() + void Load3tyBrandDeviceList(VerticalRefreshLayout refreshView) { var waitPage = new Loading(); waitPage.Start(); new System.Threading.Thread(() => { try { - var pm = new DAL.Server.HttpServerRequest(); - //var result = pm.Get3tyBindBrandList + var pm = new HttpServerRequest(); var pack = pm.Get3TyBrandDeviceList(brand.productPlatform, brand.productBrand); - if (pack.Code == DAL.Server.StateCode.SUCCESS) + if (pack.Code == StateCode.SUCCESS) { var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<IntegratedBrandDevice>>(pack.Data.ToString()); Application.RunOnMainThread(() => { - LoadRow(revData); + LoadRow(revData, refreshView); }); + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); } } catch (Exception ex) @@ -61,13 +70,20 @@ } finally { - Application.RunOnMainThread(() => { waitPage.Hide(); }); + Application.RunOnMainThread(() => + { + if (waitPage != null) + { + waitPage.RemoveFromParent(); + waitPage = null; + } + }); } }) { IsBackground = true }.Start(); } - void LoadRow(List<IntegratedBrandDevice> deviceList) + void LoadRow(List<IntegratedBrandDevice> deviceList, VerticalRefreshLayout refreshView) { contentView.RemoveAll(); bool isFrist = true; @@ -103,7 +119,7 @@ Width = Application.GetRealWidth(32), Height = Application.GetRealWidth(32), Radius = (uint)Application.GetRealWidth(4), - UnSelectedImagePath = $"FunctionIcon/Icon/{device.spk.Replace(".","")}.png", + UnSelectedImagePath = $"FunctionIcon/Icon/{device.IconName}.png", }; row.AddChidren(btnIcon); Button btnRight = new Button() @@ -133,6 +149,35 @@ case SPK.IrModule: var form = new AddMiniRemoteControlDirection1Page(); form.AddForm(); + form.AddDeviceEvent = (functionObj) => { + refreshView.BeginHeaderRefreshing(); + }; + break; + case SPK.SenesorMegahealth: + case SPK.SenesorMegahealth2: + var form1 = new AddSenesorMegahealthDirection1Page(); + form1.AddForm(device); + form1.AddDeviceEvent = (functionObj) => { + refreshView.BeginHeaderRefreshing(); + this.RemoveFromParent(); + }; + break; + case SPK.SensorEnvironment: + var form2 = new AddSensorEnvironmentPage(); + form2.AddForm(device); + form2.AddDeviceEvent = (functionObj) => { + refreshView.BeginHeaderRefreshing(); + this.RemoveFromParent(); + }; + break; + case SPK.SensorEnvironment2: + case SPK.SensorEnvironment3: + var form3 = new AddQingpingSensorEnvirTipPage(); + form3.AddForm(device); + form3.AddDeviceEvent = (functionObj) => { + refreshView.BeginHeaderRefreshing(); + this.RemoveFromParent(); + }; break; } }; -- Gitblit v1.8.0