wxr
2024-09-14 c00da77d00a479fa5d022346a6d9075f90a5c087
HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -1,19 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
using HDL_ON.DAL;
using HDL_ON.DAL.Server;
using HDL_ON.DriverLayer;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Shared;
namespace HDL_ON.UI
{
#if __IOS__
    public partial class HomePage :  VerticalRefreshLayout
    public partial class HomePage : VerticalRefreshLayout
#else
    public partial class HomePage : VerticalScrolViewLayout
#endif
@@ -30,7 +24,7 @@
        /// <summary>
        /// 连接状态提示
        /// </summary>
        Button btnLinkStateTip;
        FrameLayout divLinkStateTip;
        /// <summary>
        /// 安防状态图标
        /// </summary>
@@ -70,19 +64,20 @@
        /// <summary>
        /// 切换显示功能类型区域
        /// </summary>
        FrameLayout changeView;
        /// <summary>
        /// 切换显示设备功能按钮
        /// </summary>
        Button btnChangeFunction;
        /// <summary>
        /// 切换显示场景功能按钮
        /// </summary>
        Button btnChangeScene;
        /// <summary>
        /// 切换显示场组控按钮
        /// </summary>
        Button btnChangeGroupControl;
        FrameLayout changeBaseView;
        //FrameLayout changeView;
        ///// <summary>
        ///// 切换显示设备功能按钮
        ///// </summary>
        //Button btnChangeFunction;
        ///// <summary>
        ///// 切换显示场景功能按钮
        ///// </summary>
        //Button btnChangeScene;
        ///// <summary>
        ///// 切换显示场组控按钮
        ///// </summary>
        //Button btnChangeGroupControl;
        /// <summary>
        /// 功能显示区域
        /// </summary>
@@ -103,9 +98,9 @@
        /// 功能区域集合
        /// </summary>
        List<FrameLayout> functionViews;
#endregion
        #endregion
#region 区域变量
        #region 区域变量
        /// <summary>
        /// 当前显示对控制类型是否是设备功能控制
        /// 0 功能
@@ -113,14 +108,14 @@
        /// 2 群控
        /// </summary>
        int CurShowTypeContent = 0;
#endregion
        #endregion
#region 报警信息
        Button btnMsgBg;
        Button btnMsgTime;
        Button btnMsg;
        #region 报警信息
        //Button btnMsgBg;
        //Button btnMsgTime;
        //Button btnMsg;
        Button btnMsgIcon;
#endregion
        #endregion
        public HomePage()
        {
@@ -164,14 +159,14 @@
                };
                topView = new FrameLayout()
                {
                    Height = Application.GetRealHeight(216),
                    Height = Application.GetRealHeight(113),//216),
                    BackgroundImagePath = DB_ResidenceData.Instance.residenceImage,
                };
                bodyView.AddChidren(topView);
#else
                VerticalRefreshLayout refreshLayout = new VerticalRefreshLayout()
                {
                    Height = Application.GetRealHeight(216),
                    Height = Application.GetRealHeight(113),//216),
                    BackgroundImagePath = DB_ResidenceData.Instance.residenceImage,
                };
                bodyView.AddChidren(refreshLayout);
@@ -184,7 +179,7 @@
                };
                topView = new FrameLayout()
                {
                    Height = Application.GetRealHeight(216),
                    Height = Application.GetRealHeight(113),//216),
                };
                refreshLayout.AddChidren(topView);
#endif
@@ -212,69 +207,35 @@
                    IsBold = true
                };
                topView.AddChidren(btnResidenceName);
                btnLinkStateTip = new Button()
                divLinkStateTip = new FrameLayout()
                {
                    //X = Application.GetRealWidth(16),
                    Y = btnResidenceName.Bottom,
                    Height = Application.GetRealWidth(14),
                    //BackgroundColor = CSS_Color.LinkTipFail,
                    TextAlignment = TextAlignment.Center,
                    Y = Application.GetRealHeight(113) - Application.GetRealWidth(24),
                    Height = Application.GetRealWidth(24),
                    BackgroundColor = 0xFFFF4747,
                    Visible = false,
                };
                topView.AddChidren(divLinkStateTip);
                Button btnLinkStateIcon = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetRealWidth(20),
                    Height = Application.GetRealWidth(20),
                    UnSelectedImagePath = "Collection/GatewayOnlineTipIcon.png"
                };
                divLinkStateTip.AddChidren(btnLinkStateIcon);
                var btnLinkStateTip = new Button()
                {
                    X = btnLinkStateIcon.Right + Application.GetRealWidth(4),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                    TextColor = CSS_Color.MainBackgroundColor,
                    TextID = StringId.NetworkAnomaly,
                };
                topView.AddChidren(btnLinkStateTip);
                //btnLinkStateTip.Width = btnLinkStateTip.GetTextWidth();
                divLinkStateTip.AddChidren(btnLinkStateTip);
                //更新链接状态icon颜色
