mac
2024-07-25 3f6685c77beeb12baf840733fb890860f4c26e7c
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
using System;
using Shared;
using HDL_ON.UI.Music;
using System.Collections.Generic;
namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView
{
    public class ImageFramlayout : BaseFramLayout
    {
 
        public const int widthFrameLayout = 109;
        public const int heightFrameLayout = 168;
 
        public ImageFramlayout(int width = widthFrameLayout, int height = heightFrameLayout)
        {
            this.Width = Application.GetRealWidth(width);
            this.Height = Application.GetRealHeight(height);
            this.BackgroundColor = 0x00000000;
        }
 
        public ImageView btnImage = new ImageView
        {
            Height = Application.GetRealHeight(140),
            Width = Application.GetRealWidth(109),
            Radius = (uint)Application.GetRealHeight(12),
        };
 
        public Button btnScore = new Button
        {
            Y = Application.GetRealHeight(110),
            X = Application.GetRealWidth(21),
            Height = Application.GetRealHeight(22),
            Width = Application.GetRealWidth(80),
            Text = "9.1",
            TextColor = MusicColor.WhiteColor,
            TextSize = TextSize.Text16,
            TextAlignment = TextAlignment.CenterRight,
            IsBold=true,
        };
 
        public Button btnName = new Button
        {
            //Y = Application.GetRealHeight(140 + 8),
            Width = Application.GetRealWidth(widthFrameLayout),
            Height = Application.GetRealHeight(20),
            TextSize = TextSize.Text14,
            TextColor = MusicColor.TextColor,
            TextAlignment = TextAlignment.CenterLeft,
            Padding = new Padding(0, 0, 0, 0),
            IsMoreLines = true,
        };
 
        public void AddView(FrameLayout layout)
        {
            layout.AddChidren(this);
            this.AddChidren(btnImage);
            this.AddChidren(btnScore);
            this.AddChidren(btnName);
            btnName.Y = btnImage.Bottom + Application.GetRealHeight(8);
 
        }
 
        /// <summary>
        /// 事件监听方法
        /// </summary>
        /// <param name="action">回调(第一个是父类对象/param>
        public void SetClickListener(Action<FrameLayout> action)
        {
            EventHandler<MouseEventArgs> UpClick = (sender, e) =>
            {
                //this.BackgroundColor = 0x00000000;
                //弹起来还原背景颜色
                action?.Invoke(this);
            };
            this.MouseUpEventHandler += UpClick;
            btnImage.MouseUpEventHandler += UpClick;
            btnScore.MouseUpEventHandler += UpClick;
            btnName.MouseUpEventHandler += UpClick;
 
 
            EventHandler<MouseEventArgs> CancelClick = (sender, e) =>
            {
                //this.BackgroundColor = 0x00000000;
                //弹起来还原背景颜色
            };
            this.MouseUpOutsideEventHandler += CancelClick;
            btnImage.MouseUpOutsideEventHandler += CancelClick;
            btnScore.MouseUpOutsideEventHandler += CancelClick;
            btnName.MouseUpOutsideEventHandler += CancelClick;
 
            EventHandler<MouseEventArgs> DownClick = (sender, e) =>
            {
                //按下去改变背景颜色
                //this.BackgroundColor = AksCommonMethod.seleBackgroundColor;
               
            };
            this.MouseUpEventHandler += DownClick;
            btnImage.MouseUpEventHandler += DownClick;
            btnScore.MouseUpEventHandler += DownClick;
            btnName.MouseUpEventHandler += DownClick;
        }
 
    }
}