黄学彪
2019-11-04 c7698e163e43cea9e7f8ee45f8e3f91c9265cca4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Shared.Phone.UserCenter
{
    /// <summary>
    /// 弹窗型的界面的基层界面
    /// </summary>
    public class DialogCommonForm : CommonFormBase
    {
        #region ■ 变量声明___________________________
 
        /// <summary>
        /// bodyFrameLayout
        /// </summary>
        public FrameLayout bodyFrameLayout = null;
        /// <summary>
        /// 点击背景的时候,关闭界面
        /// </summary>
        public bool CloseFormByClickBack = 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)
        {
            //检测能否追加画面
            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();
 
            //执行ShowForm()方法
            this.LoadShowFormMethod(parameter);
        }
 
        #endregion
 
        #region ■ 关闭界面___________________________
 
        /// <summary>
        /// 关闭界面
        /// </summary>
        public override void CloseForm()
        {
            if (this.oldScrollEnabled == true)
            {
                //如果它原来就是不可以滑动的话,不处理
                UserView.HomePage.Instance.ScrollEnabled = true;
            }
 
            base.CloseForm();
        }
 
        #endregion
    }
}