#if DEBUG
                int ddd = 0;
                btnResidenceName.MouseUpEventHandler = (sender, e) =>
                {
                    //827a98c98da7469b8bc19bb6a3c7651906
                    //St_00009073b431d8b2490c9df0c5cb0e73
                    //Com.Hdl.HdlToLc.InitData(Shared.Application.Activity,false, "827a98c98da7469b8bc19bb6a3c7651906");
                    //Com.Hdl.HdlToLc.OpenActivity();
                    //new System.Threading.Thread(() =>
                    //{
                    //    var http = new HttpServerRequest();
                    //    var pack = http.GetLcSubAccountToken();
                    //    if (pack.Code == StateCode.SUCCESS)
                    //    {
                    //        if(pack.Data == null || string.IsNullOrEmpty(pack.Data.ToString()))
                    //        {
                    //            Application.RunOnMainThread(() =>
                    //            {
                    //                new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), Language.StringByID(StringId.huoqushujushibao));
                    //            });
                    //        }
                    //        Com.Utils.HdlToLcUtils.Instance.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;
                    //        Com.Utils.HdlToLcUtils.Instance.Token = UserInfo.Current.AccessToken;
                    //        Com.Utils.HdlToLcUtils.Instance.SubAccessToken = pack.Data.ToString();
                    //        Application.RunOnMainThread(() =>
                    //        {
                    //            //Com.Utils.HdlToLcUtils.Instance.OpenActivity();
                    //            //Com.Utils.HdlToLcUtils.Instance.Play()
                    //            var backTemp = new AddLcCam();
                    //            backTemp.backAction = () =>
                    //            {
                    //                //Load3tyBrandDeviceList();
                    //            };
                    //            Com.Utils.HdlToLcUtils.Instance.AddCamera(backTemp);
                    //        });
                    //    }
                    //    else
                    //    {
                    //        Application.RunOnMainThread(() =>
                    //        {
                    //            new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), Language.StringByID(StringId.huoqushujushibao) + $"({pack.Code})");
                    //        });
                    //    }
                    //})
                    //{ IsBackground = true }.Start();
                };
#endif
                environmentalView = new FrameLayout()
                {
                    Y = Application.GetRealHeight(1) + btnResidenceName.Bottom,
@@ -283,7 +244,7 @@
                topView.AddChidren(environmentalView);
                CheckLinkStatus();//2020-12-22
#region 环境数据
                #region 环境数据
                var tempSensorList = FunctionList.List.GetEnvirSensorsList().FindAll((obj) => obj.spk == SPK.SensorTemperature);
                var humiSensorList = FunctionList.List.GetEnvirSensorsList().FindAll((obj) => obj.spk == SPK.SensorHumidity);
                var enviList = FunctionList.List.GetEnvirSensorsList().FindAll((obj) => SPK.EvironmentSensorList().Contains(obj.spk));
@@ -315,7 +276,8 @@
                    }
                }
                var btnEnvirValuesTitle = new Button() {
                var btnEnvirValuesTitle = new Button()
                {
                    X = Application.GetRealWidth(12),
                    Gravity = Gravity.CenterVertical,
                    TextColor = CSS_Color.MainBackgroundColor,
@@ -381,7 +343,7 @@
                    }
                    if (tempTotalValues > 0)
                    {
                        btnIndoorTempValues.Text = "/" + (tempTotalValues/ tempTotalCount).ToString("0.0") + "°";
                        btnIndoorTempValues.Text = "/" + (tempTotalValues / tempTotalCount).ToString("0.0") + "°";
                    }
                }
                btnIndoorTempValues.Width = btnIndoorTempValues.GetTextWidth();
