HDL Home App 第二版本 旧平台金堂用 正在使用
hxb
2022-08-30 25429f085093d89d543a0b90e30d0d62d1b7dac9
ZigbeeApp/Shared/Phone/CommonForm/DialogCommonForm.cs
old mode 100755 new mode 100644
@@ -1,116 +1,116 @@
using Shared.Phone.UserCenter;
using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Phone
{
    /// <summary>
    /// 弹窗型的界面的基层界面
    /// </summary>
    public class DialogCommonForm : CommonFormBase
    {
        #region ■ 变量声明___________________________
        /// <summary>
        /// bodyFrameLayout
        /// </summary>
        public FrameLayout bodyFrameLayout = null;
        /// <summary>
        /// 点击背景的时候,关闭界面
        /// </summary>
        public bool CloseFormByClickBack = true;
        /// <summary>
        /// 调用AddForm函数时,是否自动调用ShowForm函数,,默认自动调用
        /// </summary>
        public bool AutoLoadShowFormMethord = true;
        /// <summary>
        /// 原来的滑动标识
        /// </summary>
        private bool oldScrollEnabled = false;
        #endregion
        #region ■ 初始化_____________________________
        /// <summary>
        /// 初始化界面框架
        /// </summary>
        public override void InitForm()
        {
            this.oldScrollEnabled = UserView.HomePage.Instance.ScrollEnabled;
            UserView.HomePage.Instance.ScrollEnabled = false;
            base.InitForm();
            bodyFrameLayout = new FrameLayout();
            bodyFrameLayout.BackgroundColor = UserCenterColor.Current.DialogBackColor;
            this.AddChidren(bodyFrameLayout);
            if (CloseFormByClickBack == true)
            {
                bodyFrameLayout.MouseUpEventHandler += (sender, e) =>
                {
                    //关闭自身
                    this.CloseForm();
                };
            }
        }
        #endregion
        #region ■ 添加界面___________________________
        /// <summary>
        /// 添加画面,启动参数由指定画面的ShowForm函数所指定
        /// </summary>
        /// <param name="parameter">启动参数:参数由指定画面的ShowForm函数所指定</param>
        public override void AddForm(params object[] parameter)
        {
            base.AddForm(parameter);
            //检测能否追加画面
            if (UserCenterLogic.CheckCanAddForm(this) == false)
            {
                return;
            }
            var nowForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
            if (nowForm == null || (nowForm is ViewGroup) == false)
            {
                //这种情况应该不存在
                this.ShowMassage(ShowMsgType.Error, "ERROR:Not Found The ActionForm!");
                return;
            }
            ((ViewGroup)nowForm).AddChidren(this);
            //初始化界面框架
            this.InitForm();
            if (this.AutoLoadShowFormMethord == true)
            {
                //执行ShowForm()方法
                this.LoadShowFormMethod(parameter);
            }
        }
        #endregion
        #region ■ 关闭界面___________________________
        /// <summary>
        /// 关闭界面
        /// </summary>
        public override void CloseFormBefore()
        {
            if (this.oldScrollEnabled == true)
            {
                //如果它原来就是不可以滑动的话,不处理
                UserView.HomePage.Instance.ScrollEnabled = true;
            }
            base.CloseFormBefore();
        }
        #endregion
    }
}
using Shared.Phone.UserCenter;
using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Phone
{
    /// <summary>
    /// 弹窗型的界面的基层界面
    /// </summary>
    public class DialogCommonForm : CommonFormBase
    {
        #region ■ 变量声明___________________________
        /// <summary>
        /// bodyFrameLayout
        /// </summary>
        public FrameLayout bodyFrameLayout = null;
        /// <summary>
        /// 点击背景的时候,关闭界面
        /// </summary>
        public bool CloseFormByClickBack = true;
        /// <summary>
        /// 调用AddForm函数时,是否自动调用ShowForm函数,,默认自动调用
        /// </summary>
        public bool AutoLoadShowFormMethord = true;
        /// <summary>
        /// 原来的滑动标识
        /// </summary>
        private bool oldScrollEnabled = false;
        #endregion
        #region ■ 初始化_____________________________
        /// <summary>
        /// 初始化界面框架
        /// </summary>
        public override void InitForm()
        {
            this.oldScrollEnabled = UserView.HomePage.Instance.ScrollEnabled;
            UserView.HomePage.Instance.ScrollEnabled = false;
            base.InitForm();
            bodyFrameLayout = new FrameLayout();
            bodyFrameLayout.BackgroundColor = UserCenterColor.Current.DialogBackColor;
            this.AddChidren(bodyFrameLayout);
            bodyFrameLayout.MouseUpEventHandler += (sender, e) =>
            {
                if (CloseFormByClickBack == true)
                {
                    //关闭自身
                    this.CloseForm();
                }
            };
        }
        #endregion
        #region ■ 添加界面___________________________
        /// <summary>
        /// 添加画面,启动参数由指定画面的ShowForm函数所指定
        /// </summary>
        /// <param name="parameter">启动参数:参数由指定画面的ShowForm函数所指定</param>
        public override void AddForm(params object[] parameter)
        {
            base.AddForm(parameter);
            //检测能否追加画面
            if (UserCenterLogic.CheckCanAddForm(this) == false)
            {
                return;
            }
            var nowForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
            if (nowForm == null || (nowForm is ViewGroup) == false)
            {
                //这种情况应该不存在
                this.ShowMassage(ShowMsgType.Error, "ERROR:Not Found The ActionForm!");
                return;
            }
            ((ViewGroup)nowForm).AddChidren(this);
            //初始化界面框架
            this.InitForm();
            if (this.AutoLoadShowFormMethord == true)
            {
                //执行ShowForm()方法
                this.LoadShowFormMethod(parameter);
            }
        }
        #endregion
        #region ■ 关闭界面___________________________
        /// <summary>
        /// 关闭界面
        /// </summary>
        public override void CloseFormBefore()
        {
            if (this.oldScrollEnabled == true)
            {
                //如果它原来就是不可以滑动的话,不处理
                UserView.HomePage.Instance.ScrollEnabled = true;
            }
            base.CloseFormBefore();
        }
        #endregion
    }
}