| | |
| | | |
| | | FrameLayout contentView; |
| | | |
| | | FrameLayout optionView; |
| | | |
| | | |
| | | IntegratedBrand_Iot brand_Iot; |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | Padding = new Padding(12, Application.GetRealWidth(16), 12, Application.GetRealWidth(16)), |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = "默认将第三方品牌的设备全部关联到On Pro上,您也可以通过下方的开关按键,进行选择性关联。", |
| | | Text = "*您可以将第三方品牌的设备关联到On Pro您当前的住宅上。", |
| | | IsMoreLines = true, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | bodyView.AddChidren(btnTipText); |
| | | if (Language.CurrentLanguage != "Chinese") |
| | | { |
| | | btnTipText.Text = "*You can associate third-party branded devices with on Pro's current home."; |
| | | } |
| | | |
| | | contentView = new FrameLayout() |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | var pack0 = http.Search3tyIotDevice(brand_Iot.companyId); |
| | | if(pack0 != null) |
| | | { |
| | | |
| | | } |
| | | var pack = http.Get3tyIotDeviceFunctionList(brand_Iot.companyId); |
| | | if (pack != null) |
| | | { |
| | |
| | | }); |
| | | } |
| | | }) { IsBackground = true }.Start(); |
| | | |
| | | |
| | | optionView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(667 - 80), |
| | | Height = Application.GetRealHeight(90), |
| | | Radius = (uint)Application.GetRealWidth(22), |
| | | Visible = false, |
| | | }; |
| | | bodyView.AddChidren(optionView); |
| | | |
| | | |
| | | var btnComfirm = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(14), |
| | | Width = Application.GetRealWidth(164), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | BackgroundColor = CSS_Color.MainColor, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.Confirm, |
| | | Radius = (uint)Application.GetRealHeight(22) |
| | | }; |
| | | optionView.AddChidren(btnComfirm); |
| | | btnComfirm.MouseUpEventHandler = (sender, e) => { |
| | | |
| | | var pack = http.Set3tyIotFunctionToHouse(optionList, DB_ResidenceData.Instance.CurrentRegion.id, brand_Iot.companyId); |
| | | if (pack != null) |
| | | { |
| | | if (pack.Code == StateCode.SUCCESS) |
| | | { |
| | | btnComfirm.Visible = false; |
| | | } |
| | | } |
| | | //var pack = http.Set3tyIotFunctionToHouse(function.deviceId, "0", brand_Iot.companyId); |
| | | //if (pack != null) |
| | | //{ |
| | | // if (pack.Code == StateCode.SUCCESS) |
| | | // { |
| | | // btnName.IsSelected = btnIcon.IsSelected = btnCheckIcon.IsSelected = false; |
| | | // } |
| | | //} |
| | | |
| | | }; |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | var btnbg = new Button() |
| | | { |
| | | UnSelectedImagePath = "Collection/Functionbg.png", |
| | | SelectedImagePath = "Collection/FunctionOnbg.png", |
| | | SelectedImagePath = "Collection/Functionbg.png", |
| | | Tag = function.sid |
| | | }; |
| | | functionView.AddChidren(btnbg); |
| | | LoadDeviceFunctionDiv(functionView, function,btnbg); |
| | | LoadDeviceFunctionDiv(functionView, function); |
| | | index++; |
| | | |
| | | |
| | |
| | | Text = "没有任何设备" |
| | | }; |
| | | view.AddChidren(btnNoCollectionTip); |
| | | if (Language.CurrentLanguage != "Chinese") |
| | | { |
| | | btnNoCollectionTip.Text = "No equipment"; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | deviceFunctionView.AddChidren(new Button { Height = Application.GetRealHeight(30) }); |
| | | #endregion |
| | | |
| | | |
| | | deviceFunctionView.AddChidren(new Button { |
| | | Height = Application.GetRealHeight(90), |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载功能控制卡片 |
| | | /// </summary> |
| | | void LoadDeviceFunctionDiv(FrameLayout view, Function function,Button btnBg) |
| | | void LoadDeviceFunctionDiv(FrameLayout view, Function function) |
| | | { |
| | | try |
| | | { |
| | | |
| | | |
| | | var btnCheckIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(22), |
| | | Y = Application.GetRealHeight(16), |
| | | Width = Application.GetRealWidth(21), |
| | | Height = Application.GetRealWidth(21), |
| | | UnSelectedImagePath = "Public/IotCheckIcon.png", |
| | | SelectedImagePath = "Public/IotCheckOnIcon.png", |
| | | }; |
| | | view.AddChidren(btnCheckIcon); |
| | | |
| | | Button btnIcon; |
| | | btnIcon = new Button() |
| | | { |
| | |
| | | Button btnClick = new Button(); |
| | | view.AddChidren(btnClick); |
| | | btnClick.MouseUpEventHandler = (sender, e) => { |
| | | function.collect = !function.collect; |
| | | if (function.collect) |
| | | btnCheckIcon.IsSelected = function.collect = !function.collect; |
| | | if (optionList.Contains(function.deviceId)) |
| | | { |
| | | 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; |
| | | } |
| | | } |
| | | optionList.Remove(function.deviceId); |
| | | } |
| | | else |
| | | { |
| | | btnName.IsSelected = btnIcon.IsSelected = btnBg.IsSelected = false; |
| | | 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; |
| | | } |
| | | } |
| | | optionList.Add(function.deviceId); |
| | | } |
| | | |
| | | optionView.Visible = true; |
| | | }; |
| | | |
| | | if (function.homeId == DB_ResidenceData.Instance.CurrentRegion.id ) |
| | | { |
| | | btnCheckIcon.IsSelected = true; |
| | | optionList.Add(function.deviceId); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log("homepage LoadControlView error : " + ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 记录需要操作的列表 |
| | | /// </summary> |
| | | private List<string> optionList = new List<string>(); |
| | | |
| | | |
| | | void NotListTipView() |
| | |
| | | BorderWidth = 0, |
| | | Text = "查看设备支持范围" |
| | | }; |
| | | contentView.AddChidren(btnAdd); |
| | | //contentView.AddChidren(btnAdd); |
| | | btnAdd.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //var page = new AddThirdPartyBrandListpage(brandList); |