@@ -477,9 +439,9 @@
                    SelectedImagePath = "Collection/DefenseStatusIcon.png",
                    UnSelectedImagePath = "Collection/DisarmStatusIcon.png"
                };
                if (DB_ResidenceData.Instance.GatewayType == 1)
                if (DB_ResidenceData.Instance.GatewayType == 1 && !DB_ResidenceData.Instance.CurrentRegion.isOtherShare)
                {
                    topView.AddChidren(btnSecurityStatus);
                    foreach (var temp in FunctionList.List.securities)
                    {
@@ -498,7 +460,8 @@
                        }
                    }
                    btnSecurityStatus.MouseUpEventHandler = (sender, e) => {
                    btnSecurityStatus.MouseUpEventHandler = (sender, e) =>
                    {
                        var page = new ArmCenterPage();
                        MainPage.BasePageView.AddChidren(page);
                        page.LoadPage();
@@ -507,203 +470,117 @@
                }
#region msg
                FrameLayout msgView;
                msgView = new FrameLayout()
                {
                    Y = Application.GetRealHeight(164),
                    Gravity = Gravity.CenterHorizontal,
                    Width = Application.GetRealWidth(343),
                    Height = Application.GetRealHeight(28),
                };
                topView.AddChidren(msgView);
                #region msg
                //FrameLayout msgView;
                //msgView = new FrameLayout()
                //{
                //    Y = Application.GetRealHeight(164),
                //    Gravity = Gravity.CenterHorizontal,
                //    Width = Application.GetRealWidth(343),
                //    Height = Application.GetRealHeight(28),
                //};
                //topView.AddChidren(msgView);
                btnMsgBg = new Button()
                {
                    BackgroundColor = CSS_Color.MainColor,//0x3F4484F4,
                    Alpha = 0.4f,
                };
                msgView.AddChidren(btnMsgBg);
                //btnMsgBg = new Button()
                //{
                //    BackgroundColor = CSS_Color.MainColor,//0x3F4484F4,
                //    Alpha = 0.4f,
                //};
                //msgView.AddChidren(btnMsgBg);
                btnMsgIcon = new Button()
                {
                    X = Application.GetRealWidth(12),
                    Gravity = Gravity.CenterVertical,
                    X = Application.GetRealWidth(290),
                    Y = Application.GetRealHeight(35),
                    Width = Application.GetMinRealAverage(24),
                    Height = Application.GetMinRealAverage(24),
                    UnSelectedImagePath = "Collection/MsgIcon.png",
                    SelectedImagePath = "Collection/MsgIconTip.png",
                };
                msgView.AddChidren(btnMsgIcon);
                btnMsg = new Button()
                if (btnSecurityStatus.Parent == null)
                {
                    X = Application.GetRealWidth(10) + btnMsgIcon.Right,
                    Width = Application.GetRealWidth(240),
                    Text = "...",
                    TextColor = CSS_Color.MainBackgroundColor,
                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                    TextAlignment = TextAlignment.CenterLeft,
                };
                msgView.AddChidren(btnMsg);
                    btnMsgIcon.X = Application.GetRealWidth(329);
                }
                topView.AddChidren(btnMsgIcon);
                btnMsgTime = new Button()
                {
                    X = Application.GetRealWidth(299),
                    Width = Application.GetRealWidth(44),
                    Text = "00:00",
                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                    TextAlignment = TextAlignment.CenterLeft,
                };
                msgView.AddChidren(btnMsgTime);
                //btnMsg = new Button()
                //{
                //    X = Application.GetRealWidth(10) + btnMsgIcon.Right,
                //    Width = Application.GetRealWidth(240),
                //    Text = "...",
                //    TextColor = CSS_Color.MainBackgroundColor,
                //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                //    TextAlignment = TextAlignment.CenterLeft,
                //};
                //msgView.AddChidren(btnMsg);
                //btnMsgTime = new Button()
                //{
                //    X = Application.GetRealWidth(299),
                //    Width = Application.GetRealWidth(44),
                //    Text = "00:00",
                //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                //    TextAlignment = TextAlignment.CenterLeft,
                //};
                //msgView.AddChidren(btnMsgTime);
                LoadEvent_GotoMessageCenterPage();
#endregion
                #endregion
#endregion
                #endregion
#region 功能场景切换
                #region 功能场景切换
                bodyView.AddChidren(new Button() { Height = Application.GetRealHeight(20), BackgroundColor = 0x00000000 });
                if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
                {
                    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);
                loadNavView();
                    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
                {
                    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);
                    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);
                }
                #endregion
                #region ContextView
                contentView = new PageLayout()
                {
                    //Y = changeView.Bottom,
                    Height = Application.GetRealHeight(310 + 30 + 10), //20为超出部分
                    IsShowPoint = false,
                };
                bodyView.AddChidren(contentView);
                functionViews = new List<FrameLayout>();
                LoadContentView();
                #endregion
