wjc
2021-12-17 e2a009ca812c2f933e195c4276b79c34ed31862a
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
using System;
using Shared;
using HDL_ON.UI.Music;
using System.Collections.Generic;
 
namespace HDL_ON.UI.Music
{
 
    public class A31SongPlay : FrameLayout
    {
        public A31SongPlay()
        {
            Tag = "Music";
        }
 
        public void Show(List<Songs> musicList,string listName)
        {
 
            this.BackgroundColor = MusicColor.ViewColor;
            var topView = new TopView();
            this.AddChidren(topView.TopFLayoutView());
            topView.topNameBtn.TextID = StringId.usb;
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
            {
                this.RemoveFromParent();
            };
            var vv = new VerticalRefreshLayout
            {
                BackgroundColor = MusicColor.WhiteColor,
                Y = topView.fLayout.Bottom,
                Height = Application.GetRealHeight(H_W.H - H_W.T_Height),
            };
            this.AddChidren(vv);
            ///加载音乐列表
            SongListView(vv, musicList, listName);
 
 
        }
        /// <summary>
        /// 加载音乐列表
        /// </summary>
        /// <param name="vv">父控件</param>
        /// <param name="musicList">音乐列表</param>
        /// <param name="listName">列表名</param>
        public void SongListView(VerticalRefreshLayout vv,List<Songs> musicList,string listName) {
 
            for (int i = 0; i < musicList.Count; i++)
            {
                var songs = musicList[i];
                if (songs == null)
                {
                    continue;
                }
                UI.Music.View.SongView songView = new UI.Music.View.SongView();
                songView.SongFrameLayout(vv, songs);
                songView.singerBtn.Text = songs.name;
                ///点击播放事件
                songView.clickBtn.MouseUpEventHandler += (sender, e) =>
                {
                    System.Threading.Tasks.Task.Run(() =>
                    {
                        System.Threading.Thread.Sleep(50);
                        Application.RunOnMainThread(() =>
                        {
                            //移除界面
                            A31MusicModel.Current.functionMusic.SetAttrState("song_name", songView.songBtn.Text);
                            A31MusicModel.Current.functionMusic.SetAttrState("playlist_name", listName);
                            MainPage.BasePageView.RemoveViewByTag("Music");
                            Dictionary<string, string> dic = new Dictionary<string, string>();
                            dic.Add("song_name", songView.songBtn.Text);
                            dic.Add("playlist_name", listName);
                            SendMethod.sendMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
                        });
                    });
                };
 
            }
 
        }
    }
}