mac
2023-09-25 87d8d4adb1dd948c2beebdc9c4b84a7d426b60cc
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
using HDL_ON.UI.Music;
using System;
using Shared;
 
namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView
{
    public class TypeSingleFramLayout
    {
 
        private uint UpBackgroundColor = MusicColor.ViewColor;
        private uint DownBackgroundColor = 0xFFEFEFEF;
        /// <summary>
        /// 单个类型容器
        /// </summary>
        public FrameLayout singleFramLayout = new FrameLayout
        {
            BackgroundColor = MusicColor.ViewColor,
            Gravity = Gravity.CenterHorizontal,
            Width = Application.GetRealWidth(101),
            Height = Application.GetRealHeight(40),
            Radius = (uint)Application.GetRealHeight(20),
        };
 
        public Button btnLeftImage = new Button
        {
            X = Application.GetRealWidth(16),
            Width = Application.GetRealWidth(16),
            Height = Application.GetRealWidth(16),
            UnSelectedImagePath = "AksIcon/yingku.png",
            Gravity = Gravity.CenterVertical,
            Name = "btnLeftImage",
        };
 
        public Button btnName = new Button
        {
 
            Width = Application.GetRealWidth(32),
            Height = Application.GetRealHeight(23),
            TextID = StringId.yingku,
            TextSize = TextSize.Text16,
            TextColor = MusicColor.TextColor,
            TextAlignment = TextAlignment.Center,
            Gravity = Gravity.CenterVertical,
            IsMoreLines = true,
            Padding=new Padding(0,0,0,0),
            Name = "btnName",
        };
 
        public Button btnRightImage = new Button
        {
 
            Width = Application.GetRealWidth(5),
            Height = Application.GetRealWidth(8),
            UnSelectedImagePath = "AksIcon/yingkunext.png",
            Gravity = Gravity.CenterVertical,
            Name = "btnRightImage",
        };
 
 
        public void AddView(FrameLayout layout)
        {
            layout.AddChidren(singleFramLayout);
            singleFramLayout.AddChidren(btnLeftImage);
            singleFramLayout.AddChidren(btnName);
            singleFramLayout.AddChidren(btnRightImage);
            btnName.X = btnLeftImage.Right + Application.GetRealWidth(4);
            btnRightImage.X = btnName.Right + Application.GetRealWidth(8);
        }
 
 
 
        public void SetClickUpBackgroundColor(uint backgroundColor)
        {
            this.UpBackgroundColor = backgroundColor;
 
        }
 
        public void SetClickDownBackgroundColor(uint backgroundColor)
        {
            this.DownBackgroundColor = backgroundColor;
        }
 
        /// <summary>
        /// 事件监听方法
        /// </summary>
        /// <param name="action">回调(第一个是父类对象;</param>
        public void SetClickListener(Action<FrameLayout> action)
        {
            EventHandler<MouseEventArgs> UpClick = (sender, e) =>
            {
                //singleFramLayout.BackgroundColor = this.UpBackgroundColor;
           
                //弹起来还原背景颜色
            };
            singleFramLayout.MouseUpEventHandler += UpClick;
            btnLeftImage.MouseUpEventHandler += UpClick;
            btnName.MouseUpEventHandler += UpClick;
            btnRightImage.MouseUpEventHandler += UpClick;
 
            EventHandler<MouseEventArgs> DownClick = (sender, e) =>
            {
                //按下去改变背景颜色
                //singleFramLayout.BackgroundColor = this.DownBackgroundColor;
                action?.Invoke(singleFramLayout);
            };
            singleFramLayout.MouseDownEventHandler += DownClick;
            btnLeftImage.MouseDownEventHandler += DownClick;
            btnName.MouseDownEventHandler += DownClick;
            btnRightImage.MouseDownEventHandler += DownClick;
        }
    }
}