HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2020-09-22 ade5917841b0fdcb1df7353ef7c56b1a1bdc9282
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
using System;
using Shared.Common;
 
namespace Shared.Phone.Device.CommonForm
{
    public class TopFrameLayout : FrameLayout
    {
        #region ◆ 变量__________________________
        /// <summary>
        /// 返回键
        /// </summary>
        public UserCenter.BackViewControl backButton;
        /// <summary>
        /// 状态栏-高度为80
        /// </summary>
        public FrameLayout topStatuFrameLayout;
        /// <summary>
        /// The top view.
        /// </summary>
        public FrameLayout topView;
        /// <summary>
        /// 标题
        /// </summary>
        public Button topTitle;
 
 
        #endregion
 
        #region ◆ 构造方法_______________________
        /// <summary>
        /// 构造方法
        /// </summary>
        public TopFrameLayout()
        {
            BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor;
            Width = Application.GetRealWidth(CommonFormResouce.AppRealWidth);
            Height = Application.GetRealHeight(CommonFormResouce.TopFrameLayout_Height);
        }
 
        #endregion
 
        #region ◆ 初始化__________________________
 
        public void InitTopview()
        {
            //状态栏
            AddTopStatuFrame();
            //topview
            AddTopview();
            //添加返回键
            AddBackBtn();
            //标题
            AddTitle();
        }
 
        #endregion
 
        #region ◆ topview________________________
        /// <summary>
        /// Adds the topview.
        /// </summary>
        private void AddTopview()
        {
            topView = new FrameLayout
            {
                Y = Application.GetRealHeight(CommonFormResouce.TopStatuFrameLayout_Height),
                Height = Application.GetRealHeight(CommonFormResouce.Topview_Height),
                Width = Application.GetRealWidth(CommonPage.AppRealWidth),
                BackgroundColor=ZigbeeColor.Current.GXCTopViewBackgroundColor
            };
            AddChidren(topView);
 
            var line = new Button
            {
                Y=Height-1,
                Height=1,
                BackgroundColor= UserCenter.UserCenterColor.Current.ButtomLine
            };
            AddChidren(line);
        }
 
        #endregion
 
        #region ◆ 返回键__________________________
        /// <summary>
        /// 返回键
        /// </summary>
        /// <returns>The back button.</returns>
        private void AddBackBtn()
        {
            backButton = new UserCenter.BackViewControl();
            topView.AddChidren(backButton);
            backButton.InitControl();
            //后续再调整
            backButton.Y = backButton.Y - Application.GetRealHeight(4);
        }
 
        #endregion
 
        #region ◆ 状态栏__________________________
 
        /// <summary>
        /// 状态栏
        /// </summary>
        private void AddTopStatuFrame()
        {
            topStatuFrameLayout = new FrameLayout
            {
                Height = Application.GetRealHeight(CommonFormResouce.TopStatuFrameLayout_Height),
                Width = Application.GetRealWidth(CommonPage.AppRealWidth)
            };
            AddChidren(topStatuFrameLayout);
        }
 
        #endregion
 
        #region ◆ 标题___________________________
        /// <summary>
        /// 标题
        /// </summary>
        private void AddTitle()
        {
            topTitle = new Button();
            topTitle.TextSize = 17;
            topTitle.X = Application.GetRealWidth(161);
            topTitle.Height = Application.GetRealHeight(75);
            topTitle.Width = Application.GetRealWidth(850);
            topTitle.Gravity = Gravity.CenterVertical;
            topTitle.TextColor = UserCenter.UserCenterColor.Current.TopLayoutTitleText;
            topTitle.TextAlignment = TextAlignment.CenterLeft;
            topTitle.IsBold = true;
 
            topView.AddChidren(topTitle);
        }
        /// <summary>
        /// 设置标题
        /// </summary>
        /// <param name="title">Title.</param>
        public void SetTopTitle(string title)
        {
            topTitle.Text = title;
        }
        /// <summary>
        /// 设置标题
        /// </summary>
        /// <param name="title"></param>
        public void SetTopTitle(int title)
        {
            SetTopTitle(Language.StringByID(title));
        }
 
        #endregion
    }
}