From 024703246120fee33e2f6c2f662383f1facdecd2 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期四, 14 四月 2022 15:35:00 +0800
Subject: [PATCH] 2022年04月14日15:34:55
---
HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs | 475 ++++++++++++++++++++++++++++-------------------------------
1 files changed, 226 insertions(+), 249 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
index d651ae9..d0d4d23 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
@@ -3,6 +3,7 @@
using com.hdl.on;
using System.Collections.Generic;
using System.Security;
+using HDL_ON.UI.UI2.FuntionControlView.Music;
namespace HDL_ON.UI.Music
{
@@ -36,17 +37,19 @@
/// new甯冨眬鐣岄潰
/// </summary>
View.PlayView playView = new View.PlayView();
-
+ TopView topView;
+
+
public void Show()
{
+
///1绉掑畾鏃舵洿鏂扮姸鎬�
timerUpdateStatus();
#region ---鐣岄潰甯冨眬---
this.BackgroundColor = MusicColor.ViewColor;
- var topView = new TopView();
+ topView = new TopView();
topView.setBtn.Visible = true;
this.AddChidren(topView.TopFLayoutView());
- topView.topNameBtn.Text = A31MusicModel.Current.Name;
topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
{
RemoveFromParent();
@@ -67,112 +70,79 @@
///鍔犺浇鎾斁闊充箰鐣岄潰鐨勬帶浠舵柟娉�
playView.viewFrameLayout(middLayout);
#endregion
- #region ---鎺т欢鐨勭偣鍑讳簨浠�---
+
+ #region ---鐣岄潰鐐瑰嚮浜嬩欢---
+ playView.collectIconBtn.Visible = false;//鍏堟殏鏃堕殣钘忔敹钘忓姛鑳�
//鏀惰棌鍥炬爣浜嬩欢
playView.collectIconBtn.MouseUpEventHandler += (sender, e) =>
{
playView.collectIconBtn.IsSelected = !playView.collectIconBtn.IsSelected;
if (playView.collectIconBtn.IsSelected)
{
- A31MusicModel.Current.collect = true;
+ A31MusicModel.Current.functionMusic.collect = true;
}
else
{
- A31MusicModel.Current.collect = false;
+ A31MusicModel.Current.functionMusic.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) =>
{
+ string modeValueString = string.Empty;
string msg = Language.StringByID(StringId.switchTo);
- switch (A31MusicModel.Current.A31PlayStatus.loop)
+ string modeKeyValue = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.mode);
+ switch (modeKeyValue)
{
- //0鍒楄〃寰幆锛�1鍗曟洸寰幆锛�2闅忔満鎾斁;
- case "0":
- A31MusicModel.Current.A31PlayStatus.loop = "1";
+ //list_cycle鍒楄〃寰幆锛宻ingle_cycle鍗曟洸寰幆锛宺andom闅忔満鎾斁;
+ case ValueProperty.list_cycle:
+ modeValueString=ValueProperty.single_cycle;
playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/single.png";
msg += Language.StringByID(StringId.singleMode);
break;
-
- case "1":
- A31MusicModel.Current.A31PlayStatus.loop = "2";
+ case ValueProperty.single_cycle:
+ modeValueString =ValueProperty.random;
playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/random.png";
msg += Language.StringByID(StringId.randomMode);
break;
- case "2":
- A31MusicModel.Current.A31PlayStatus.loop = "0";
+ case ValueProperty.random:
+ modeValueString = ValueProperty.list_cycle;
playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/list.png";
msg += Language.StringByID(StringId.listMode);
break;
+
}
+ A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.mode, modeValueString);
new PublicAssmebly().TipMsgAutoClose(msg, false,1000);
- string url = "http://" + A31MusicModel.Current.IPAddress + "/httpapi.asp?command=setPlayerCmd:" + "loopmode:" + A31MusicModel.Current.A31PlayStatus.loop;
- SendMethod.SendCommand(url);
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ dic.Add(KeyProperty.mode,modeValueString);
+ SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic,dic);
};
///娣诲姞鍠滅埍鐐瑰嚮浜嬩欢;
playView.loveBtn.MouseUpEventHandler += (sender, e) =>
{
- var url = A31MusicModel.Current.A31PlayStatus.TrackURL;
- var album = A31MusicModel.Current.A31PlayStatus.Album;
- var artist = A31MusicModel.Current.A31PlayStatus.Artist;
- var song = A31MusicModel.Current.A31PlayStatus.Title;
- if (A31MusicModel.Current.A31PlayStatus.Source == "RADIO-NETWORK")
+ var name = A31MusicModel.Current.functionMusic.GetAttribute("song_name").ToString();
+ var songTime = A31MusicModel.Current.functionMusic.GetAttribute("song_time").ToString();
+ playView.loveBtn.IsSelected = !playView.loveBtn.IsSelected;
+ if (playView.loveBtn.IsSelected)
{
- playView.loveBtn.IsSelected = !playView.loveBtn.IsSelected;
- if (playView.loveBtn.IsSelected)
+ if (null == A31MusicModel.Current.LoveMusicInfoList.Find((musicInfo) =>
{
- if (null == A31MusicModel.Current.LoveRadioInfoList.Find((musicInfo) =>
- {
- return url == musicInfo.URL;
- }))
- {
- A31MusicModel.Current.LoveRadioInfoList.Add(new MusicInfo { Title = song, URL = url, });
- }
- }
- else
+ return name == musicInfo.name;
+ }))
{
- A31MusicModel.Current.LoveRadioInfoList.RemoveAll((musicInfo) =>
- {
- return url == musicInfo.URL;
- });
+ A31MusicModel.Current.LoveMusicInfoList.Add(new Songs { name = name, time = songTime });
}
}
else
{
- playView.loveBtn.IsSelected = !playView.loveBtn.IsSelected;
- if (playView.loveBtn.IsSelected)
+ A31MusicModel.Current.LoveMusicInfoList.RemoveAll((musicInfo) =>
{
- if (null == A31MusicModel.Current.LoveMusicInfoList.Find((musicInfo) =>
- {
- return url == musicInfo.URL;
- }))
- {
- A31MusicModel.Current.LoveMusicInfoList.Add(new MusicInfo { Title = song, URL = url, Artist = artist, Album = album });
- }
- }
- else
- {
- A31MusicModel.Current.LoveMusicInfoList.RemoveAll((musicInfo) =>
- {
- //涔熻鍔犳瓕鎵嬪悕鍒ゆ柇
- return musicInfo.URL == url;
- });
- }
-
+ //涔熻鍔犳瓕鎵嬪悕鍒ゆ柇
+ return musicInfo.name == name;
+ });
}
A31MusicModel.Save();
};
@@ -187,8 +157,34 @@
///涓嬫媺鍒锋柊
myListView.verticalScrolViewLayout.BeginHeaderRefreshingAction += () =>
{
+ System.Threading.Tasks.Task.Run(() =>
+ {
+ try
+ {
+ A31MusicModel.Current.palyLists.Clear();
+ if (A31MusicModel.Current.palyLists.Count == 0)
+ {
+ SendMethod.mMethod.GetPalyList(A31MusicModel.Current.functionMusic);
+
+ }
+ }
+ catch
+ {
+ }
+ finally
+ {
+ Application.RunOnMainThread(() =>
+ {
+ myListView.verticalScrolViewLayout.EndHeaderRefreshing();
+ myListView.verticalScrolViewLayout.RemoveAll();
+ var listName = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playlist_name);
+ var musicList = A31MusicModel.Current.GetSongList(listName);
+ A31SongPlay.SongListView(myListView.verticalScrolViewLayout, musicList, listName, myListView.popFra);
+ });
+ }
+ });
//缁撴潫鍒锋柊
- myListView.verticalScrolViewLayout.EndHeaderRefreshing();
+
};
///绉婚櫎鐣岄潰
EventHandler<MouseEventArgs> removeFromParentView = (sen, e1) =>
@@ -198,25 +194,18 @@
myListView.backIextBtn.MouseUpEventHandler += removeFromParentView;
myListView.popFra.MouseUpEventHandler += removeFromParentView;
#endregion
- loading.Start();
- GetMusicList((listName) =>
- {
- loading.Hide();
- PlayListView(myListView.popFra, myListView.verticalScrolViewLayout, listName);
- UpdateSelectedMusic(myListView.popFra, myListView.verticalScrolViewLayout);
- });
-
+ //var listName = A31MusicModel.Current.functionMusic.GetAttribute("playlist_name").ToString();
+ //var musicList = A31MusicModel.Current.GetSongList(listName);
+ //new A31SongPlay { }.SongListView(myListView.verticalScrolViewLayout, musicList, listName);
+
+ PlayListView(myListView.popFra, myListView.verticalScrolViewLayout);
+ UpdateSelectedMusic(myListView.popFra, myListView.verticalScrolViewLayout);
+
};
///闊抽噺鍥炬爣鐐瑰嚮浜嬩欢
playView.volIconBtn.MouseUpEventHandler += (sender, e) =>
{
- if (A31MusicModel.Current.ServerClientType == 1 && A31MusicModel.Current.Slave.slave_list.Count != 0)
- { ///涓绘挱鏀惧櫒
- var volumeView = new View.DialogView { };
- volumeView.PlayerVolumeView(A31MusicModel.Current);
- volumeView.UpdateVolume();
-
- }
+
};
///闊抽噺杩涘害鏉$偣鍑讳簨浠�
int startVolume =0;//涔嬪墠鐨勯煶閲�
@@ -226,9 +215,14 @@
playView.volValueBtn.Text = playView.volSeekBar.Progress + "%";
if (startVolume != e)
{
+ ///鏇存柊鏈�鏂板��
+ A31MusicModel.ProgressDateTime = DateTime.Now;
startVolume = e;
- SendMethod.ControlVolume(e, A31MusicModel.Current);
- A31MusicModel.Current.A31PlayStatus.vol = e.ToString();
+ A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.volume, startVolume);
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ dic.Add(KeyProperty.volume, startVolume.ToString());
+ SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
+
}
};
playView.volSeekBar.OnProgressChangedEvent += progressClick;
@@ -237,7 +231,12 @@
playView.prevBtn.MouseDownEventHandler += (sender, e) =>
{
playView.prevBtn.IsSelected = true;
- SendMethod.Previous(A31MusicModel.Current);
+
+ A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.song_step,ValueProperty.down);
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ dic.Add(KeyProperty.song_step, ValueProperty.up);
+ SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
+
};
playView.prevBtn.MouseUpEventHandler += (sender, e) =>
{
@@ -246,46 +245,53 @@
///鏆傚仠/鎾斁鐐瑰嚮浜嬩欢
playView.playBtn.MouseDownEventHandler += (sender, e) =>
{
+ string status = string.Empty;
if (playView.playBtn.IsSelected)
{
playView.playBtn.IsSelected = false;
- SendMethod.Pause(A31MusicModel.Current);
- A31MusicModel.Current.A31PlayStatus.status = "pause";
+ status = ValueProperty.off;
+
}
else
{
playView.playBtn.IsSelected = true;
- SendMethod.Play(A31MusicModel.Current);
- A31MusicModel.Current.A31PlayStatus.status = "play";
+ status = ValueProperty.on;
}
+ A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.on_off, status);
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ dic.Add(KeyProperty.on_off, status);
+ SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
};
///涓嬩竴鏇茬偣鍑讳簨浠�
playView.nextBtn.MouseDownEventHandler += (sender, e) =>
{
playView.nextBtn.IsSelected = true;
- SendMethod.Next(A31MusicModel.Current);
+ A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.song_step,ValueProperty.down);
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ dic.Add(KeyProperty.song_step, ValueProperty.down);
+ SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
};
playView.nextBtn.MouseUpEventHandler += (sender, e) =>
{
playView.nextBtn.IsSelected = false;
};
- ///鐗╃悊鎸夐敭鐨勭偣鍑讳簨浠�
- Volume.VolumeChange = (volume) =>
- {
- if (Application.DeviceType == Device.Ios && A31MusicModel.Current.A31PlayStatus.Source == "BLUETOOTH")
- {
- return;
- }
- playView.volSeekBar.Progress = volume;
-
- if (startVolume != volume)
- {
- startVolume = volume;
- SendMethod.ControlVolume(volume, A31MusicModel.Current);
- A31MusicModel.Current.A31PlayStatus.vol = volume.ToString();
- }
-
- };
+ /////鐗╃悊鎸夐敭鐨勭偣鍑讳簨浠�
+ //Volume.VolumeChange = (volume) =>
+ //{
+ // if (Application.DeviceType == Device.Ios && A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.source) == "bluetooth")
+ // {
+ // return;
+ // }
+ // playView.volSeekBar.Progress = volume;
+ // if (startVolume != volume)
+ // {
+ // startVolume = volume;
+ // A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.volume, startVolume);
+ // Dictionary<string, string> dic = new Dictionary<string, string>();
+ // dic.Add(KeyProperty.volume, startVolume.ToString());
+ // SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
+ // }
+ //};
#endregion
}
/// <summary>
@@ -305,10 +311,9 @@
{
try
{
-
//鏇存柊鎬绘椂闂�
//鎬诲叡鏈夊灏戠
- int totalSecond = int.Parse(A31MusicModel.Current.A31PlayStatus.totlen) / 1000;
+ int totalSecond = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_time));
//鍒嗛挓
int totalMusicMinute = totalSecond / 60;
//绉掗挓
@@ -317,54 +322,54 @@
string totalTime = (totalMusicMinute.ToString().Length < 2 ? "0" + totalMusicMinute.ToString() : totalMusicMinute.ToString()) + ":" + (totalMusicSecond.ToString().Length < 2 ? "0" + totalMusicSecond.ToString() : totalMusicSecond.ToString());
playView.endTimeBtn.Text = totalTime;
- //topView.topNameBtn.Text = A31MusicModel.Current.Name;
-
- switch (A31MusicModel.Current.A31PlayStatus.loop)
+ topView.topNameBtn.Text = A31MusicModel.Current.functionMusic.name;
+ string s = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.mode);
+ switch (A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.mode))
{
- case "0"://鍒楄〃寰幆
+ case ValueProperty.list_cycle://鍒楄〃寰幆
playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/list.png";
break;
- case "1"://鍗曟洸椤虹幆
+ case ValueProperty.single_cycle://鍗曟洸寰幆
playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/single.png";
break;
- case "2"://闅忔満鎾斁
+ case ValueProperty.random://闅忔満鎾斁
playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/random.png";
break;
}
- if (A31MusicModel.Current.A31PlayStatus.Source == "RADIO-NETWORK")
- {
- var v = A31MusicModel.Current.LoveRadioInfoList.Find((like) =>
- {
- return like.URL == A31MusicModel.Current.A31PlayStatus.TrackURL;
- });
- if (v != null)
- {
- playView.loveBtn.IsSelected = true;
- }
- else
- {
- playView.loveBtn.IsSelected = false;
- }
- }
- else
- {
- var v = A31MusicModel.Current.LoveMusicInfoList.Find((like) =>
- {
- return like.URL == A31MusicModel.Current.A31PlayStatus.TrackURL;
- });
- if (v != null)
- {
- playView.loveBtn.IsSelected = true;
- }
- else
- {
- playView.loveBtn.IsSelected = false;
- }
- }
- playView.regionBtn.Text = A31MusicModel.Current.GetRoomListName();
- if (A31MusicModel.Current.collect)
+ //if (A31MusicModel.Current.A31PlayStatus.Source == "RADIO-NETWORK")
+ //{
+ // var v = A31MusicModel.Current.LoveRadioInfoList.Find((like) =>
+ // {
+ // return like.URL == A31MusicModel.Current.A31PlayStatus.TrackURL;
+ // });
+ // if (v != null)
+ // {
+ // playView.loveBtn.IsSelected = true;
+ // }
+ // else
+ // {
+ // playView.loveBtn.IsSelected = false;
+ // }
+ //}
+ //else
+ //{
+ // var v = A31MusicModel.Current.LoveMusicInfoList.Find((like) =>
+ // {
+ // return like.URL == A31MusicModel.Current.A31PlayStatus.TrackURL;
+ // });
+ // if (v != null)
+ // {
+ // playView.loveBtn.IsSelected = true;
+ // }
+ // else
+ // {
+ // playView.loveBtn.IsSelected = false;
+ // }
+ //}
+ playView.regionBtn.Text = A31MusicModel.Current.functionMusic.GetRoomListName();
+ if (A31MusicModel.Current.functionMusic.collect)
{
playView.collectIconBtn.IsSelected = true;
}
@@ -388,26 +393,43 @@
// playView.volValueBtn.Text = A31MusicModel.Current.A31PlayStatus.vol + "%";
// }
//}
-
- if (1000 < (DateTime.Now - A31MusicModel.ProgressDateTime).TotalMilliseconds)
+ //涓轰簡闃叉闊抽噺鏉¤烦鍔�,寤堕暱鏇存柊鏃堕棿(澶氬姞1s)
+ if (2000 < (DateTime.Now - A31MusicModel.ProgressDateTime).TotalMilliseconds || A31MusicModel.ProgressDateTime==DateTime.MinValue)
{
//闊抽噺杩涘害鏉�;
- playView.volSeekBar.Progress = int.Parse(A31MusicModel.Current.A31PlayStatus.vol);
+ playView.volSeekBar.Progress = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.volume));
//鏄剧ず褰撳墠闊抽噺鍊�;
- playView.volValueBtn.Text = A31MusicModel.Current.A31PlayStatus.vol + "%";
+ playView.volValueBtn.Text = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.volume) + "%";
}
//鏇存柊鎾斁鍣ㄩ煶閲忕粰绯荤粺闊抽噺
- Volume.MusicVolume = playView.volSeekBar.Progress;
- //褰撳墠鎾斁闊充箰鏃堕棿
- int playSecond = int.Parse(A31MusicModel.Current.A31PlayStatus.curpos) / 1000 + (int)(DateTime.Now - A31MusicModel.Current.LastDateTime).TotalSeconds;
-
+ //Volume.MusicVolume = playView.volSeekBar.Progress;
+ //褰撳墠鎾斁闊充箰鏃堕棿
+ //鎸夐亾鐞嗕笉浼氫负绌猴紝GetAttrState("playing_time")鍊煎彲鑳戒负绌猴紝寮哄埗杞崲int.Parse(锛変細鍑虹幇寮傚父锛屼笉杩囦篃鍋氫簡寮傚父澶勭悊浜�
+ int playSecond = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playing_time));
+ //璇嗗埆闊充箰鐘舵�佹槸鍚﹀湪鎾斁鐘舵��
+ if (A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.on_off) == ValueProperty.on)
+ {
+ //闊充箰鍦ㄦ挱鏀炬椂锛屽啀璁$畻鎾斁鏃堕棿(鐜板湪鏃堕棿=鍘熸潵鏃堕棿+1绉�)
+ playSecond +=(int)(DateTime.Now - A31MusicModel.Current.LastDateTime).TotalSeconds;
+ ///姝屾洸璁板綍鏆傛椂鏃堕棿鍐欏叆缂撳瓨锛�
+ A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.playing_time, playSecond);
+ }
+ if (playSecond<=0)
+ {
+ ///鎾斁鏃堕棿涓嶈兘灏忎簬0锛�
+ playSecond = 0;
+ }
+ if (playSecond >=totalSecond)
+ {
+ ///鎾斁鏃堕棿涓嶈兘瓒呰繃鎬绘椂闂达紱
+ playSecond = totalSecond;
+ }
int playMusicMinute = playSecond / 60;
//绉掗挓
int playMusicSecond = playSecond % 60;
-
string playTime = (playMusicMinute.ToString().Length < 2 ? "0" + playMusicMinute.ToString() : playMusicMinute.ToString()) + ":" + (playMusicSecond.ToString().Length < 2 ? "0" + playMusicSecond.ToString() : playMusicSecond.ToString());
- if (A31MusicModel.Current.A31PlayStatus.status == "play")
+ if (A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.on_off) == ValueProperty.on)
{
playView.playBtn.IsSelected = true;
//濡傛灉鍦ㄦ挱鏀撅紝鏃堕棿灏变笉鏂彉鍖�
@@ -423,17 +445,21 @@
playView.diyArcSeekBar.Progress = (int)(playSecond * 100.0 / totalSecond);//+1
}
+
}
else
{
playView.playBtn.IsSelected = false;
//鍋滄鎾斁
playView.startTimeBtn.Text =playTime;
+ //playView.startTimeBtn.Text ="00:00";
+ ///姝屾洸璁板綍鏆傚仠鏃堕棿锛�<LastDateTime 璁$畻鏃堕棿鎾斁鏃堕棿鏈夌敤鍒�>
+ A31MusicModel.Current.LastDateTime = DateTime.Now;
}
- 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());
+ playView.songNameTextView.Text = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name) == null ? "Unkown" : A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name);
+ playView.singerBtn.Text = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name) == null ? "Unkown" : A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name);
//鏇存柊婧愮殑鐣岄潰
- showSourcePage();
+ // showSourcePage();
}
catch (Exception e)
{
@@ -469,18 +495,9 @@
playView.diyArcSeekBar.IsClickable = true;
- switch (A31MusicModel.Current.A31PlayStatus.Source)
+ switch (A31MusicModel.Current.functionMusic.GetAttrState("source"))
{
-
- case "QPLAY"://QQ闊充箰
- playView.loveBtn.Alpha = 0.5f;
- playView.loveBtn.Enable = false;
- break;
- case "AIRPLAY"://閰风嫍闊充箰
- playView.loveBtn.Alpha = 0.5f;
- playView.loveBtn.Enable = false;
- playView.diyArcSeekBar.IsClickable = false;
- break;
+ //sdcard/audio_in/ftp/radio/bluetooth
case "SONGLIST-NETWORK"://鏈湴闊充箰
break;
case "SONGLIST-LOCAL"://USB
@@ -539,91 +556,51 @@
/// 鍔犺浇鎾斁闊充箰鍒楄〃View
/// </summary>
/// <param name="verticalScrolViewLayout"></param>
- void PlayListView(FrameLayout frameLayout, VerticalRefreshLayout verticalScrolViewLayout, string playListName)
+ void PlayListView(FrameLayout frameLayout, VerticalRefreshLayout verticalScrolViewLayout)
{
verticalScrolViewLayout.RemoveAll();
- UI2.FuntionControlView.Music.UpdateThread.playMusuc(verticalScrolViewLayout,"鎾斁鍒楄〃", playListName, A31MusicModel.Current.CurrentPlayMusicInfoList,A31MusicModel.Current,frameLayout);
+ var listName = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playlist_name);
+ var musicList = A31MusicModel.Current.GetSongList(listName);
+ if (musicList.Count == 0)
+ {
+ System.Threading.Tasks.Task.Run(() =>
+ {
+ try
+ {
+ A31MusicModel.Current.palyLists.Clear();
+ if (A31MusicModel.Current.palyLists.Count == 0)
+ {
+ SendMethod.mMethod.GetPalyList(A31MusicModel.Current.functionMusic);
+
+ }
+ }
+ catch
+ {
+ }
+ finally
+ {
+ Application.RunOnMainThread(() =>
+ {
+ musicList = A31MusicModel.Current.GetSongList(listName);
+ A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, frameLayout);
+ });
+ }
+ });
+ }
+ else
+ {
+ A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, frameLayout);
+ }
}
/// <summary>
/// 瀹氭椂鏇存柊褰撳墠鎾斁闊充箰
/// </summary>
void UpdateSelectedMusic(FrameLayout frameLayout, VerticalRefreshLayout middViewLayout)
{
- UI2.FuntionControlView.Music.UpdateThread.updateThread(frameLayout, middViewLayout, A31MusicModel.Current);
+ UpdateThread.updateCurrMusicThread(frameLayout, middViewLayout, A31MusicModel.Current);
}
- /// <summary>
- /// 璇诲彇鎾斁闊充箰鍒楄〃
- /// </summary>
- /// <param name="action"></param>
- void GetMusicList(Action<string> action) {
- System.Threading.Tasks.Task.Run(() =>
- {
- 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(() =>
- {
- action(playListName);
- //loading.Hide();
- //PlayListView(myListView.popFra, myListView.verticalScrolViewLayout, playListName);
- //UpdateSelectedMusic(myListView.popFra, myListView.verticalScrolViewLayout);
- });
- }
- });
- }
+
+
}
}
--
Gitblit v1.8.0