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
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
113
114
115
using System;
using System.Collections.Generic;
using Shared;
namespace HDL_ON.UI.Music
{
    public class A31MusicFileList : FrameLayout
    {
        public A31MusicFileList()
        {
            Tag = "Music";
        }
        VerticalRefreshLayout middViewLayout;
        public void Show()
        {
            #region   界面布局------
 
            this.BackgroundColor = MusicColor.ViewColor;
            var topView = new TopView();
            this.AddChidren(topView.TopFLayoutView());
            topView.topNameBtn.TextID = StringId.usb;
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
            {
                this.RemoveFromParent();
            };
            middViewLayout = new VerticalRefreshLayout
            {
                BackgroundColor = MusicColor.WhiteColor,
                Y = topView.fLayout.Bottom,
                Height = Application.GetRealHeight(H_W.H - H_W.T_Height),
            };
            this.AddChidren(middViewLayout);
            #endregion
 
            middViewLayout.BeginHeaderRefreshingAction += () =>
            {
                System.Threading.Tasks.Task.Run(() =>
                {
                    try
                    {
                        SendMethod.sendMethod.GetPalyList(A31MusicModel.Current.functionMusic);
                    }
                    catch { }
                    finally
                    {
                        Application.RunOnMainThread(() =>
                        {
                            FileView();
                            middViewLayout.EndHeaderRefreshing();
                        });
                    }
                });
 
            };
 
        }
        /// <summary>
        /// 加载文件夹View的方法
        /// </summary>
        public void FileView()
        {
            middViewLayout.RemoveAll();
            for (int i = 0; i < A31MusicModel.Current.palyListInfos.Count; i++)
            {
                var list = A31MusicModel.Current.palyListInfos[i];
                RowLayout addFlieRow = new RowLayout
                {
                    Height = Application.GetRealHeight(104),
                    LineColor = MusicColor.WhiteColor,
                    SubViewWidth = Application.GetRealWidth(90),//改变编辑控件宽度多少;
                };
                middViewLayout.AddChidren(addFlieRow);
                //文件图标
                Button fileIconBtn = new Button
                {
                    X = Application.GetRealWidth(16),
                    Y = Application.GetRealHeight(8),
                    Width = Application.GetRealWidth(88),
                    Height = Application.GetRealWidth(88),
                    UnSelectedImagePath = "MusicIcon/fileList.png",
                };
                addFlieRow.AddChidren(fileIconBtn);
 
                //文件名控件
                Button fileNameBtn = new Button
                {
                    X = fileIconBtn.Right + Application.GetRealWidth(16),
                    Y = Application.GetRealHeight(42),
                    Width = Application.GetRealWidth(217),
                    Height = Application.GetRealHeight(20),
                    TextColor = MusicColor.TextColor,
                    TextSize = TextSize.Text14,
                    TextAlignment = TextAlignment.CenterLeft,
                    Text = list.group,
                };
                addFlieRow.AddChidren(fileNameBtn);
 
                Button clickBtn = new Button
                {
                    X = fileIconBtn.Right + Application.GetRealWidth(16),
                    Width = Application.GetRealWidth(375 - 138),
                    Height = Application.GetRealHeight(104),
                };
                addFlieRow.AddChidren(clickBtn);
                clickBtn.MouseUpEventHandler += (sender, e) =>
                {
                    A31SongPlay a31Song = new A31SongPlay();
                    MainPage.BasePageView.AddChidren(a31Song);
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    a31Song.Show(list.songs, list.group);
                };
 
            }
        }
    }
}