wxr
2019-12-25 3df772e4fdd553b2954e8f3f55ce7ff5905407c3
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
using Shared.SimpleControl.Phone;
using System;
/*
    移除后台远程连接,讲远程连接移动到用户节目侧边栏  2017-02-10
*/
namespace Shared.SimpleControl.Pad
{
    /// <summary>
    /// 显示功能的导航栏
    /// </summary>
    public static class SystemMiddleTop
    {
        /// <summary>
        /// 当前主视图
        /// </summary>
        public static readonly FrameLayout SystemTopMeunView = new FrameLayout () {
            Height = Application.GetRealHeight (130),
        };
 
        static readonly Button TopBottomLine = new Button () { 
            Y = Application.GetRealHeight(122),
            Width = Application.GetRealWidth (685),
            Height = Application.GetRealHeight(8),
            BackgroundColor = SkinStyle.Current.SelectedColor,
        };
 
        /// <summary>
        /// 网关功能
        /// </summary>
        public static readonly Button gateWay = new Button {
            Width = Application.GetRealWidth (680),
            Height = LayoutParams.MatchParent,
            SelectedBackgroundColor = 0xFF333333,
            BackgroundColor = 0xFF2f2f2f,
            TextSize = 18,
            TextID = R.MyInternationalizationString.GateWay,
            TextAlignment = TextAlignment.Center,
            IsSelected = true,
        };
        /// <summary>
        /// 设备功能
        /// </summary>
        static readonly Button equipmentButton = new Button {
            Width = Application.GetRealWidth (680),
            Height = LayoutParams.MatchParent,
            SelectedBackgroundColor = 0xFF333333,
            BackgroundColor = 0xFF2f2f2f,
            TextID = R.MyInternationalizationString.Equipment,
            TextSize = 18,
            TextAlignment = TextAlignment.Center,
        };
        /// <summary>
        /// 房间功能
        /// </summary>
        static readonly Button roomButton = new Button {
            Width = Application.GetRealWidth (680),
            Height = LayoutParams.MatchParent,
            SelectedBackgroundColor = 0xFF333333,
            BackgroundColor = 0xFF2f2f2f,
            TextSize = 18,
            TextID = R.MyInternationalizationString.Room,
            TextAlignment = TextAlignment.Center,
        };
        /// <summary>
        /// 初始当前视图
        /// </summary>
        public static void Init ()
        {
            if (null != SystemTopMeunView.Parent) {
                return;
            }
            SystemTopMeunView.Y = SystemTop.FrameLayoutMain.Bottom;
            SystemHomePage.FrameLayoutMain.AddChidren (SystemTopMeunView);
            initTopFrameLaout ();
        }
        /// <summary>
        /// 当前选择的按键标记为选中状态
        /// </summary>
        /// <param name="button">Button.</param>
        public static void selected (Button button)
        {
            gateWay.IsSelected = false;
            equipmentButton.IsSelected = false;
            roomButton.IsSelected = false;
            button.IsSelected = true;
            TopBottomLine.X = button.X - Application.GetRealWidth(5);
        }
 
        /// <summary>
        /// 初始化上面的控件
        /// </summary>
        static void initTopFrameLaout ()
        {
            gateWay.MouseUpEventHandler += (sender, e) => {
                selected (gateWay);
                SystemMiddle.ShowGateWayFrameLayout ();
            };
            gateWay.X = 0;
            SystemTopMeunView.AddChidren (gateWay);
            Button btnNull = new Button () { 
                X = gateWay.Right,
                Width = Application.GetRealWidth(5),
                BackgroundColor = 0xFF333333,
            };
            SystemTopMeunView.AddChidren (btnNull);
 
            equipmentButton.MouseUpEventHandler += (sender, e) => {
                selected (equipmentButton);
                CommonPage.FindGatewayChilrenIPAddress = "255.255.255.255";
                SystemMiddle.ShowEquipmentBase ();
            };
            equipmentButton.X = btnNull.Right;
            SystemTopMeunView.AddChidren (equipmentButton);
            Button btnNull2 = new Button () {
                X = equipmentButton.Right,
                Width = Application.GetRealWidth(5),
                BackgroundColor = 0xFF333333,
            };
            SystemTopMeunView.AddChidren (btnNull2);
 
            roomButton.MouseUpEventHandler += (sender, e) => {
                selected (roomButton);
                new SystemRoom().ShowRoomList ();
            };
            roomButton.X = btnNull2.Right;
            SystemTopMeunView.AddChidren (roomButton);
            SystemTopMeunView.AddChidren (TopBottomLine);
        }
    }
}