黄学彪
2020-04-02 9904031f5291daaf56985146bb671f25e18ebbdf
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
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 = 0;
            for (int j = 0; j < 7; j++)
            {
                var itemView = new FrameLayout()
                {
                    Height = Application.GetRealHeight(311 + 58)
                };
                scrollView.AddChidren(itemView);
                for (int i = 0; i < 2; i++)
                {
                    var icon = new ImageView()
                    {
                        X=Application.GetRealWidth(58+i*(467+32)),
                        Y=Application.GetRealHeight(58),
                        Width=Application.GetRealWidth(467),
                        Height=Application.GetRealHeight(311),
                        ImagePath = $"SceneIcon/{k}.png",
                        Radius =(uint)Application.GetRealHeight(17)
                    };
                    itemView.AddChidren(icon);
                    icon.SetViewShadow(true);
                    k++;
 
                    EventHandler<MouseEventArgs> selectIcon = (sender, e) =>
                    {
                        action?.Invoke(icon.ImagePath);
                        action = null;
                        this.RemoveFromParent();
                    };
                    icon.MouseUpEventHandler += selectIcon;
                }
            }
        }
        #endregion
    }
}