| | |
| | | { |
| | | public class Iot_BrandFunctionListPage :FrameLayout |
| | | { |
| | | |
| | | FrameLayout bodyView; |
| | | |
| | | FrameLayout contentView; |
| | | |
| | | |
| | | |
| | | IntegratedBrand_Iot brand_Iot; |
| | |
| | | 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; |
| | | |
| | |
| | | }; |
| | | 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(); |
| | | |
| | | } |
| | | |
| | |
| | | /// <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() |
| | |
| | | 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); |
| | | } |
| | |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | 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(); |
| | | |