From 84e76cf2fcbe26142750131d3c27eaac0335e40a Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 11 三月 2021 11:04:08 +0800
Subject: [PATCH] 上传一个添加红外宝 Ios 版本
---
HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs | 557 ++++++++++++++----------------------------------------
1 files changed, 148 insertions(+), 409 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
index b5c0cbe..d651ae9 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
@@ -8,9 +8,13 @@
{
public class A31PlayMusicPage : FrameLayout
{
- public A31PlayMusicPage()
- {
- }
+ /// <summary>
+ /// 褰撳墠瀵硅薄鏋勯�犲嚱鏁�
+ /// </summary>
+ public A31PlayMusicPage() { }
+ /// <summary>
+ /// 閲嶅啓RemoveFromParent鏂规硶
+ /// </summary>
public override void RemoveFromParent()
{
base.RemoveFromParent();
@@ -28,14 +32,17 @@
}
}
+ /// <summary>
+ /// new甯冨眬鐣岄潰
+ /// </summary>
View.PlayView playView = new View.PlayView();
-
+
public void Show()
{
///1绉掑畾鏃舵洿鏂扮姸鎬�
timerUpdateStatus();
#region ---鐣岄潰甯冨眬---
- this.BackgroundColor = Color.ViewColor;
+ this.BackgroundColor = MusicColor.ViewColor;
var topView = new TopView();
topView.setBtn.Visible = true;
this.AddChidren(topView.TopFLayoutView());
@@ -44,15 +51,13 @@
{
RemoveFromParent();
};
- topView.setBtn.MouseUpEventHandler += (sender, e) =>
+ topView.clickSetBtn.MouseUpEventHandler += (sender, e) =>
{
A31MusicSourcePage a31MusicSourcePage = new A31MusicSourcePage();
MainPage.BasePageView.AddChidren(a31MusicSourcePage);
a31MusicSourcePage.Show();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
};
-
-
var middLayout = new FrameLayout
{
Y = topView.fLayout.Bottom,
@@ -62,8 +67,33 @@
///鍔犺浇鎾斁闊充箰鐣岄潰鐨勬帶浠舵柟娉�
playView.viewFrameLayout(middLayout);
#endregion
+ #region ---鎺т欢鐨勭偣鍑讳簨浠�---
+ //鏀惰棌鍥炬爣浜嬩欢
+ playView.collectIconBtn.MouseUpEventHandler += (sender, e) =>
+ {
+ playView.collectIconBtn.IsSelected = !playView.collectIconBtn.IsSelected;
+ if (playView.collectIconBtn.IsSelected)
+ {
+ A31MusicModel.Current.collect = true;
+ }
+ else
+ {
+ A31MusicModel.Current.collect = false;
+ }
-
+ };
+ //蹇繘婊戝姩寮硅捣浜嬩欢;
+ playView.diyArcSeekBar.OnStopTrackingTouchEvent+= (sender, e) =>
+ {
+ int totalSecond = (int)(playView.diyArcSeekBar.Progress * 1.0f / 100 * int.Parse(A31MusicModel.Current.A31PlayStatus.totlen) / 1000);
+ //鍒嗛挓
+ int Minute = totalSecond / 60;
+ //绉掗挓
+ int Second = totalSecond % 60;
+ string time = "00" + ":" + (Minute.ToString().Length < 2 ? "0" + Minute.ToString() : Minute.ToString()) + ":" + (Second.ToString().Length < 2 ? "0" + Second.ToString() : Second.ToString());
+ SendMethod.Seek(time, A31MusicModel.Current);
+ A31MusicModel.Current.A31PlayStatus.curpos = (DateTime.Parse(time) - DateTime.Parse("00:00:00")).TotalMilliseconds.ToString();
+ };
///鍒囨崲鎾斁妯″紡鐐瑰嚮浜嬩欢;
playView.playOrderBtn.MouseUpEventHandler += (sender, e) =>
{
@@ -151,192 +181,37 @@
{
#region 甯冨眬鐣岄潰---
Loading loading = new Loading();
- FrameLayout popFra = new FrameLayout()
+ UI2.FuntionControlView.Music.View.MyListView myListView = new UI2.FuntionControlView.Music.View.MyListView();
+ myListView.frameLayout(this, A31MusicModel.Current);
+ myListView.dialogFra.AddChidren(loading);//dialogFra鍒锋柊鍥炬爣鐖舵帶浠�
+ ///涓嬫媺鍒锋柊
+ myListView.verticalScrolViewLayout.BeginHeaderRefreshingAction += () =>
{
- BackgroundColor = Color.PopupBackgroundColor,
+ //缁撴潫鍒锋柊
+ myListView.verticalScrolViewLayout.EndHeaderRefreshing();
};
- this.AddChidren(popFra);
-
- FrameLayout dialogFra = new FrameLayout()
- {
- X = Application.GetRealWidth(16),
- Y = Application.GetRealHeight(187),
- Width = Application.GetRealWidth(344),
- Height = Application.GetRealHeight(460),
- BackgroundColor = Color.WhiteColor,
- Radius = (uint)Application.GetRealHeight(12),
- };
- popFra.AddChidren(dialogFra);
- dialogFra.AddChidren(loading);//dialogFra鍒锋柊鍥炬爣鐖舵帶浠�
-
- FrameLayout topFra = new FrameLayout()
- {
- Width = Application.GetRealWidth(344),
- Height = Application.GetRealHeight(50),
- };
- dialogFra.AddChidren(topFra);
- Button orderIconBtn = new Button
- {
- X = Application.GetRealWidth(16),
- Y = Application.GetRealHeight(11),
- Width = Application.GetMinRealAverage(28),
- Height = Application.GetMinRealAverage(28),
- };
- topFra.AddChidren(orderIconBtn);
- Button orderTxetBtn = new Button
- {
- X = Application.GetRealWidth(60),
- Y = Application.GetRealHeight(14),
- Width = Application.GetRealWidth(120),
- Height = Application.GetRealHeight(22),
- TextColor = Color.TextColor,
- TextSize = TextSize.Text16,
- TextAlignment = TextAlignment.CenterLeft,
- };
- topFra.AddChidren(orderTxetBtn);
- switch (A31MusicModel.Current.A31PlayStatus.loop)
- {
- //0鍒楄〃寰幆锛�1鍗曟洸寰幆锛�2闅忔満鎾斁;
- case "0":
- orderIconBtn.UnSelectedImagePath = "MusicIcon/list.png";
- orderTxetBtn.Text = Language.StringByID(StringId.listMode);
- break;
-
- case "1":
- orderIconBtn.UnSelectedImagePath = "MusicIcon/single.png";
- orderTxetBtn.Text = Language.StringByID(StringId.singleMode);
-
- break;
- case "2":
- orderIconBtn.UnSelectedImagePath = "MusicIcon/random.png";
- orderTxetBtn.Text = Language.StringByID(StringId.randomMode);
- break;
- }
- Button backIextBtn = new Button
- {
- X = Application.GetRealWidth(288),//300
- Y = Application.GetRealHeight(15),
- Width = Application.GetRealWidth(28 + 12),//28
- Height = Application.GetRealHeight(20),
- TextID = StringId.cancelMusic,
- TextColor = Color.MusicNoTxetColor,
- TextSize = TextSize.Text14,
- TextAlignment = TextAlignment.CenterLeft,
- };
- topFra.AddChidren(backIextBtn);
- Button lineBtn = new Button
- {
- Y = topFra.Height - 1,
- Width = Application.GetRealWidth(344),
- Height = H_W.Line,
- BackgroundColor = Color.LineColor,
- };
- topFra.AddChidren(lineBtn);
- VerticalScrolViewLayout verticalScrolViewLayout = new VerticalScrolViewLayout
- {
- Y = Application.GetRealHeight(50),
- Height = Application.GetRealHeight(410),
- Width = Application.GetRealWidth(344),
- };
- dialogFra.AddChidren(verticalScrolViewLayout);
///绉婚櫎鐣岄潰
EventHandler<MouseEventArgs> removeFromParentView = (sen, e1) =>
{
-
- if (updateSelectedMusicThread != null)
- {
- try
- {
- if (updateSelectedMusicThread.IsAlive)
- {
- updateSelectedMusicThread.Abort();
- ///鍏抽棴绾跨▼
- }
- }
- catch { }
- }
-
- popFra.RemoveFromParent();
+ myListView.popFra.RemoveFromParent();
};
- backIextBtn.MouseUpEventHandler += removeFromParentView;
- popFra.MouseUpEventHandler += removeFromParentView;
+ myListView.backIextBtn.MouseUpEventHandler += removeFromParentView;
+ myListView.popFra.MouseUpEventHandler += removeFromParentView;
#endregion
loading.Start();
- System.Threading.Tasks.Task.Run(() =>
+ GetMusicList((listName) =>
{
- string playListName = "List";
- string sourceName = "SourceName";
- try
- {
- if (A31MusicModel.Current.A31PlayStatus.Source == "STATION-NETWORK")
- {
- A31MusicModel.Current.CurrentPlayMusicInfoList = new List<MusicInfo>();
- return;
- }
- if (A31MusicModel.Current.A31PlayStatus.Source == "AIRPLAY")
- {
- A31MusicModel.Current.CurrentPlayMusicInfoList = new List<MusicInfo>();
- return;
- }
- var playString = SendMethod.GetCurrentPlayList(A31MusicModel.Current);
- A31MusicModel.Current.CurrentPlayMusicInfoList = new List<MusicInfo>();
- var se = System.Security.SecurityElement.FromString(playString);
- while (se.Children != null)
- {
- se = se.Children[0] as System.Security.SecurityElement;
- }
- playListName = SecurityElement.FromString(se.Text).SearchForChildByTag("ListName").Text;
- sourceName = SecurityElement.FromString(se.Text).SearchForChildByTag("ListInfo").SearchForTextOfTag("SourceName");
- foreach (SecurityElement track in SecurityElement.FromString(se.Text).SearchForChildByTag("Tracks").Children)
- {
- MusicInfo musicInfo = new MusicInfo();
- musicInfo.URL = track.SearchForTextOfTag("URL").Replace("&", "&amp;");
- var metadata = track.SearchForTextOfTag("Metadata");
- musicInfo.SourceName = track.SearchForTextOfTag("Source");
- if (string.IsNullOrEmpty(metadata))
- {
- continue;
- }
- if (A31MusicModel.IsJson(metadata))
- {
- var qqSong = Newtonsoft.Json.JsonConvert.DeserializeObject<SendMethod.A31QQSong>(metadata);
- musicInfo.Album = qqSong.album;
- musicInfo.Title = qqSong.title;
- musicInfo.Artist = qqSong.creator;
- }
- else
- {
- metadata = metadata.Replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "").Replace("&", "&amp;");
- var item = SecurityElement.FromString(metadata).SearchForChildByTag("item");
- musicInfo.Title = item.SearchForTextOfTag("dc:title");
- musicInfo.Artist = item.SearchForTextOfTag("upnp:artist");
- musicInfo.Album = item.SearchForTextOfTag("upnp:album");
- musicInfo.Duration = item.SearchForTextOfTag("res");
- musicInfo.AlbumId = item.SearchForTextOfTag("song:albumid");
- }
- A31MusicModel.Current.CurrentPlayMusicInfoList.Add(musicInfo);
- }
- }
- catch { }
- finally
- {
- Application.RunOnMainThread(() =>
- {
- loading.Hide();
- PlayListView(popFra, verticalScrolViewLayout, playListName);
- UpdateSelectedMusic(verticalScrolViewLayout);
- });
- }
+ loading.Hide();
+ PlayListView(myListView.popFra, myListView.verticalScrolViewLayout, listName);
+ UpdateSelectedMusic(myListView.popFra, myListView.verticalScrolViewLayout);
});
-
+
};
///闊抽噺鍥炬爣鐐瑰嚮浜嬩欢
playView.volIconBtn.MouseUpEventHandler += (sender, e) =>
{
if (A31MusicModel.Current.ServerClientType == 1 && A31MusicModel.Current.Slave.slave_list.Count != 0)
{ ///涓绘挱鏀惧櫒
- //new View.DialogView { }.PlayerVolumeView(A31MusicModel.Current);
-
var volumeView = new View.DialogView { };
volumeView.PlayerVolumeView(A31MusicModel.Current);
volumeView.UpdateVolume();
@@ -411,9 +286,11 @@
}
};
-
+ #endregion
}
-
+ /// <summary>
+ /// 瀹氫箟鍏ㄥ眬绾跨▼
+ /// </summary>
System.Threading.Thread timerThread;
/// <summary>
/// 瀹氭椂鏇存柊鐘舵��
@@ -486,16 +363,23 @@
playView.loveBtn.IsSelected = false;
}
}
-
-
+ playView.regionBtn.Text = A31MusicModel.Current.GetRoomListName();
+ if (A31MusicModel.Current.collect)
+ {
+ playView.collectIconBtn.IsSelected = true;
+ }
+ else
+ {
+ playView.collectIconBtn.IsSelected = false;
+ }
//if (A31MusicModel.Current.A31PlayStatus.IsMute)
//{
- // btnMute.IsSelected = true;//闈欓煶鍥炬爣
+ // // btnMute.IsSelected = true;//闈欓煶鍥炬爣
// playView.volSeekBar.Progress = 0;
//}
//else
//{
- // btnMute.IsSelected = false;//闈欓煶鍥炬爣
+ // // btnMute.IsSelected = false;//闈欓煶鍥炬爣
// if (1000 < (DateTime.Now - A31MusicModel.ProgressDateTime).TotalMilliseconds)
// {
// //澹伴煶杩涘害鏉�;
@@ -531,12 +415,12 @@
if (totalSecond == 0)
{
//姝屾洸杩涘害鏉�
- //playView.volSeekBar.Progress = 0;
+ playView.diyArcSeekBar.Progress = 0;
}
else
{
//姝屾洸杩涘害鏉�
- //playView.volSeekBar.Progress = (int)(playSecond * 100.0 / totalSecond);//+1
+ playView.diyArcSeekBar.Progress = (int)(playSecond * 100.0 / totalSecond);//+1
}
}
@@ -544,7 +428,7 @@
{
playView.playBtn.IsSelected = false;
//鍋滄鎾斁
- playView.startTimeBtn.Text = "00:00";
+ playView.startTimeBtn.Text =playTime;
}
playView.songNameTextView.Text = (A31MusicModel.Current.A31PlayStatus.Title == null ? "Unkown" : A31MusicModel.Current.A31PlayStatus.Title);
playView.singerBtn.Text = (A31MusicModel.Current.A31PlayStatus.Artist == null ? "Unkown" : A31MusicModel.Current.A31PlayStatus.Artist.Trim());
@@ -582,33 +466,26 @@
playView.playOrderBtn.Alpha = 1;
playView.playOrderBtn.Enable = true;
- //btnPlay.Alpha = 1;
- //btnPlay.Enable = true;
- playView.volSeekBar.IsClickable = true;
+ playView.diyArcSeekBar.IsClickable = true;
switch (A31MusicModel.Current.A31PlayStatus.Source)
{
case "QPLAY"://QQ闊充箰
- //currentsource.UnSelectedImagePath = "MusicIcon/qqmusic1.png";
playView.loveBtn.Alpha = 0.5f;
playView.loveBtn.Enable = false;
break;
case "AIRPLAY"://閰风嫍闊充箰
- //currentsource.UnSelectedImagePath = "MusicIcon/kumusic.png";
playView.loveBtn.Alpha = 0.5f;
playView.loveBtn.Enable = false;
- playView.volSeekBar.IsClickable = false;
+ playView.diyArcSeekBar.IsClickable = false;
break;
case "SONGLIST-NETWORK"://鏈湴闊充箰
- //currentsource.UnSelectedImagePath = "MusicIcon/musicMusic1.png";
break;
case "SONGLIST-LOCAL"://USB
- //currentsource.UnSelectedImagePath = "MusicIcon/USB1.png";
break;
case "RADIO-NETWORK"://鍦ㄧ嚎鐢靛彴
- //currentsource.UnSelectedImagePath = "MusicIcon/local1.png";
playView.playlistBtn.Alpha = 1;
playView.playlistBtn.Enable = true;
@@ -621,44 +498,8 @@
playView.playOrderBtn.Alpha = 0.5f;
playView.playOrderBtn.Enable = false;
break;
-
- case "STATION-NETWORK"://Pandora鐢靛彴
- playView.volSeekBar.IsClickable = false;
- //currentsource.UnSelectedImagePath = "MusicIcon/pandora1.png";
- playView.loveBtn.Alpha = 0.5f;
- playView.loveBtn.Enable = false;
-
- playView.prevBtn.Alpha = 0.5f;
- playView.prevBtn.Enable = false;
-
- playView.playOrderBtn.Alpha = 0.5f;
- playView.playOrderBtn.Enable = false;
- break;
-
case "BLUETOOTH"://钃濈墮
- // currentsource.UnSelectedImagePath = "MusicIcon/bluetooth1.png";
- playView.loveBtn.Alpha = 0.5f;
- playView.loveBtn.Enable = false;
-
- playView.playlistBtn.Alpha = 0.5f;
- playView.playlistBtn.Enable = false;
-
- playView.prevBtn.Alpha = 0.5f;
- playView.prevBtn.Enable = false;
-
- playView.nextBtn.Alpha = 0.5f;
- playView.nextBtn.Enable = false;
-
- playView.playOrderBtn.Alpha = 0.5f;
- playView.playOrderBtn.Enable = false;
-
- //btnPlay.Alpha = 0.5f;
- //btnPlay.Enable = false;
- break;
-
-
case "LINE-IN"://绾胯矾杈撳叆
- // currentsource.UnSelectedImagePath = "MusicIcon/muiscline1.png";
playView.loveBtn.Alpha = 0.5f;
playView.loveBtn.Enable = false;
@@ -674,13 +515,9 @@
playView.playOrderBtn.Alpha = 0.5f;
playView.playOrderBtn.Enable = false;
- //btnPlay.Alpha = 0.5f;
- //btnPlay.Enable = false;
break;
-
default:
- //currentsource.UnSelectedImagePath = "MusicIcon/dlna.png";
- playView.volSeekBar.IsClickable = false;
+ playView.diyArcSeekBar.IsClickable = false;
playView.loveBtn.Alpha = 0.5f;
playView.loveBtn.Enable = false;
@@ -697,194 +534,96 @@
playView.playOrderBtn.Enable = false;
break;
}
- //if (A31MusicModel.Current.A31PlayStatus.playSource == "UPnPServer")
- //{
- // currentsource.UnSelectedImagePath = "MusicIcon/dlna.png";
- //}
- //else if (A31MusicModel.Current.A31PlayStatus.playSource == "Tidal")
- //{
- // currentsource.UnSelectedImagePath = "MusicIcon/Tidal1.png";
- //}
}
/// <summary>
- /// 鏄剧ず褰撳墠鎾斁闊充箰View
+ /// 鍔犺浇鎾斁闊充箰鍒楄〃View
/// </summary>
/// <param name="verticalScrolViewLayout"></param>
- void PlayListView(FrameLayout frameLayout, VerticalScrolViewLayout verticalScrolViewLayout, string playListName)
+ void PlayListView(FrameLayout frameLayout, VerticalRefreshLayout verticalScrolViewLayout, string playListName)
{
verticalScrolViewLayout.RemoveAll();
- int number = 0;
- for (int i = 0; i < A31MusicModel.Current.CurrentPlayMusicInfoList.Count; i++)
- {
- number++;
- var songs = A31MusicModel.Current.CurrentPlayMusicInfoList[i];
- if (string.IsNullOrEmpty(songs.Title))
- {
- //闃叉姝屾洸鍚嶅瓧涓虹┖鎶涘紓甯�
- songs.Title = " ";
- }
- if (string.IsNullOrEmpty(songs.Artist))
- {
- //闃叉姝屾墜鍚嶅瓧涓虹┖鎶涘紓甯�
- songs.Artist = " ";
- }
- FrameLayout musicViewFl = new FrameLayout
- {
- Width = Application.GetRealWidth(375),
- Height = Application.GetRealHeight(44),
- };
- verticalScrolViewLayout.AddChidren(musicViewFl);
- //鍒楄〃褰撳墠鎾斁闊充箰鍥炬爣
- Button playIconBtn = new Button
- {
- X = Application.GetRealWidth(16),
- Y = Application.GetRealHeight(10),
- Width = Application.GetMinRealAverage(24),
- Height = Application.GetMinRealAverage(24),
- UnSelectedImagePath = "MusicIcon/playStatus.png",
- Visible = false,
- Name = "playStatus",
- Tag = songs.URL,
- };
- musicViewFl.AddChidren(playIconBtn);
- //姝屾洸鎺т欢
- Button songBtn = new Button
- {
- X = Application.GetRealWidth(16),
- Y = Application.GetRealHeight(11),
- Width = Application.GetRealWidth(100),
- Height = Application.GetRealHeight(22),
- TextColor = Color.MusicTxet14Color,
- TextSize = TextSize.Text16,
- TextAlignment = TextAlignment.CenterLeft,
- Name = "song",
- Tag = songs.URL,
- Text = songs.Title.Trim()
- };
- musicViewFl.AddChidren(songBtn);
- var wText = songBtn.GetTextWidth();//鑾峰彇鏂囨湰瀹藉害
- ///(姝屾洸+姝屾墜)瀹藉害鏈�澶у�兼椂280
- if (wText > 280)
- {
-
- songBtn.Width = Application.GetRealWidth(280);
- }
- else
- {
- songBtn.Width = wText + 5;
- }
- //姝屾墜鎺т欢
- Button singerBtn = new Button
- {
- X = songBtn.Right,
- Y = Application.GetRealHeight(11),
- Width = Application.GetRealWidth(280 - songBtn.Width),
- Height = Application.GetRealHeight(22),
- TextColor = Color.MusicNoTxetColor,
- TextSize = TextSize.Text12,
- TextAlignment = TextAlignment.CenterLeft,
- //Text =("-" +songs.Artist).Trim(),
- Name = "singer",
- Tag = songs.URL,
- Text = "-" + songs.Artist.Trim()
- };
- musicViewFl.AddChidren(singerBtn);
- if (wText > 280)
- {
- ///姝屽悕闀垮害灏忎簬250鎵嶅彲浠ユ樉绀烘瓕鎵嬪嚭鏉�
- singerBtn.Width = Application.GetRealWidth(0);
- }
-
- //鐐瑰嚮鎺т欢
- Button clickBtn = new Button
- {
- Width = Application.GetRealWidth(280),
- Height = Application.GetRealHeight(44),
- Tag = number,//鏍囪鎾斁鍝竴棣栨瓕鏇�
- };
- musicViewFl.AddChidren(clickBtn);
- ///鐐瑰嚮鎾斁浜嬩欢
- clickBtn.MouseUpEventHandler += (sender, e) =>
- {
- if (updateSelectedMusicThread != null)
- {
- try
- {
- if (updateSelectedMusicThread.IsAlive)
- {
- updateSelectedMusicThread.Abort();
- ///鍏抽棴绾跨▼
- }
- }
- catch { }
- }
- System.Threading.Tasks.Task.Run(() =>
- {
- System.Threading.Thread.Sleep(50);
- Application.RunOnMainThread(() =>
- {
- //绉婚櫎鐣岄潰
- frameLayout.RemoveFromParent();
- A31MusicModel.Current.A31PlayStatus.Title = songBtn.Text;
- System.Threading.Tasks.Task.Run(() =>
- {
- SendMethod.ListMusicPlay(playListName, clickBtn.Tag, A31MusicModel.Current);
- });
- });
- });
-
- };
-
- }
+ UI2.FuntionControlView.Music.UpdateThread.playMusuc(verticalScrolViewLayout,"鎾斁鍒楄〃", playListName, A31MusicModel.Current.CurrentPlayMusicInfoList,A31MusicModel.Current,frameLayout);
}
/// <summary>
/// 瀹氭椂鏇存柊褰撳墠鎾斁闊充箰
/// </summary>
- System.Threading.Thread updateSelectedMusicThread;
- void UpdateSelectedMusic(VerticalScrolViewLayout middViewLayout)
+ void UpdateSelectedMusic(FrameLayout frameLayout, VerticalRefreshLayout middViewLayout)
{
- updateSelectedMusicThread = new System.Threading.Thread(() =>
+ UI2.FuntionControlView.Music.UpdateThread.updateThread(frameLayout, middViewLayout, A31MusicModel.Current);
+ }
+ /// <summary>
+ /// 璇诲彇鎾斁闊充箰鍒楄〃
+ /// </summary>
+ /// <param name="action"></param>
+ void GetMusicList(Action<string> action) {
+ System.Threading.Tasks.Task.Run(() =>
{
- while (this.Parent != null)
+ string playListName = "List";
+ string sourceName = "SourceName";
+ try
{
- System.Threading.Thread.Sleep(1000);
+ if (A31MusicModel.Current.A31PlayStatus.Source == "STATION-NETWORK")
+ {
+ A31MusicModel.Current.CurrentPlayMusicInfoList = new List<MusicInfo>();
+ return;
+ }
+ if (A31MusicModel.Current.A31PlayStatus.Source == "AIRPLAY")
+ {
+ A31MusicModel.Current.CurrentPlayMusicInfoList = new List<MusicInfo>();
+ return;
+ }
+ var playString = SendMethod.GetCurrentPlayList(A31MusicModel.Current);
+ A31MusicModel.Current.CurrentPlayMusicInfoList = new List<MusicInfo>();
+ var se = System.Security.SecurityElement.FromString(playString);
+ while (se.Children != null)
+ {
+ se = se.Children[0] as System.Security.SecurityElement;
+ }
+ playListName = SecurityElement.FromString(se.Text).SearchForChildByTag("ListName").Text;
+ sourceName = SecurityElement.FromString(se.Text).SearchForChildByTag("ListInfo").SearchForTextOfTag("SourceName");
+ foreach (SecurityElement track in SecurityElement.FromString(se.Text).SearchForChildByTag("Tracks").Children)
+ {
+ MusicInfo musicInfo = new MusicInfo();
+ musicInfo.URL = track.SearchForTextOfTag("URL").Replace("&", "&amp;");
+ var metadata = track.SearchForTextOfTag("Metadata");
+ musicInfo.SourceName = track.SearchForTextOfTag("Source");
+ if (string.IsNullOrEmpty(metadata))
+ {
+ continue;
+ }
+ if (A31MusicModel.IsJson(metadata))
+ {
+ var qqSong = Newtonsoft.Json.JsonConvert.DeserializeObject<SendMethod.A31QQSong>(metadata);
+ musicInfo.Album = qqSong.album;
+ musicInfo.Title = qqSong.title;
+ musicInfo.Artist = qqSong.creator;
+ }
+ else
+ {
+ metadata = metadata.Replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "").Replace("&", "&amp;");
+ var item = SecurityElement.FromString(metadata).SearchForChildByTag("item");
+ musicInfo.Title = item.SearchForTextOfTag("dc:title");
+ musicInfo.Artist = item.SearchForTextOfTag("upnp:artist");
+ musicInfo.Album = item.SearchForTextOfTag("upnp:album");
+ musicInfo.Duration = item.SearchForTextOfTag("res");
+ musicInfo.AlbumId = item.SearchForTextOfTag("song:albumid");
+ }
+ A31MusicModel.Current.CurrentPlayMusicInfoList.Add(musicInfo);
+ }
+ }
+ catch { }
+ finally
+ {
Application.RunOnMainThread(() =>
{
- try
- {
- for (int i = 0; i < middViewLayout.ChildrenCount; i++)
- {
- FrameLayout view = (FrameLayout)middViewLayout.GetChildren(i);
- var volIconBtn = (Button)view.GetChildren(0);//鐩存帴FrameLayout鐖舵帶浠舵壘鍒拌鎺т欢Button
- var songNameBtn = (Button)view.GetChildren(1);//鐩存帴FrameLayout鐖舵帶浠舵壘鍒拌鎺т欢Button
- var artistNameBtn = (Button)view.GetChildren(2);//鐩存帴FrameLayout鐖舵帶浠舵壘鍒拌鎺т欢Button
- if (A31MusicModel.Current.A31PlayStatus.TrackURL == songNameBtn.Tag.ToString())
- {
- volIconBtn.Visible = true;
- songNameBtn.TextColor = Color.SelectedColor;
- songNameBtn.X = Application.GetRealWidth(48);
- artistNameBtn.X = songNameBtn.Right;
- artistNameBtn.TextColor = Color.SelectedColor;
- }
- else
- {
- volIconBtn.Visible = false;
- songNameBtn.TextColor = Color.MusicTxet14Color;
- songNameBtn.X = Application.GetRealWidth(16);
- artistNameBtn.X = songNameBtn.Right;
- artistNameBtn.TextColor = Color.MusicNoTxetColor;
- }
-
-
- }
- }
- catch { }
-
+ action(playListName);
+ //loading.Hide();
+ //PlayListView(myListView.popFra, myListView.verticalScrolViewLayout, playListName);
+ //UpdateSelectedMusic(myListView.popFra, myListView.verticalScrolViewLayout);
});
}
- })
- { IsBackground = true };
- updateSelectedMusicThread.Start();
+ });
+
}
}
}
--
Gitblit v1.8.0