黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
ZigbeeApp/Shared/Phone/UserView/UserPage.cs
old mode 100644 new mode 100755
@@ -40,7 +40,7 @@
        /// <summary>
        /// 用户主体界面(中间部分)
        /// </summary>
        private FrameLayout bodyFrameView = null;
        private NormalFrameLayout bodyFrameView = null;
        /// <summary>
        /// 界面缓存(2020.05.07:切换时不移除界面,直接隐藏)
        /// </summary>
@@ -49,6 +49,18 @@
        /// 控件缓存(看不懂的话,不要动它)
        /// </summary>
        private List<ButtonBase> listButton = new List<ButtonBase>();
        /// <summary>
        /// 如果设置此变量为true,则在单击底部菜单时,强制无条件全部刷新
        /// </summary>
        public bool RefreshAllForm = false;
        /// <summary>
        /// 刷新主页
        /// </summary>
        public bool RefreshMainPageForm = false;
        /// <summary>
        /// 刷新分类
        /// </summary>
        public bool RefreshCategoryForm = false;
        #endregion
@@ -60,10 +72,8 @@
        public UserPage()
        {
            BackgroundColor = Shared.Common.ZigbeeColor.Current.MainColor;
            Shared.Application.LocationAction += (lon, lat) =>
            {
                Login.AccountLogic.Instance.ReceiveAppLatAndLon(lon.ToString(), lat.ToString());
            };
            //添加App的经纬度上报事件
            HdlOtherFunctionLogic.Current.AddAppLatAndLonEvent();
        }
        /// <summary>
@@ -76,26 +86,26 @@
                return;
            }
#if iOS
            if (Shared.Application.PhoneType >= 10)
            {
                //高版本的苹果机型,屏幕底部会有一个黑色的杠
                ControlCommonResourse.BottomFrameHeight = Application.GetRealHeight(242);
            if (Shared.Application.IsFullScreen == true)
            {
                //高版本的苹果机型,屏幕底部会有一个黑色的杠
                ControlCommonResourse.BottomFrameHeight = Application.GetRealHeight(180);
            }
#endif
            //用户主体界面(中间部分)
            this.bodyFrameView = new FrameLayout();
            bodyFrameView.Height = this.Height - UserCenter.ControlCommonResourse.BottomFrameHeight;
            this.bodyFrameView = new NormalFrameLayout();
            bodyFrameView.Height = this.Height - HdlControlResourse.BottomFrameHeight;
            bodyFrameView.BackgroundColor = Shared.Common.ZigbeeColor.Current.MainColor;
            this.AddChidren(bodyFrameView);
            //用户菜单界面(底部部分)
            var bottomMenuFrame = new FrameLayout();
            bottomMenuFrame.Gravity = Gravity.BottomCenter;
            bottomMenuFrame.Height = ControlCommonResourse.BottomFrameHeight;
            bottomMenuFrame.Height = HdlControlResourse.BottomFrameHeight;
            bottomMenuFrame.BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCBottomColor;
            this.AddChidren(bottomMenuFrame);
            //底部菜单的头部线
            var bottomLine = new NormalViewControl(bottomMenuFrame.Width, ControlCommonResourse.BottomLineHeight, false);
            var bottomLine = new NormalViewControl(bottomMenuFrame.Width, HdlControlResourse.BottomLineHeight, false);
            bottomLine.BackgroundColor = 0xffc8c8c9;
            bottomMenuFrame.AddChidren(bottomLine);
@@ -214,10 +224,10 @@
            this.BottomMenuClickEvent(MenuSelectEnum.A主页, false);
        }
#endregion
        #endregion
#region ■ 一般方法___________________________
        #region ■ 一般方法___________________________
        /// <summary>
        /// 底部菜单的点击事件
        /// </summary>
@@ -225,11 +235,22 @@
        /// <param name="handClick">是否是手动点击</param>
        private void BottomMenuClickEvent(MenuSelectEnum selectEnum, bool handClick)
        {
            if (selectEnum == this.nowSelectMenu && handClick == true)
            if (this.RefreshAllForm == false && selectEnum == this.nowSelectMenu && handClick == true)
            {
                //手动点击同一个菜单,则不做处理
                return;
            }
            //如果强制指定刷新界面的话
            if (this.RefreshAllForm == true)
            {
                //全部刷新
                this.listForm = new List<EditorCommonForm>() { null, null, null };
                this.bodyFrameView.RemoveAll();
                this.RefreshAllForm = false;
            }
            this.nowSelectMenu = selectEnum;
            //主页
@@ -237,6 +258,13 @@
            {
                //左滑菜单可
                CommonPage.Instance.IsDrawerLockMode = false;
                if (this.RefreshMainPageForm == true)
                {
                    //刷新主页
                    listForm[0]?.CloseForm();
                    listForm[0] = null;
                    this.RefreshMainPageForm = false;
                }
                if (listForm[0] == null)
                {
                    var form = new MainPage.HomeMainPageForm();
@@ -250,6 +278,13 @@
            {
                //左滑菜单不可
                CommonPage.Instance.IsDrawerLockMode = true;
                if (this.RefreshCategoryForm == true)
                {
                    //刷新分类
                    listForm[1]?.CloseForm();
                    listForm[1] = null;
                    this.RefreshCategoryForm = false;
                }
                if (listForm[1] == null)
                {
                    var form = new Category.CategoryMainForm();
@@ -312,17 +347,49 @@
        public void ShowCategoryAutoListForm()
        {
            //关闭全部界面,直到主页为止
            UserCenterLogic.CloseAllOpenForm();
            HdlFormLogic.Current.CloseAllOpenForm(null, false);
            //强制显示自动化列表界面
            UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = 2;
            this.BottomMenuClickEvent(MenuSelectEnum.A分类, false);
            HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = 2;
            this.nowSelectMenu = MenuSelectEnum.A分类;
            //左滑菜单不可
            CommonPage.Instance.IsDrawerLockMode = true;
            if (listForm[1] == null)
            {
                var form = new Category.CategoryMainForm();
                this.bodyFrameView.AddChidren(form);
                form.ShowForm();
                //加缓存
                listForm[1] = form;
            }
            else
            {
                ((Category.CategoryMainForm)listForm[1]).RefreshBodyView();
            }
            //设置全部控件的各种状态状态
            this.SetAllControlStatu();
        }
#endregion
        /// <summary>
        /// 获取当前激活的界面
        /// </summary>
        /// <returns></returns>
        public EditorCommonForm GetNowActionForm()
        {
            int index = ((int)this.nowSelectMenu) - 1;
            if (index != -1)
            {
                //调用此界面的激活函数
                return this.listForm[index];
            }
            return null;
        }
#region ■ 结构体_____________________________
        #endregion
        #region ■ 结构体_____________________________
        /// <summary>
        /// 菜单选择的枚举
        /// </summary>
@@ -332,8 +399,8 @@
            A主页 = 1,
            A分类 = 2,
            A个人中心 = 3
        }
#endregion
        }
        #endregion
    }
}