| | |
| | | /// </summary> |
| | | Button btnChangeScene; |
| | | /// <summary> |
| | | /// 切换显示场组控按钮 |
| | | /// </summary> |
| | | Button btnChangeGroupControl; |
| | | /// <summary> |
| | | /// 功能显示区域 |
| | | /// </summary> |
| | | PageLayout contentView; |
| | |
| | | /// </summary> |
| | | VerticalScrolViewLayout sceneFunctionView; |
| | | /// <summary> |
| | | /// 组控控制区域 |
| | | /// </summary> |
| | | VerticalScrolViewLayout gcFunctionView; |
| | | /// <summary> |
| | | /// 功能区域集合 |
| | | /// </summary> |
| | | List<FrameLayout> functionViews; |
| | |
| | | #region 区域变量 |
| | | /// <summary> |
| | | /// 当前显示对控制类型是否是设备功能控制 |
| | | /// 0 功能 |
| | | /// 1 场景 |
| | | /// 2 群控 |
| | | /// </summary> |
| | | bool CurShowTypeIsFunction = true; |
| | | int CurShowTypeContent = 0; |
| | | #endregion |
| | | |
| | | #region 报警信息 |
| | |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | |
| | | this.VerticalScrollBarEnabled = false; |
| | | |
| | | #if DEBUG |
| | | DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl = true; |
| | | #endif |
| | | |
| | | #if __IOS__ |
| | | //自动偏移取消 |
| | | if (UIKit.UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) |
| | |
| | | bodyView.EndHeaderRefreshing(); |
| | | Common.ApiUtlis.Ins.DownloadData(); |
| | | LoadContentView(); |
| | | if (!CurShowTypeIsFunction) |
| | | { |
| | | contentView.PageIndex = 1; |
| | | } |
| | | contentView.PageIndex = CurShowTypeContent; |
| | | }; |
| | | topView = new FrameLayout() |
| | | { |
| | |
| | | refreshLayout.EndHeaderRefreshing(); |
| | | Common.ApiUtlis.Ins.DownloadData(); |
| | | LoadContentView(); |
| | | if(!CurShowTypeIsFunction) |
| | | { |
| | | contentView.PageIndex = 1; |
| | | } |
| | | contentView.PageIndex = CurShowTypeContent; |
| | | }; |
| | | topView = new FrameLayout() |
| | | { |
| | |
| | | deviceId = enviTemp.deviceId, |
| | | attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = humiAttr.state, curValue = humiAttr.curValue } }, |
| | | }; |
| | | humiSensorList.Add(newTemp); |
| | | humiSensorList.Add(newTemp);//020103CF594C3E00051F0001051F// 1650546588519424001 |
| | | } |
| | | var tempAttr = enviTemp.attributes.Find((obj) => obj.key == "temperature"); |
| | | if (tempAttr != null) |
| | |
| | | deviceId = enviTemp.deviceId, |
| | | attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = tempAttr.state, curValue = tempAttr.curValue } }, |
| | | }; |
| | | tempSensorList.Add(newTemp); |
| | | tempSensorList.Add(newTemp);//020103CF594C3E00051F0001051F |
| | | } |
| | | } |
| | | |
| | |
| | | foreach (var temp in tempSensorList) |
| | | { |
| | | double tempValue = 0; |
| | | double.TryParse(temp.GetAttrState("temperature"), out tempValue); |
| | | if (temp.GetAttribute("temperature") != null) |
| | | double.TryParse(temp.GetAttrState("temperature"), out tempValue); |
| | | else |
| | | double.TryParse(temp.GetAttrState("value"), out tempValue); |
| | | if (tempValue > 0) |
| | | { |
| | | tempTotalValues += tempValue; |
| | |
| | | foreach (var humi in humiSensorList) |
| | | { |
| | | double humiValue = 0; |
| | | double.TryParse(humi.GetAttrState("humidity"), out humiValue); |
| | | if (humi.GetAttribute("temperature") != null) |
| | | double.TryParse(humi.GetAttrState("humidity"), out humiValue); |
| | | else |
| | | double.TryParse(humi.GetAttrState("value"), out humiValue); |
| | | if (humiValue > 0) |
| | | { |
| | | humiTotalValues += humiValue; |
| | |
| | | }; |
| | | btnPm25Values.Width = btnPm25Values.GetTextWidth(); |
| | | environmentalView.AddChidren(btnPm25Values); |
| | | #endregion |
| | | #endregion |
| | | |
| | | |
| | | btnSecurityStatus = new Button() |
| | | { |
| | |
| | | |
| | | bodyView.AddChidren(new Button() { Height = Application.GetRealHeight(20), BackgroundColor = 0x00000000 }); |
| | | |
| | | changeView = new FrameLayout() |
| | | if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl) |
| | | { |
| | | //Y = Application.GetRealHeight(20) + topView.Bottom, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(230), |
| | | Height = Application.GetRealHeight(62), |
| | | BackgroundImagePath = "Collection/ChangeViewbg.png", |
| | | }; |
| | | bodyView.AddChidren(changeView); |
| | | changeView = new FrameLayout() |
| | | { |
| | | //Y = Application.GetRealHeight(20) + topView.Bottom, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(334), |
| | | Height = Application.GetRealHeight(62), |
| | | BackgroundImagePath = "Collection/ChangeViewbg.png", |
| | | }; |
| | | bodyView.AddChidren(changeView); |
| | | |
| | | btnChangeFunction = new Button() |
| | | btnChangeFunction = new Button() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Width = Application.GetRealWidth(114 - 10), |
| | | TextID = StringId.Functions, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.HeadlineFontSize, |
| | | TextAlignment = TextAlignment.Center, |
| | | IsSelected = true, |
| | | IsBold = true, |
| | | }; |
| | | changeView.AddChidren(btnChangeFunction); |
| | | |
| | | Button btnLine = new Button() |
| | | { |
| | | X = btnChangeFunction.Right, |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(1), |
| | | Height = Application.GetRealHeight(14), |
| | | BackgroundColor = CSS_Color.PromptingColor1, |
| | | }; |
| | | changeView.AddChidren(btnLine); |
| | | |
| | | btnChangeScene = new Button() |
| | | { |
| | | X = btnLine.Right, |
| | | Width = Application.GetRealWidth(114 - 10), |
| | | TextID = StringId.Scenes, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | changeView.AddChidren(btnChangeScene); |
| | | |
| | | Button btnLine2 = new Button() |
| | | { |
| | | X = btnChangeScene.Right, |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(1), |
| | | Height = Application.GetRealHeight(14), |
| | | BackgroundColor = CSS_Color.PromptingColor1, |
| | | }; |
| | | changeView.AddChidren(btnLine2); |
| | | |
| | | btnChangeGroupControl = new Button() |
| | | { |
| | | X = btnLine2.Right, |
| | | Width = Application.GetRealWidth(114 - 10), |
| | | TextID = StringId.GroupControl, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | changeView.AddChidren(btnChangeGroupControl); |
| | | } |
| | | else |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Width = Application.GetRealWidth(114-10), |
| | | TextID = StringId.Functions, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.HeadlineFontSize, |
| | | TextAlignment = TextAlignment.Center, |
| | | IsSelected = true, |
| | | IsBold = true, |
| | | }; |
| | | changeView.AddChidren(btnChangeFunction); |
| | | changeView = new FrameLayout() |
| | | { |
| | | //Y = Application.GetRealHeight(20) + topView.Bottom, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(230), |
| | | Height = Application.GetRealHeight(62), |
| | | BackgroundImagePath = "Collection/ChangeViewbg.png", |
| | | }; |
| | | bodyView.AddChidren(changeView); |
| | | |
| | | Button btnLine = new Button() |
| | | { |
| | | X = btnChangeFunction.Right, |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(1), |
| | | Height = Application.GetRealHeight(14), |
| | | BackgroundColor = CSS_Color.PromptingColor1, |
| | | }; |
| | | changeView.AddChidren(btnLine); |
| | | btnChangeFunction = new Button() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Width = Application.GetRealWidth(114 - 10), |
| | | TextID = StringId.Functions, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.HeadlineFontSize, |
| | | TextAlignment = TextAlignment.Center, |
| | | IsSelected = true, |
| | | IsBold = true, |
| | | }; |
| | | changeView.AddChidren(btnChangeFunction); |
| | | |
| | | btnChangeScene = new Button() |
| | | { |
| | | X = btnLine.Right, |
| | | Width = Application.GetRealWidth(114-10), |
| | | TextID = StringId.Scenes, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | changeView.AddChidren(btnChangeScene); |
| | | #endregion |
| | | Button btnLine = new Button() |
| | | { |
| | | X = btnChangeFunction.Right, |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(1), |
| | | Height = Application.GetRealHeight(14), |
| | | BackgroundColor = CSS_Color.PromptingColor1, |
| | | }; |
| | | changeView.AddChidren(btnLine); |
| | | |
| | | #region ContextView |
| | | btnChangeScene = new Button() |
| | | { |
| | | X = btnLine.Right, |
| | | Width = Application.GetRealWidth(114 - 10), |
| | | TextID = StringId.Scenes, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | changeView.AddChidren(btnChangeScene); |
| | | } |
| | | #endregion |
| | | |
| | | #region ContextView |
| | | contentView = new PageLayout() |
| | | { |
| | | //Y = changeView.Bottom, |
| | |
| | | |
| | | LoadContentView(); |
| | | |
| | | #endregion |
| | | #endregion |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | /// </summary> |
| | | void LoadContentView() |
| | | { |
| | | |
| | | if (!Common.ApiUtlis.Ins.DownloadDataComplete && !MainPage.NoLoginMode) |
| | | { |
| | | var waitPage = new Loading(); |
| | |
| | | sceneFunctionView = new VerticalScrolViewLayout(); |
| | | contentView.AddChidren(sceneFunctionView); |
| | | LoadSceneFunctionControlZone(); |
| | | if (CurShowTypeIsFunction) |
| | | contentView.PageIndex = CurShowTypeContent; |
| | | if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl) |
| | | { |
| | | contentView.PageIndex = 0; |
| | | }else |
| | | { |
| | | contentView.PageIndex = 1; |
| | | gcFunctionView = new VerticalScrolViewLayout(); |
| | | contentView.AddChidren(gcFunctionView); |
| | | LoadGroupControlFunctionControlZone(); |
| | | } |
| | | |
| | | LoadEvent_ChangeShowedFunctionType(); |
| | |
| | | sceneFunctionView = new VerticalScrolViewLayout(); |
| | | contentView.AddChidren(sceneFunctionView); |
| | | LoadSceneFunctionControlZone(); |
| | | |
| | | if (CurShowTypeIsFunction) |
| | | if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl) |
| | | { |
| | | contentView.PageIndex = 0; |
| | | gcFunctionView = new VerticalScrolViewLayout(); |
| | | contentView.AddChidren(gcFunctionView); |
| | | LoadGroupControlFunctionControlZone(); |
| | | } |
| | | else |
| | | { |
| | | contentView.PageIndex = 1; |
| | | } |
| | | contentView.PageIndex = CurShowTypeContent; |
| | | |
| | | |
| | | LoadEvent_ChangeShowedFunctionType(); |
| | |
| | | /// </summary> |
| | | void LoadDeviceFunctionControlZone() |
| | | { |
| | | #region ContextView |
| | | #region ContextView |
| | | deviceFunctionView.RemoveAll(); |
| | | functionViews.Clear(); |
| | | var rowView = new FrameLayout(); |
| | | try |
| | | { |
| | | int index = 0; |
| | | var list = FunctionList.List.GetDeviceFunctionList(); |
| | | list.AddRange(FunctionList.List.groupControls);//加入群控 |
| | | var list = new List<Function>(); |
| | | list.AddRange(FunctionList.List.GetDeviceFunctionList()); |
| | | //list.AddRange(FunctionList.List.groupControls);//加入群控 |
| | | foreach (var function in list) |
| | | { |
| | | //音乐模块有主从关系,需要特殊处理 |
| | |
| | | MainPage.Log("homepage error : " + ex.Message); |
| | | } |
| | | deviceFunctionView.AddChidren(new Button { Height = Application.GetRealHeight(30) }); |
| | | #endregion |
| | | |
| | | #endregion |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载群控功能显示区域 |
| | | /// </summary> |
| | | void LoadGroupControlFunctionControlZone() |
| | | { |
| | | #region ContextView |
| | | gcFunctionView.RemoveAll(); |
| | | functionViews.Clear(); |
| | | var rowView = new FrameLayout(); |
| | | try |
| | | { |
| | | int index = 0; |
| | | foreach (var function in FunctionList.List.groupControls) |
| | | { |
| | | if (index % 2 == 0) |
| | | { |
| | | rowView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealWidth(140), |
| | | }; |
| | | gcFunctionView.AddChidren(rowView); |
| | | } |
| | | var functionView_X = Application.GetRealWidth((182 + 7) * (index % 2)); |
| | | if (index % 2 == 0) |
| | | { |
| | | functionView_X += Application.GetRealWidth(7); |
| | | } |
| | | var functionView = new FrameLayout() |
| | | { |
| | | X = functionView_X, |
| | | Width = Application.GetRealWidth(182), |
| | | Height = Application.GetRealWidth(140), |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | Tag = function.sid |
| | | }; |
| | | rowView.AddChidren(functionView); |
| | | functionViews.Add(functionView); |
| | | var btnbg = new Button() |
| | | { |
| | | UnSelectedImagePath = "Collection/Functionbg.png", |
| | | SelectedImagePath = "Collection/FunctionOnbg.png", |
| | | Tag = function.sid |
| | | }; |
| | | functionView.AddChidren(btnbg); |
| | | LoadDeviceFunctionDiv(functionView, function); |
| | | |
| | | index++; |
| | | } |
| | | |
| | | if (index == 0) |
| | | { |
| | | 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), |
| | | UnSelectedImagePath = "Collection/NoCollectionBg.png", |
| | | }; |
| | | view.AddChidren(btnNoCollectionBg); |
| | | |
| | | var btnNoCollectionTip = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(42), |
| | | Y = btnNoCollectionBg.Bottom, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | //TextID = StringId.TipNoFunctionCollcetion, |
| | | }; |
| | | view.AddChidren(btnNoCollectionTip); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log("homepage error : " + ex.Message); |
| | | } |
| | | gcFunctionView.AddChidren(new Button { Height = Application.GetRealHeight(30) }); |
| | | #endregion |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载场景功能显示区域 |
| | | /// </summary> |
| | |
| | | btnState.Text = function.lastState; |
| | | } |
| | | } |
| | | |
| | | else |
| | | { |
| | | btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png"; |
| | |
| | | SelectedImagePath = "Collection/CollectionWhiteIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionIcon.png", |
| | | }; |
| | | view.AddChidren(btnCollection); |
| | | if (function.spk != SPK.GroupControl)//群控默认显示 |
| | | view.AddChidren(btnCollection); |
| | | //2020-12-16 如果是成员隐藏收藏功能 |
| | | //if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare) |
| | | //{ |
| | |
| | | if (//SPK.CurtainSpkList().Contains(function.spk)) |
| | | function.spk == SPK.CurtainRoller || function.spk == SPK.CurtainShades || |
| | | function.spk == SPK.CurtainDream || |
| | | function.spk == SPK.CurtainSwitch || function.spk == SPK.CurtainTrietex ) |
| | | function.spk == SPK.CurtainSwitch || function.spk == SPK.CurtainTrietex) |
| | | { |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/CurtainIcon.png"; |
| | | btnIcon.SelectedImagePath = "FunctionIcon/Curtain/CurtainOnIcon.png"; |
| | |
| | | btnPower.IsSelected = true; |
| | | status = "on"; |
| | | } |
| | | function.SetAttrState("on_off", status); |
| | | function.SetAttrState("on_off", status); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add("on_off", status); |
| | | Music.SendMethod.Current.SendControlCommand(function, dic); |
| | |
| | | Button btnUp; |
| | | btnUp = new Button() |
| | | { |
| | | X = Application.GetRealWidth(84+3), |
| | | X = Application.GetRealWidth(84 + 3), |
| | | Y = Application.GetRealWidth(89), |
| | | Width = Application.GetRealWidth(38), |
| | | Height = Application.GetRealWidth(38), |
| | |
| | | LoadEvent_ControlClothesHanger(function, btnUp, btnDown); |
| | | |
| | | } |
| | | |
| | | |
| | | else if (function.spk == SPK.SenesorMegahealth || function.spk == SPK.SensorMmvPose) |
| | | { |
| | | //btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}.png"; |
| | |
| | | } |
| | | else if (function.spk == SPK.VideoDoorLock) |
| | | { |
| | | btnIcon.UnSelectedImagePath =UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.GetVideoDoorLockIcon(UI2.FuntionControlView.VideoDoorLock.CommonMethod.Comerom.collect); |
| | | btnIcon.UnSelectedImagePath = UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.GetVideoDoorLockIcon(UI2.FuntionControlView.VideoDoorLock.CommonMethod.Comerom.collect); |
| | | //btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png"; |
| | | } |
| | | //else if (function.spk == SPK.GroupControl) |
| | | //{ |
| | | // btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/lightswitch_blue.png"; |
| | | // btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/lightswitch_white.png"; |
| | | //} |
| | | else |
| | | { |
| | | Button btnSwitch; |
| | |
| | | SelectedImagePath = "Public/SwitchOn.png", |
| | | }; |
| | | view.AddChidren(btnSwitch); |
| | | |
| | | btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png"; |
| | | btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_white.png"; |
| | | LoadEvent_SwitchFunction(function, btnSwitch); |