using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using Shared;
|
using Shared.Net;
|
|
namespace HDL_ON.UI.Music
|
{
|
public class A31LoveMusicList : FrameLayout
|
{
|
public A31LoveMusicList()
|
{
|
Tag = "Music";
|
}
|
|
VerticalRefreshLayout middViewLayout;
|
/// <summary>
|
/// 先加载界面出来
|
/// </summary>
|
public void Show()
|
{
|
#region 界面布局------
|
|
this.BackgroundColor = Color.ViewColor;
|
var topView = new TopView();
|
this.AddChidren(topView.TopFLayoutView());
|
topView.topNameBtn.TextID = StringId.myLove;//a31Music;
|
topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
this.RemoveFromParent();
|
};
|
middViewLayout = new VerticalRefreshLayout
|
{
|
BackgroundColor = Color.WhiteColor,
|
Y = topView.fLayout.Bottom,
|
Height = Application.GetRealHeight(H_W.H - H_W.T_Height),
|
};
|
this.AddChidren(middViewLayout);
|
middViewLayout.BeginHeaderRefreshingAction += () =>
|
{
|
middViewLayout.EndHeaderRefreshing();
|
};
|
#endregion
|
MusicView(Language.StringByID(StringId.myLove));
|
}
|
/// <summary>
|
/// 加载数据的方法
|
/// </summary>
|
public void MusicView(string listName)
|
{
|
middViewLayout.RemoveAll();
|
for (int i = 0; i < A31MusicModel.Current.LoveMusicInfoList.Count; i++)
|
{
|
var songs = A31MusicModel.Current.LoveMusicInfoList[i];
|
View.SongView songView = new View.SongView();
|
songView.SongFrameLayout(middViewLayout, songs);
|
//添加收藏
|
songView.loveIcon.MouseUpEventHandler += (sender, e) =>
|
{
|
var music= A31MusicModel.Current.LoveMusicInfoList.Find((m) => m.URL == songs.URL);
|
if (music!= null)
|
{
|
///存在就删除
|
A31MusicModel.Current.LoveMusicInfoList.Remove(music);
|
}
|
A31MusicModel.Save();
|
songView.musicViewFl.RemoveFromParent();
|
};
|
//添加到我的列表
|
songView.addIcon.MouseUpEventHandler = (sender, e) =>
|
{
|
new View.DialogView { }.FieListView(songs);
|
};
|
///点击播放事件
|
songView.clickBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
|
System.Threading.Tasks.Task.Run(() =>
|
{
|
System.Threading.Thread.Sleep(50);
|
Application.RunOnMainThread(() =>
|
{
|
//移除界面
|
A31MusicModel.Current.A31PlayStatus.Title = songView.songBtn.Text;
|
MainPage.BasePageView.RemoveViewByTag("Music");
|
System.Threading.Tasks.Task.Run(() =>
|
{
|
SendMethod.PushList(songs, listName, A31MusicModel.Current.LoveMusicInfoList,A31MusicModel.Current);
|
});
|
});
|
});
|
|
};
|
|
}
|
}
|
/// <summary>
|
/// 定时更新当前播放音乐
|
/// </summary>
|
public void UpdateSelectedMusic()
|
{
|
UI2.FuntionControlView.Music.UpdateThread.updateThread(this, middViewLayout,A31MusicModel.Current);
|
}
|
|
|
}
|
}
|