#if DEBUG
                btnResidenceName.MouseUpEventHandler = (envent, ee) =>
                {
                    MainPage.Log("sss");
#if __ANDROID__
                    //HDLLinphoneKit.Instance.MediaPlayerLooping(true);
                    Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.PlayRingtone();
#elif __IOS__
                    //if (isPlay)
                    //{
                    //    isPlay = false;
                    //    soundPlayer.StopSound();
                    //}
                    //else
                    //{
                    //    isPlay = true;
                    //    soundPlayer.PlaySound();
                    //}
#endif
                    //PlaySystemRingtone playSystemRingtone = new PlaySystemRingtone();
                    //playSystemRingtone.Play();
                    //new System.Threading.Thread(async() =>
                    //{
                    //    await Common.AliyunLog.AliyunLogClient.PostLogs("告警测试", "测试信息测试信息测试信息测试信息测试信息测试信息测试信息测试信息测试信息测试信息测试信息测试信息测试信息");
                    //})
                    //{ IsBackground = true }.Start();
                };
#endif
            }
            catch (Exception ex)
            {
@@ -712,12 +589,304 @@
        }
        void loadNavView()
        {
            if (changeBaseView == null)
            {
                changeBaseView = new FrameLayout()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Height = Application.GetRealHeight(62),
                };
                bodyView.AddChidren(changeBaseView);
            }
            else
            {
                changeBaseView.RemoveAll();
            }
            if (contentView == null)
            {
                contentView = new PageLayout()
                {
                    Height = Application.GetRealHeight(310 + 30 + 10 + 100), //20为超出部分
                    IsShowPoint = false,
                };
                bodyView.AddChidren(contentView);
            }
            if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl && FunctionList.List.groupControls.Count > 0)
            {
                var changeView = new FrameLayout()
                {
                    //Y = Application.GetRealHeight(20) + topView.Bottom,
                    Gravity = Gravity.CenterHorizontal,
                    Width = Application.GetRealWidth(334),
                    Height = Application.GetRealHeight(62),
                    BackgroundImagePath = "Collection/ChangeViewbg.png",
                };
                changeBaseView.AddChidren(changeView);
                var 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);
                var 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);
                var 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);
                btnChangeGroupControl.MouseUpEventHandler = (sender, e) =>
                {
                    btnChangeFunction.IsSelected = false;
                    btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize;
                    btnChangeFunction.IsBold = false;
                    btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize;
                    btnChangeScene.IsSelected = false;
                    btnChangeScene.IsBold = false;
                    btnChangeGroupControl.IsSelected = true;
                    btnChangeGroupControl.TextSize = CSS.CSS_FontSize.HeadlineFontSize;
                    btnChangeGroupControl.IsBold = true;
                    CurShowTypeContent = 2;
                    contentView.PageIndex = 2;
                };
                btnChangeFunction.MouseUpEventHandler = (sender, e) =>
                {
                    btnChangeFunction.IsSelected = true;
                    btnChangeFunction.TextSize = CSS.CSS_FontSize.HeadlineFontSize;
                    btnChangeFunction.IsBold = true;
                    btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize;
                    btnChangeScene.IsSelected = false;
                    btnChangeScene.IsBold = false;
                    CurShowTypeContent = 0;
                    contentView.PageIndex = 0;
                    btnChangeGroupControl.IsSelected = false;
                    btnChangeGroupControl.TextSize = CSS.CSS_FontSize.TextFontSize;
                    btnChangeGroupControl.IsBold = false;
                };
                btnChangeScene.MouseUpEventHandler = (sender, e) =>
                {
                    btnChangeScene.IsSelected = true;
                    btnChangeScene.TextSize = CSS.CSS_FontSize.HeadlineFontSize;
                    btnChangeScene.IsBold = true;
                    btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize;
                    btnChangeFunction.IsSelected = false;
                    btnChangeFunction.IsBold = false;
                    CurShowTypeContent = 1;
                    contentView.PageIndex = 1;
                    btnChangeGroupControl.IsSelected = false;
                    btnChangeGroupControl.TextSize = CSS.CSS_FontSize.TextFontSize;
                    btnChangeGroupControl.IsBold = false;
                };
                contentView.PageChange = (sender, e) =>
                {
                    if (contentView.PageIndex == 0)
                    {
                        btnChangeFunction.IsSelected = true;
                        btnChangeFunction.TextSize = CSS.CSS_FontSize.HeadlineFontSize;
                        btnChangeFunction.IsBold = true;
                        btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize;
                        btnChangeScene.IsSelected = false;
                        btnChangeScene.IsBold = false;
                        btnChangeGroupControl.IsSelected = false;
                        btnChangeGroupControl.TextSize = CSS.CSS_FontSize.TextFontSize;
                        btnChangeGroupControl.IsBold = false;
                    }
                    else if (contentView.PageIndex == 1)
                    {
                        btnChangeScene.IsSelected = true;
                        btnChangeScene.TextSize = CSS.CSS_FontSize.HeadlineFontSize;
                        btnChangeScene.IsBold = true;
                        btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize;
                        btnChangeFunction.IsSelected = false;
                        btnChangeFunction.IsBold = false;
                        btnChangeGroupControl.IsSelected = false;
                        btnChangeGroupControl.TextSize = CSS.CSS_FontSize.TextFontSize;
                        btnChangeGroupControl.IsBold = false;
                    }
                    else if (contentView.PageIndex == 2)
                    {
                        btnChangeFunction.IsSelected = false;
                        btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize;
                        btnChangeFunction.IsBold = false;
                        btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize;
                        btnChangeScene.IsSelected = false;
                        btnChangeScene.IsBold = false;
                        btnChangeGroupControl.IsSelected = true;
                        btnChangeGroupControl.TextSize = CSS.CSS_FontSize.HeadlineFontSize;
                        btnChangeGroupControl.IsBold = true;
                    }
                };
            }
            else
            {
                var changeView = new FrameLayout()
                {
                    //Y = Application.GetRealHeight(20) + topView.Bottom,
                    Gravity = Gravity.CenterHorizontal,
                    Width = Application.GetRealWidth(230),
                    Height = Application.GetRealHeight(62),
                    BackgroundImagePath = "Collection/ChangeViewbg.png",
                };
                changeBaseView.AddChidren(changeView);
                var 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);
                var 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);
                btnChangeFunction.MouseUpEventHandler = (sender, e) =>
                {
                    btnChangeFunction.IsSelected = true;
                    btnChangeFunction.TextSize = CSS.CSS_FontSize.HeadlineFontSize;
                    btnChangeFunction.IsBold = true;
                    btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize;
                    btnChangeScene.IsSelected = false;
                    btnChangeScene.IsBold = false;
                    CurShowTypeContent = 0;
                    contentView.PageIndex = 0;
                };
                btnChangeScene.MouseUpEventHandler = (sender, e) =>
                {
                    btnChangeScene.IsSelected = true;
                    btnChangeScene.TextSize = CSS.CSS_FontSize.HeadlineFontSize;
                    btnChangeScene.IsBold = true;
                    btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize;
                    btnChangeFunction.IsSelected = false;
                    btnChangeFunction.IsBold = false;
                    CurShowTypeContent = 1;
                    contentView.PageIndex = 1;
                };
                contentView.PageChange = (sender, e) =>
                {
                    if (contentView.PageIndex == 0)
                    {
                        btnChangeFunction.IsSelected = true;
                        btnChangeFunction.TextSize = CSS.CSS_FontSize.HeadlineFontSize;
                        btnChangeFunction.IsBold = true;
                        btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize;
                        btnChangeScene.IsSelected = false;
                        btnChangeScene.IsBold = false;
                    }
                    else if (contentView.PageIndex == 1)
                    {
                        btnChangeScene.IsSelected = true;
                        btnChangeScene.TextSize = CSS.CSS_FontSize.HeadlineFontSize;
                        btnChangeScene.IsBold = true;
                        btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize;
                        btnChangeFunction.IsSelected = false;
                        btnChangeFunction.IsBold = false;
                    }
                };
            }
            contentView.PageIndex = CurShowTypeContent;
        }
        /// <summary>
        /// 加载内容区域
        /// </summary>
        void LoadContentView()
        {
            if (!Common.ApiUtlis.Ins.DownloadDataComplete && !MainPage.NoLoginMode)
            {
                var waitPage = new Loading();
@@ -736,8 +905,10 @@
                        {
                            if (contentView == null)
                            {
                                waitPage.Hide();
                                return;
                            }
                            loadNavView();
                            contentView.RemoveAll();
                            deviceFunctionView = new VerticalScrolViewLayout();
                            contentView.AddChidren(deviceFunctionView);
@@ -745,7 +916,6 @@
                            sceneFunctionView = new VerticalScrolViewLayout();
                            contentView.AddChidren(sceneFunctionView);
                            LoadSceneFunctionControlZone();
                            contentView.PageIndex = CurShowTypeContent;
                            if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
                            {
                                gcFunctionView = new VerticalScrolViewLayout();
@@ -759,6 +929,7 @@
                            GetUnreadPushMessages();
                            RegisterGetPushMessageAction();
                            contentView.PageIndex = CurShowTypeContent;
                            if (waitPage != null)
                            {
                                waitPage.RemoveFromParent();
@@ -766,7 +937,8 @@
                            }
                        });
                    }
                    catch (Exception ex) {
                    catch (Exception ex)
                    {
                        MainPage.Log($"刷新主页异常:{ex.Message}");
                    }
                    finally { }
@@ -819,13 +991,13 @@
                foreach (var function in list)
                {
                    //音乐模块有主从关系,需要特殊处理
                    if (SPK.MusicSpkList().Contains( function.spk))
                    //if (SPK.MusicSpkList().Contains( function.spk))
                    //{
                    //    continue;
                    //}
                    //else
                    {
                        continue;
                    }
                    else
                    {
                        if (!function.collect)
                        if (!function.collect&& function.spk != SPK.InverterJinmao)
                            continue;
                    }
                    if (index % 2 == 0)
@@ -851,8 +1023,8 @@
                    };
                    rowView.AddChidren(functionView);
                    functionViews.Add(functionView);
                    //绿建人居环境,科技系统
                    if (function.spk == SPK.AcstParent)
                    //绿建人居环境,科技系统,金茂光伏储能
                    if (function.spk == SPK.AcstParent || function.spk == SPK.InverterJinmao)
                    {
                        LoadAcstDiv(functionView, function);
                    }
@@ -917,9 +1089,9 @@
        /// </summary>
        void LoadGroupControlFunctionControlZone()
        {
            #region ContextView
            gcFunctionView.RemoveAll();
            functionViews.Clear();
            var rowView = new FrameLayout();
            try
            {
@@ -949,14 +1121,14 @@
                    };
                    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);
                    var btnbg = new Button()
                    {
                        UnSelectedImagePath = "Collection/Functionbg.png",
                        SelectedImagePath = "Collection/FunctionOnbg.png",
                        Tag = function.sid
                    };
                    functionView.AddChidren(btnbg);
                    LoadDeviceFunctionDiv(functionView, function);
                    index++;
                }
@@ -964,7 +1136,7 @@
                if (index == 0)
                {
                    var view = new FrameLayout();
                    deviceFunctionView.AddChidren(view);
                    gcFunctionView.AddChidren(view);
                    var btnNoCollectionBg = new Button()
                    {
@@ -1040,7 +1212,7 @@
                    //2020-12-03 修改图片加载方法
                    ImageUtlis.Current.LoadLocalOrNetworkImages((scene as Scene).ImagePath, functionView);
                    LoadSceneFunctionDiv( functionView, scene);
                    LoadSceneFunctionDiv(functionView, scene);
                    index++;
                }
@@ -1143,7 +1315,8 @@
                };
                if (function.spk == SPK.SenesorMegahealth || function.spk == SPK.SensorMmvPose)
                if (function.spk == SPK.SenesorMegahealth || function.spk == SPK.SensorMmvPose ||
                    function.spk == SPK.SensorPir || function.spk == SPK.SensorPirHold)
                {
                    btnIcon.UnSelectedImagePath = "FunctionIcon/Icon/HomeIcon/sensormegahealth.png";
                    btnIcon.SelectedImagePath = "FunctionIcon/Icon/HomeIcon/sensormegahealth.png";
@@ -1157,7 +1330,7 @@
                        switch (tempStatus.state)
                        {//0空,1走,2跑,3坐,4跌倒,5站
                            case "0":
                                function.lastState = Language.StringByID(StringId.SensorNormalState);
                                function.lastState = Language.StringByID(StringId.wuren);
                                break;
                            case "1":
                                function.lastState = Language.StringByID(StringId.SomeoneIn);
@@ -1198,8 +1371,49 @@
                        }
                        btnState.Text = function.lastState;
                    }
                    else
                    {
                        tempStatus = function.attributes.Find((sta) => sta.key == "people_status");
                        if (tempStatus != null)
                        {
                            switch (tempStatus.state)
                            {
                                case "true":
                                    function.lastState = Language.StringByID(StringId.Someone);
                                    break;
                                case "false":
                                    function.lastState = Language.StringByID(StringId.wuren);
                                    break;
                            }
                            btnState.Text = function.lastState;
                        }
                    }
                }
                else if (function.spk == SPK.SensorDryContact || function.spk == SPK.SensorDryContact2)
                {
                    btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_white.png";
                    btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_white.png";
                    btnName.TextColor = CSS_Color.MainBackgroundColor;
                    btnZone.TextColor = CSS_Color.MainBackgroundColor;
                    btnState.TextColor = CSS_Color.MainBackgroundColor;
                    var tempStatus = function.attributes.Find((sta) => sta.key == FunctionAttributeKey.ContactStatus);
                    if (tempStatus != null)
                    {
                        switch (tempStatus.state)
                        {
                            case "open":
                                function.lastState = Language.StringByID(StringId.DryBreak);
                                break;
                            case "close":
                                function.lastState = Language.StringByID(StringId.Shut);
                                break;
                        }
                        btnState.Text = function.lastState;
                    }
                }
                else
                {
                    btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png";
@@ -1233,7 +1447,8 @@
                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";
@@ -1248,6 +1463,7 @@
                        SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseWhiteIcon_Shadow.png",
                    };
                    view.AddChidren(btnCurtainClose);
                    Button btnCurtainOpen;
                    btnCurtainOpen = new Button()
