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.localMusic;
|
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.Current.GetPalyList(A31MusicModel.Current.functionMusic);
|
}
|
catch { }
|
finally
|
{
|
Application.RunOnMainThread(() =>
|
{
|
this.FileView();
|
middViewLayout.EndHeaderRefreshing();
|
});
|
}
|
});
|
|
};
|
|
}
|
/// <summary>
|
/// 加载文件夹View的方法
|
/// </summary>
|
public void FileView()
|
{
|
middViewLayout.RemoveAll();
|
for (int i = 0; i < A31MusicModel.Current.palyLists.Count; i++)
|
{
|
var list = A31MusicModel.Current.palyLists[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);
|
};
|
|
}
|
}
|
}
|
}
|