xm
2019-07-16 b910cb79c9b5bcc204022a3cf9e6950f0a64dfbd
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
using System;
using Shared.Common;
namespace Shared.Phone.Device.Category
{
    public class CategorySceneSelectImgByLocal:FrameLayout
    {
        public  Action action;
        public CategorySceneSelectImgByLocal()
        {
            BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
        }
        public void Show()
        {
            #region topview
            var topBGView = new FrameLayout()
            {
                Height = Application.GetRealHeight(CommonPage.Navigation_Height),
                BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor
            };
            AddChidren(topBGView);
            var topView = new FrameLayout()
            {
                Y = Application.GetRealHeight(CommonPage.NavigationTitle_Y),
                Height = Application.GetRealHeight(CommonPage.Navigation_Height - CommonPage.NavigationTitle_Y),
                BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor,
            };
            AddChidren(topView);
 
            var title = new Button()
            {
                TextAlignment = TextAlignment.Center,
                TextID = R.MyInternationalizationString.SelectPic,
                TextSize = 20,
                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                Width = Application.GetRealWidth(CommonPage.AppRealWidth - 500),
                Gravity = Gravity.CenterHorizontal
            };
            topView.AddChidren(title);
 
            var back = new Device.CommonForm.BackButton() { };
            topView.AddChidren(back);
 
            back.MouseUpEventHandler += (sender, e) =>
            {
                this.RemoveFromParent();
            };
            #endregion
 
            #region midFL
            var midFl = new VerticalScrolViewLayout()
            {
                Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.Navigation_Height),
                Y = topView.Bottom,
                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
            };
            this.AddChidren(midFl);
 
            for (int i = 0; i < 17; i++)
            {
                var RoomRowView = new FrameLayout()
                {
                    Y=midFl.Bottom,
                    Height = Application.GetRealHeight(430),
                    BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
                };
                midFl.AddChidren(RoomRowView);
 
                var backGroundBtn = new Button()
                {
 
                    Y = Application.GetRealHeight(30),
                    Width = Application.GetMinRealAverage(CommonPage.AppRealWidth - CommonPage.XLeft * 2),
                    Height = Application.GetMinRealAverage(400),
                    Gravity=Gravity.CenterHorizontal,
                    UnSelectedImagePath = "Scene/Scene" + i.ToString() + ".png",
                    Radius = CommonPage.BigFormRadius
                };
                RoomRowView.AddChidren(backGroundBtn);
 
                backGroundBtn.MouseUpEventHandler += (sender, e) =>
                {
                    CategoryAddScene.ImagePath = backGroundBtn.UnSelectedImagePath;
                    Room.AddRoomScene.ImagePath = backGroundBtn.UnSelectedImagePath;
                    action?.Invoke();
                    this.RemoveFromParent();
                };
            }
            #endregion
        }
    }
}