using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using Shared;
|
using Shared.SimpleControl.Phone;
|
using Shared.SimpleControl.R;
|
|
namespace Shared.SimpleControl.Phone.Music
|
{
|
/// <summary>
|
/// 我的最爱界面
|
/// </summary>
|
class LikeList:Shared.FrameLayout
|
{
|
|
public void Show(MusicModel musicModel)
|
{
|
|
AddChidren(new Button()
|
{
|
Height = Application.GetRealHeight(30),
|
BackgroundColor = 0xFF262626,
|
});
|
|
var topFrameLayout = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(100),
|
Y = Application.GetRealHeight(30),
|
BackgroundColor = 0xFF121212,
|
};
|
AddChidren(topFrameLayout);
|
|
Button back = new Button
|
{
|
Width = Application.GetRealWidth(82),
|
Height = Application.GetRealHeight(89),
|
X = Application.GetRealWidth(10),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/HomepageBack.png",
|
};
|
topFrameLayout.AddChidren(back);
|
back.MouseDownEventHandler += (sender,e) =>
|
{
|
this.RemoveFromParent();
|
};
|
|
Button musiclist = new Button
|
{
|
Width = Application.GetRealWidth(200),
|
Height = Application.GetRealHeight(150),
|
TextID= MyInternationalizationString.Musiclike,
|
TextSize =15,
|
X = Application.GetRealWidth(200),
|
Gravity = Gravity.CenterVertical,
|
};
|
topFrameLayout.AddChidren(musiclist);
|
|
var likelist = new VerticalScrolViewLayout{
|
Width=LayoutParams.MatchParent,
|
Height =Application.GetRealHeight (Application.DesignHeight-130),
|
Y= topFrameLayout.Bottom,
|
BackgroundColor =0xff2F2F2F,
|
};
|
this.AddChidren(likelist);
|
|
for (int i = 0; i < musicModel.LovePlayList.Count; i++)
|
{
|
RowLayout likemusic = new RowLayout
|
{
|
Width = LayoutParams.MatchParent,
|
Height = Application.GetRealHeight(100),
|
};
|
likelist.AddChidren(likemusic);
|
|
var titleMusic = new Button
|
{
|
Width = Application.GetRealWidth(80),
|
Height = Application.GetRealHeight(70),
|
X = Application.GetRealWidth(10),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/PlayMusic.png",
|
};
|
likemusic.AddChidren(titleMusic);
|
|
var songmker = new Button
|
{
|
Width = LayoutParams.MatchParent,
|
Height = LayoutParams.MatchParent,
|
Text = musicModel.LovePlayList[i].name,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth(120),
|
Tag = musicModel.LovePlayList[i].number,
|
};
|
likemusic.AddChidren(songmker);
|
|
var del = new Button
|
{
|
//Text = "删除" ,
|
TextID = MyInternationalizationString.Musicdel,
|
BackgroundColor = 0xFFFF0000,
|
Tag = musicModel.LovePlayList[i].number,
|
};
|
|
del.MouseUpEventHandler += (sender, e) =>
|
{
|
for (int j = 0; j < musicModel.LovePlayList.Count; j++)
|
{
|
if (musicModel.LovePlayList[j].number == del.Tag.ToString())
|
{
|
musicModel.LovePlayList.RemoveAt(j);
|
break;
|
}
|
}
|
likemusic.RemoveFromParent();
|
};
|
likemusic.AddRightView(del);
|
|
songmker.MouseUpEventHandler += (sender, e) =>
|
{
|
likemusic.BackgroundColor = 0xffFE5E00;
|
System.Threading.Tasks.Task.Run(() =>
|
{
|
System.Threading.Thread.Sleep(50);
|
Application.RunOnMainThread(() =>
|
{
|
//先移除当前控件的前面那个控件
|
this.Parent.RemoveAt(this.Parent.ChildrenCount - 3);
|
this.Parent.RemoveAt(this.Parent.ChildrenCount - 2);
|
//当前控件界面
|
this.RemoveFromParent();
|
PlayPage playMusic = new PlayPage { };
|
MainPage.MainFrameLayout.AddChidren(playMusic);
|
playMusic.Show(musicModel, musicModel.LovePlayList);
|
playMusic.SourceId = 1;
|
Control.ControlBytesSend(Command.ControlMusicModel2, musicModel.SubnetID, musicModel.DeviceID, MusicModel.MusiceBytes("*Z011SONG" + songmker.Tag + "2"));
|
});
|
});
|
};
|
}
|
|
}
|
|
}
|
}
|