HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2019-10-28 8b4d79ca03495e522a1953e04ca17527f33c853a
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
using System;
using Shared.Common;
using Shared.Phone.Device.CommonForm;
 
namespace Shared.Phone.Device.Category
{
    public class CategorySceneSelectImgByLocal:FrameLayout
    {
 
        /// <summary>
        /// bodyFrameLayout
        /// </summary>
        private FrameLayout bodyFrameLayout;
 
        public  Action<string> action;
 
        public CategorySceneSelectImgByLocal()
        {
            BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
        }
        public override void RemoveFromParent()
        {
            base.RemoveFromParent();
        }
 
        public void Show()
        {
 
            AddTop();
 
            AddBodyView();
        }
 
 
        #region Add____________________________________
 
        /// <summary>
        /// AddTop
        /// </summary>
        public void AddTop()
        {
            var top = new TopFrameLayout();
            AddChidren(top);
            top.InitTopview();
            top.SetTopTitle(R.MyInternationalizationString.SelectScenePic);
            top.backButton.MouseUpEventHandler += (sender, e) =>
            {
                RemoveFromParent();
            };
        }
 
        /// <summary>
        /// AddBodyView
        /// </summary>
        public void AddBodyView()
        {
            bodyFrameLayout = new FrameLayout()
            {
                Y = Application.GetRealHeight(184),
                Height = Application.GetRealHeight(1737),
                BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor
            };
            AddChidren(bodyFrameLayout);
 
            //FunctionIconButton
            var scrollView = new VerticalScrolViewLayout()
            {
                Height = Application.GetRealHeight(1737),
                BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor
            };
            bodyFrameLayout.AddChidren(scrollView);
 
            int k = 1;
            for (int j = 0; j < 2; j++)
            {
                var itemView = new FrameLayout()
                {
                    Height = Application.GetRealHeight(311 + CommonPage.XLeft)
                };
                scrollView.AddChidren(itemView);
                for (int i = 0; i < 2; i++)
                {
                    var icon = new Button()
                    {
                        X=Application.GetRealWidth(CommonPage.XLeft+i*(467+32)),
                        Width=Application.GetMinRealAverage(467),
                        Height=Application.GetMinRealAverage(311),
                        Gravity=Gravity.CenterVertical,
                        UnSelectedImagePath = $"SceneIcon/{k}.png",
                    };
                    itemView.AddChidren(icon);
                    k++;
 
                    EventHandler<MouseEventArgs> selectIcon = (sender, e) =>
                    {
                        //CategoryAddScene.ImagePath = icon.UnSelectedImagePath;
                        //Room.AddRoomScene.ImagePath = icon.UnSelectedImagePath;
                        action?.Invoke(icon.UnSelectedImagePath);
                        action = null;
                        this.RemoveFromParent();
 
                    };
                    icon.MouseUpEventHandler += selectIcon;
                }
            }
 
        }
        #endregion
    }
}