@@ -1284,7 +1500,7 @@
                {
                    btnIcon.UnSelectedImagePath = "FunctionIcon/Music/MusicIcon.png";
                    btnIcon.SelectedImagePath = "FunctionIcon/Music/MusicOnIcon.png";
                    btnCollection.Visible = false;
                    //btnCollection.Visible = false;
                    Button btnPower;
                    btnPower = new Button()
                    {
@@ -1298,7 +1514,7 @@
                    view.AddChidren(btnPower);
                    btnState.Text = function.GetAttrState("song_name");
                    btnState.Width = Application.GetRealWidth(90);
                    btnState.SelectedTextColor = CSS_Color.MainBackgroundColor;
                    btnState.TextColor = CSS_Color.MainBackgroundColor;//PromptingColor1
@@ -1358,13 +1574,13 @@
                }
                else if (function.spk == SPK.SenesorMegahealth || function.spk == SPK.SensorMmvPose)
                //else if (function.spk == SPK.SenesorMegahealth || function.spk == SPK.SensorMmvPose)
                else if (SPK.ArmSensorSpkList().Contains(function.spk))
                {
                    //btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}.png";
                    //btnIcon.SelectedImagePath = "FunctionIcon/Icon/HomeIcon/sensormegahealth.png";
                    //btnIcon.IsSelected = true;
                    btnName.TextColor = CSS_Color.MainBackgroundColor;
                    btnZone.TextColor = CSS_Color.MainBackgroundColor;
                    btnState.SelectedTextColor = CSS_Color.MainBackgroundColor;
                    btnState.TextColor = CSS_Color.MainColor;//PromptingColor1
                    btnState.TextColor = CSS_Color.MainBackgroundColor;
                }
                //紧急求助
@@ -1385,11 +1601,80 @@
                    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 if (function.spk == SPK.AvZkAiks)
                {
                    //为了去掉开关按钮
                    btnIcon.UnSelectedImagePath = "AksIcon/yingyinzhongkong1.png";
                }
                else if (function.spk == SPK.GroupControl)
                {
                    btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png";
                    btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_white.png";
                    if (function.spk == SPK.GroupControl)
                    {
                        Button btnClose;
                        Button btnOpen;
                        btnOpen = new Button()
                        {
                            X = Application.GetRealWidth(84),
                            Y = Application.GetRealWidth(89),
                            Width = Application.GetRealWidth(40),
                            Height = Application.GetRealWidth(40),
                            UnSelectedImagePath = "FunctionIcon/Light/LightScene/gp_all_on_home.png",
                            SelectedImagePath = "FunctionIcon/Light/LightScene/gp_all_on_home_click.png",
                        };
                        view.AddChidren(btnOpen);
                        btnClose = new Button()
                        {
                            X = btnOpen.Right,
                            Y = Application.GetRealWidth(89),
                            Width = Application.GetRealWidth(40),
                            Height = Application.GetRealWidth(40),
                            UnSelectedImagePath = "FunctionIcon/Light/LightScene/gp_all_off_home.png",
                            SelectedImagePath = "FunctionIcon/Light/LightScene/gp_all_off_home_click.png",
                        };
                        view.AddChidren(btnClose);
                        btnClose.MouseDownEventHandler = (sender, e) =>
                        {
                            btnClose.IsSelected = true;
                        };
                        btnClose.MouseUpEventHandler = (sender, e) =>
                        {
                            btnClose.IsSelected = false;
                            if (function.spk == SPK.GroupControl)
                            {
                                var d = new Dictionary<string, string>();
                                d.Add("on_off", "off");
                                (function as GroupControl).Control(d);
                            }
                        };
                        btnOpen.MouseDownEventHandler = (sender, e) =>
                        {
                            btnOpen.IsSelected = true;
                        };
                        btnOpen.MouseUpEventHandler = (sender, e) =>
                        {
                            btnOpen.IsSelected = false;
                            if (function.spk == SPK.GroupControl)
                            {
                                var d = new Dictionary<string, string>();
                                d.Add("on_off", "on");
                                (function as GroupControl).Control(d);
                            }
                        };
                    }
                }
                else if (function.spk == SPK.ElectricEnergy || function.spk == SPK.AirSwitch || function.spk == SPK.AirSwitchP3)
                {
                }
                else
                {
                    Button btnSwitch;
@@ -1408,7 +1693,8 @@
                    LoadEvent_SwitchFunction(function, btnSwitch);
                }
                //取消收藏事件
                Action cannelCollect = () => {
                Action cannelCollect = () =>
                {
                    function.collect = false;
                    //if (SPK.MusicSpkList().Contains(function.spk))//处理音乐主从关系
                    //{
@@ -1424,15 +1710,16 @@
                };
                var skipControlPageEvent = new PublicAssmebly().LoadEvent_SkipFunctionControlPage(function, btnCollection, btnName, btnZone, UI2.FuntionControlView.VideoDoorLock.CommonMethod.Comerom.collect,()=> {
                var skipControlPageEvent = new PublicAssmebly().LoadEvent_SkipFunctionControlPage(function, btnCollection, btnName, btnZone, UI2.FuntionControlView.VideoDoorLock.CommonMethod.Comerom.collect, () =>
                {
                    this.LoadDeviceFunctionControlZone();//删除设备后重新刷新UI
                });
                view.MouseUpEventHandler = skipControlPageEvent;
                btnName.MouseUpEventHandler = skipControlPageEvent;
                btnIcon.MouseUpEventHandler = skipControlPageEvent;
                btnState.MouseUpEventHandler = skipControlPageEvent;
                //不需要更新状态的动能列表
                if(!SPK.NotStatusSpkList.Contains(function.spk) || function.spk != SPK.IpCam_Imou)
                //不需要更新状态的功能列表
                if (!SPK.NotStatusSpkList.Contains(function.spk) || function.spk != SPK.IpCam_Imou)
                {
                    UpdataFunctionStates(function);
                }
@@ -1447,7 +1734,7 @@
                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                    TextAlignment = TextAlignment.CenterLeft,
                    Tag = "OnlineTag",
                    Visible = !function.online
                    Visible = !function.isOnline()
                };
                view.AddChidren(btnOffline);
@@ -1478,7 +1765,8 @@
            {
                X = Application.GetRealWidth(11),
                Y = Application.GetRealWidth(10),
                TextID = StringId.Acst,
                Text = function.name,
                //TextID = StringId.Acst,
                IsBold = true,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
@@ -1498,20 +1786,51 @@
            };
            view.AddChidren(btnLogo);
            try
            {
                if (function.extend.Contains("jinmao") && function.extend.Contains("true"))
                {
                    btnLogo.Visible = true;
                }
                else
                {
                    btnLogo.Visible = false;
                }
            }
            catch (Exception ex)
            {
                MainPage.Log("Error", $"金茂logo显示处理异常:{ex.Message}");
            }
            Button btnFunctionViewBg;
            btnFunctionViewBg = new Button()
            {
                Height = Application.GetRealWidth(100),
                Width = Application.GetRealWidth(102),
                UnSelectedImagePath = "FunctionIcon/FunctionBg/AcstFunctionBg.png",
                UnSelectedImagePath = function.spk == SPK.AcstParent ? "FunctionIcon/FunctionBg/AcstFunctionBg.png" : "FunctionIcon/FunctionBg/InverterJinmaoFunctionBg.png",
            };
            view.AddChidren(btnFunctionViewBg);
            btnFunctionViewBg.MouseUpEventHandler = (sender, e) => {
                var page = new AcstParentPage();
                MainPage.BasePageView.AddChidren(page);
                page.LoadPage();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            if (function.spk == SPK.AcstParent)
            {
                btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                {
                    var page = new AcstParentPage();
                    MainPage.BasePageView.AddChidren(page);
                    page.LoadPage();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
            }
            else if (function.spk == SPK.InverterJinmao)
            {
                //btnName.TextID = StringId.NewEnergy;
                btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                {
                    var page = new InverterJinmaoPage();
                    MainPage.BasePageView.AddChidren(page);
                    page.LoadPage();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
            }
            //Button btnAcstPower = new Button()
@@ -1539,7 +1858,7 @@
            //    })
            //    { IsBackground = true }.Start();
            //};