From f3c8cf07fad2e39a32af549b305da6723159f755 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 31 七月 2020 12:07:19 +0800
Subject: [PATCH] 2020-07-31-1
---
HDL_ON/UI/UI2/FuntionControlView/Music/A31USBMusicList.cs | 224 ---------
HDL_ON/UI/UI2/FuntionControlView/Music/UpdateThread.cs | 17
HDL_ON/UI/UI2/FuntionControlView/Music/View/SongView.cs | 3
HDL_ON/UI/UI2/FuntionControlView/.DS_Store | 0
DLL/.DS_Store | 0
HDL_ON/UI/UI2/FuntionControlView/Music/A31LoveMusicList.cs | 332 -------------
HDL_ON/UI/UI2/FuntionControlView/Music/A31LocalMusicList.cs | 213 ---------
HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs | 13
.vs/HDL_APP_Project/xs/UserPrefs.xml | 20
HDL_ON/UI/UI2/FuntionControlView/Music/.DS_Store | 0
HDL_ON/UI/UI2/FuntionControlView/Music/A31MyListMusic.cs | 350 --------------
HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs | 162 +++++++
12 files changed, 231 insertions(+), 1,103 deletions(-)
diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml
index 5d287de..116b838 100644
--- a/.vs/HDL_APP_Project/xs/UserPrefs.xml
+++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,12 +1,15 @@
锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
<MonoDevelop.Ide.ItemProperties.HDL-ON__iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-001674E61438002E" />
- <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/FuntionControlView/Music/UpdateThread.cs">
+ <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs">
<Files>
- <File FileName="HDL_ON/UI/UI2/FuntionControlView/Music/A31USBMusicList.cs" Line="64" Column="28" IsPinned="True" />
- <File FileName="HDL_ON/UI/UI2/FuntionControlView/Music/View/SongView.cs" Line="131" Column="1" />
- <File FileName="HDL_ON/UI/UI2/FuntionControlView/Music/A31LocalMusicList.cs" Line="150" Column="65" />
- <File FileName="HDL_ON/UI/UI2/FuntionControlView/Music/UpdateThread.cs" Line="3" Column="1" />
- <File FileName="HDL_ON/UI/UI2/FuntionControlView/Music/View/SizeClass.cs" Line="2" Column="10" />
+ <File FileName="HDL_ON/UI/UI2/FuntionControlView/Music/View/SongView.cs" Line="121" Column="64" />
+ <File FileName="HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs" Line="787" Column="1" />
+ <File FileName="HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicSourcePage.cs" Line="230" Column="65" />
+ <File FileName="HDL_ON/UI/UI2/FuntionControlView/Music/UpdateThread.cs" Line="11" Column="10" />
+ <File FileName="HDL_ON/UI/UI2/FuntionControlView/Music/A31MyListMusic.cs" Line="45" Column="20" />
+ <File FileName="HDL_ON/UI/UI2/FuntionControlView/Music/A31RadioList.cs" Line="213" Column="23" />
+ <File FileName="HDL_ON/UI/UI2/FuntionControlView/Music/A31USBMusicList.cs" Line="108" Column="50" />
+ <File FileName="HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs" Line="12" Column="21" />
</Files>
<Pads>
<Pad Id="ProjectPad">
@@ -18,8 +21,9 @@
<Node name="UI2" expanded="True">
<Node name="FuntionControlView" expanded="True">
<Node name="Music" expanded="True">
- <Node name="View" expanded="True" />
- <Node name="UpdateThread.cs" selected="True" />
+ <Node name="View" expanded="True">
+ <Node name="DialogView.cs" selected="True" />
+ </Node>
</Node>
</Node>
</Node>
diff --git a/DLL/.DS_Store b/DLL/.DS_Store
index 64baa04..512469c 100644
--- a/DLL/.DS_Store
+++ b/DLL/.DS_Store
Binary files differ
diff --git a/HDL_ON/UI/UI2/FuntionControlView/.DS_Store b/HDL_ON/UI/UI2/FuntionControlView/.DS_Store
index 11be5bc..735b473 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/.DS_Store
+++ b/HDL_ON/UI/UI2/FuntionControlView/.DS_Store
Binary files differ
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/.DS_Store b/HDL_ON/UI/UI2/FuntionControlView/Music/.DS_Store
new file mode 100644
index 0000000..67a322e
--- /dev/null
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/.DS_Store
Binary files differ
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31LocalMusicList.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31LocalMusicList.cs
index 4e76276..b399c33 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31LocalMusicList.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31LocalMusicList.cs
@@ -23,18 +23,6 @@
topView.topNameBtn.TextID = StringId.localMusic;
topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
{
- if (updateSelectedMusicThread != null)
- {
- try
- {
- if (updateSelectedMusicThread.IsAlive)
- {
- updateSelectedMusicThread.Abort();
- ///鍏抽棴绾跨▼
- }
- }
- catch { }
- }
this.RemoveFromParent();
};
middViewLayout = new VerticalRefreshLayout
@@ -112,7 +100,7 @@
MainPage.BasePageView.RemoveViewByTag("Music");
System.Threading.Tasks.Task.Run(() =>
{
- PushList(songs, Language.StringByID(StringId.localMusic), MusicInfo.MusicInfoList);
+ SendMethod.PushList(songs, Language.StringByID(StringId.localMusic), MusicInfo.MusicInfoList,A31MusicModel.Current);
});
});
});
@@ -123,205 +111,10 @@
/// <summary>
/// 瀹氭椂鏇存柊褰撳墠鎾斁闊充箰
/// </summary>
- System.Threading.Thread updateSelectedMusicThread;
public void UpdateSelectedMusic()
{
- //HDL_ON.UI.UI2.FuntionControlView.Music.UpdateThread.updateThread(this, middViewLayout);
- updateSelectedMusicThread = new System.Threading.Thread(() =>
- {
- while (this.Parent != null)
- {
- System.Threading.Thread.Sleep(1000);
- 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 { }
-
- });
- }
- });
- updateSelectedMusicThread.Start();
+ UI2.FuntionControlView.Music.UpdateThread.updateThread(this, middViewLayout,A31MusicModel.Current);
}
-
- /// <summary>
- /// 鎺ㄩ�佹挱鏀惧懡浠�
- /// </summary>
- /// <param name="musicInfo">鎾斁闊充箰</param>
- /// <param name="listName">鍒楄〃鍚嶇О</param>
- /// <param name="musicList">鎺ㄩ�佸垪琛�(榛樿鎺�50棣�)</param>
- public void PushList(MusicInfo musicInfo, string listName, List<MusicInfo> musicList)
- {
-
- //鏈�澶у彂閫佺殑鏉℃暟
- int maxCount = 50;
- //鎵惧嚭褰撳墠鐐瑰嚮闊充箰鐨勭储寮�
- int statIndex = musicList.FindIndex((obj) => { return obj == musicInfo; });
- //鐐瑰嚮鍚庨潰杩樻湁澶氬皯鏉¢煶涔�
- int count = musicList.Count - statIndex;
- int endIndex = 0;
- if (maxCount < count)
- {
- //濡傛灉鍚庨潰鐨勯煶涔愬ぇ浜庢渶澶ф暟锛岃缃悗闈㈡暟鎹殑鏈�澶х储寮�
- endIndex = statIndex + maxCount - 1;
- }
- else
- {
- //濡傛灉鍚庨潰鏁版嵁涓嶅锛屽氨鐢ㄦ�绘暟鍑忓幓鏈�澶ф潯鏁帮紝寰楀埌寮�濮嬬储寮�
- statIndex = musicList.Count - maxCount - 1;
- endIndex = musicList.Count - 1;
- }
- //濡傛灉寮�濮嬬储寮曞皬浜�0锛岄偅灏辫缃负绗竴鏉¢煶涔�
- if (statIndex < 0)
- {
- statIndex = 0;
- }
-
- StringBuilder sb = new StringBuilder();
- sb.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
- sb.AppendLine("<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">");
- sb.AppendLine("<s:Body>");
- sb.AppendLine("<u:CreateQueue xmlns:u=\"urn:schemas-wiimu-com:service:PlayQueue:1\">");
- sb.AppendLine("<QueueContext><?xml version=\"1.0\"?>");
- sb.AppendLine("<PlayList>");
- sb.AppendLine("<ListName>DLNA" + listName + "</ListName>");
- sb.AppendLine("<ListInfo>");
- sb.AppendLine("<Radio>0</Radio>");//
- sb.AppendLine("<SourceName>UPnPServer</SourceName>");//
- sb.AppendLine("<MarkSearch>0</MarkSearch>");
- sb.AppendLine("<TrackNumber>" + (endIndex - statIndex + 1) + "</TrackNumber>");
- sb.AppendLine("<Quality>0</Quality>");
- sb.AppendLine("<UpdateTime>5367</UpdateTime>");
- sb.AppendLine("<LastPlayIndex>2</LastPlayIndex>");
- sb.AppendLine("<SwitchPageMode>0</SwitchPageMode>");
- sb.AppendLine("<CurrentPage>0</CurrentPage>");
- sb.AppendLine("<TotalPages>0</TotalPages>");
- sb.AppendLine("</ListInfo>");
- sb.AppendLine("<Tracks>");
-
- int number = 1;
-
- for (int i = statIndex, Tracknumber = 1; i <= endIndex; i++, Tracknumber++)
- {
- var tempMusicInfo = musicList[i];
-
- if (musicInfo == tempMusicInfo)
- {
- number = Tracknumber;
- }
-
- if (tempMusicInfo.SourceType == "Local")
- {
- tempMusicInfo.URL = "http://" + new Shared.Net.NetWiFi().IpAddress + ":" + com.hdl.on.Server.Port + "/" + tempMusicInfo.ID;
- }
-
-
- sb.AppendLine("<Track" + Tracknumber + ">");
- sb.AppendLine("<URL>" + tempMusicInfo.URL + "</URL>");
- sb.AppendLine("<Metadata>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;");
- sb.AppendLine("&lt;DIDL-Lite xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns:song=&quot;www.wiimu.com/song/&quot; xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot;&gt;");
- sb.AppendLine("&lt;upnp:class&gt;object.item.audioItem.musicTrack&lt;/upnp:class&gt;");
- sb.AppendLine("&lt;item id=&quot;0&quot;&gt;");
- sb.AppendLine("&lt;song:subid&gt;&lt;/song:subid&gt;");
- sb.AppendLine("&lt;song:description&gt;unknown&lt;/song:description&gt;");
- sb.AppendLine("&lt;song:skiplimit&gt;6&lt;/song:skiplimit&gt;");
- sb.AppendLine("&lt;song:id&gt;" + tempMusicInfo.ID + "&lt;/song:id&gt;");
- sb.AppendLine("&lt;song:like&gt;0&lt;/song:like&gt;");
- sb.AppendLine("&lt;song:singerid&gt;0&lt;/song:singerid&gt;");
- sb.AppendLine("&lt;song:albumid&gt;" + tempMusicInfo.AlbumId + "&lt;/song:albumid&gt;");
-
- sb.AppendLine("&lt;res protocolInfo=&quot;http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;&quot; duration=&quot;" + "0:0:0.0" + "&quot;&gt;" + tempMusicInfo.URL + "&lt;/res&gt;");
-
- sb.AppendLine("&lt;dc:title&gt;" + tempMusicInfo.Title + "&lt;/dc:title&gt;");
- sb.AppendLine("&lt;dc:creator&gt;DJ Sanny J&lt;/dc:creator&gt;");
- sb.AppendLine("&lt;upnp:artist&gt;" + tempMusicInfo.Artist + "&lt;/upnp:artist&gt;");
- sb.AppendLine("&lt;upnp:album&gt;" + tempMusicInfo.Album + "&lt;/upnp:album&gt;");
- sb.AppendLine("&lt;upnp:albumArtURI&gt;unknown&lt;/upnp:albumArtURI&gt;");
- sb.AppendLine("&lt;/item&gt;");
- sb.AppendLine("&lt;/DIDL-Lite&gt;");
- sb.AppendLine("</Metadata>");
- sb.AppendLine("<Id>" + tempMusicInfo.ID + "</Id>");
- sb.AppendLine("<Source>STATION-NETWORK</Source>");//UPnPServer
- sb.AppendLine("<Key>" + tempMusicInfo.URL + "</Key>");
- sb.AppendLine("</Track" + Tracknumber + ">");
- }
- sb.AppendLine("</Tracks>");
- sb.AppendLine("</PlayList>");
- sb.AppendLine("</QueueContext>");
- sb.AppendLine("</u:CreateQueue>");
- sb.AppendLine("</s:Body>");
- sb.AppendLine("</s:Envelope>");
-
- SendMusicLists(A31MusicModel.Current.IPAddress, A31MusicModel.Current.Port, "CreateQueue", sb.ToString());
-
- StringBuilder playString = new StringBuilder();
- playString.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
- playString.AppendLine("<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">");
- playString.AppendLine("<s:Body>");
- playString.AppendLine("<u:PlayQueueWithIndex xmlns:u=\"urn:schemas-wiimu-com:service:PlayQueue:1\">");
- playString.AppendLine("<QueueName>DLNA" + listName + "</QueueName>");
- playString.AppendLine("<Index>" + number + "</Index>");
- playString.AppendLine("</u:PlayQueueWithIndex>");
- playString.AppendLine("</s:Body>");
- playString.AppendLine("</s:Envelope>");
-
- Play(A31MusicModel.Current.IPAddress, A31MusicModel.Current.Port, playString.ToString());
- }
-
- void SendMusicLists(string ip, int port, string soapAction, string listInfo)
- {
- System.Net.WebClient webClient = new System.Net.WebClient();
- webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#" + soapAction + "\"");
- webClient.Headers.Add("CONTENT-TYPE", "text/xml; charset=\"utf-8\"");
- try
- {
- byte[] recevieBytes = webClient.UploadData(new Uri("http://" + ip + ":" + port + "/upnp/control/PlayQueue1"), "POST", System.Text.Encoding.UTF8.GetBytes(listInfo));
- var s = System.Text.Encoding.UTF8.GetString(recevieBytes, 0, recevieBytes.Length);
- }
- catch
- {
-
- }
- }
-
- void Play(string ip, int port, string info)
- {
- System.Net.WebClient webClient = new System.Net.WebClient();
- webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#PlayQueueWithIndex\"");
- webClient.Headers.Add("CONTENT-TYPE", "text/xml; charset=\"utf-8\"");
- try
- {
- byte[] recevieBytes = webClient.UploadData(new Uri("http://" + ip + ":" + port + "/upnp/control/PlayQueue1"), "POST", System.Text.Encoding.UTF8.GetBytes(info));
- var s = System.Text.Encoding.UTF8.GetString(recevieBytes, 0, recevieBytes.Length);
- }
- catch
- {
-
- }
- }
+
}
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31LoveMusicList.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31LoveMusicList.cs
index 6588ba5..c79ed5a 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31LoveMusicList.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31LoveMusicList.cs
@@ -27,19 +27,6 @@
topView.topNameBtn.TextID = StringId.myLove;//a31Music;
topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
{
-
- if (updateSelectedMusicThread != null)
- {
- try
- {
- if (updateSelectedMusicThread.IsAlive)
- {
- updateSelectedMusicThread.Abort();
- ///鍏抽棴绾跨▼
- }
- }
- catch { }
- }
this.RemoveFromParent();
};
middViewLayout = new VerticalRefreshLayout
@@ -65,93 +52,10 @@
for (int i = 0; i < A31MusicModel.Current.LoveMusicInfoList.Count; i++)
{
var songs = A31MusicModel.Current.LoveMusicInfoList[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),
- };
- middViewLayout.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 loveIcon = new Button
- {
- X = Application.GetRealWidth(291),
- Y = Application.GetRealHeight(8),
- Width = Application.GetMinRealAverage(28),
- Height = Application.GetMinRealAverage(28),
- UnSelectedImagePath = "MusicIcon/loveSelected.png",
- };
- musicViewFl.AddChidren(loveIcon);
- loveIcon.MouseUpEventHandler += (sender, e) =>
+ 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)
@@ -160,34 +64,15 @@
A31MusicModel.Current.LoveMusicInfoList.Remove(music);
}
A31MusicModel.Save();
- musicViewFl.RemoveFromParent();
+ songView.musicViewFl.RemoveFromParent();
};
-
//娣诲姞鍒版垜鐨勫垪琛�
- Button addIcon = new Button
- {
- X = Application.GetRealWidth(335),
- Y = Application.GetRealHeight(8),
- Width = Application.GetMinRealAverage(28),
- Height = Application.GetMinRealAverage(28),
- UnSelectedImagePath = "MusicIcon/addMusic1.png",
- };
- musicViewFl.AddChidren(addIcon);
- addIcon.MouseUpEventHandler = (sender, e) =>
+ songView.addIcon.MouseUpEventHandler = (sender, e) =>
{
new View.DialogView { }.FieListView(songs);
};
-
- //鐐瑰嚮鎺т欢
- Button clickBtn = new Button
- {
- Width = Application.GetRealWidth(280),
- Height = Application.GetRealHeight(44),
- Tag = songs,//鏍囪鎾斁鍝竴棣栨瓕鏇�
- };
- musicViewFl.AddChidren(clickBtn);
///鐐瑰嚮鎾斁浜嬩欢
- clickBtn.MouseUpEventHandler += (sender, e) =>
+ songView.clickBtn.MouseUpEventHandler += (sender, e) =>
{
System.Threading.Tasks.Task.Run(() =>
@@ -196,11 +81,11 @@
Application.RunOnMainThread(() =>
{
//绉婚櫎鐣岄潰
- A31MusicModel.Current.A31PlayStatus.Title = songBtn.Text;
+ A31MusicModel.Current.A31PlayStatus.Title = songView.songBtn.Text;
MainPage.BasePageView.RemoveViewByTag("Music");
System.Threading.Tasks.Task.Run(() =>
{
- PushList(songs, listName, A31MusicModel.Current.LoveMusicInfoList);
+ SendMethod.PushList(songs, listName, A31MusicModel.Current.LoveMusicInfoList,A31MusicModel.Current);
});
});
});
@@ -212,206 +97,11 @@
/// <summary>
/// 瀹氭椂鏇存柊褰撳墠鎾斁闊充箰
/// </summary>
- System.Threading.Thread updateSelectedMusicThread;
public void UpdateSelectedMusic()
{
- updateSelectedMusicThread = new System.Threading.Thread(() =>
- {
- while (this.Parent != null)
- {
- System.Threading.Thread.Sleep(1000);
- 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 { }
-
- });
- }
- });
- updateSelectedMusicThread.Start();
+ UI2.FuntionControlView.Music.UpdateThread.updateThread(this, middViewLayout,A31MusicModel.Current);
}
- /// <summary>
- /// 鎺ㄩ�佹挱鏀惧懡浠�
- /// </summary>
- /// <param name="musicInfo">鎾斁闊充箰</param>
- /// <param name="listName">鍒楄〃鍚嶇О</param>
- /// <param name="musicList">鎺ㄩ�佸垪琛�(榛樿鎺�50棣�)</param>
- public void PushList(MusicInfo musicInfo, string listName, List<MusicInfo> musicList)
- {
-
- //鏈�澶у彂閫佺殑鏉℃暟
- int maxCount = 50;
- //鎵惧嚭褰撳墠鐐瑰嚮闊充箰鐨勭储寮�
- int statIndex = musicList.FindIndex((obj) => { return obj == musicInfo; });
- //鐐瑰嚮鍚庨潰杩樻湁澶氬皯鏉¢煶涔�
- int count = musicList.Count - statIndex;
- int endIndex = 0;
- if (maxCount < count)
- {
- //濡傛灉鍚庨潰鐨勯煶涔愬ぇ浜庢渶澶ф暟锛岃缃悗闈㈡暟鎹殑鏈�澶х储寮�
- endIndex = statIndex + maxCount - 1;
- }
- else
- {
- //濡傛灉鍚庨潰鏁版嵁涓嶅锛屽氨鐢ㄦ�绘暟鍑忓幓鏈�澶ф潯鏁帮紝寰楀埌寮�濮嬬储寮�
- statIndex = musicList.Count - maxCount - 1;
- endIndex = musicList.Count - 1;
- }
- //濡傛灉寮�濮嬬储寮曞皬浜�0锛岄偅灏辫缃负绗竴鏉¢煶涔�
- if (statIndex < 0)
- {
- statIndex = 0;
- }
-
- StringBuilder sb = new StringBuilder();
- sb.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
- sb.AppendLine("<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">");
- sb.AppendLine("<s:Body>");
- sb.AppendLine("<u:CreateQueue xmlns:u=\"urn:schemas-wiimu-com:service:PlayQueue:1\">");
- sb.AppendLine("<QueueContext><?xml version=\"1.0\"?>");
- sb.AppendLine("<PlayList>");
- sb.AppendLine("<ListName>DLNA" + listName + "</ListName>");
- sb.AppendLine("<ListInfo>");
- sb.AppendLine("<Radio>0</Radio>");//
- sb.AppendLine("<SourceName>UPnPServer</SourceName>");//
- sb.AppendLine("<MarkSearch>0</MarkSearch>");
- sb.AppendLine("<TrackNumber>" + (endIndex - statIndex + 1) + "</TrackNumber>");
- sb.AppendLine("<Quality>0</Quality>");
- sb.AppendLine("<UpdateTime>5367</UpdateTime>");
- sb.AppendLine("<LastPlayIndex>2</LastPlayIndex>");
- sb.AppendLine("<SwitchPageMode>0</SwitchPageMode>");
- sb.AppendLine("<CurrentPage>0</CurrentPage>");
- sb.AppendLine("<TotalPages>0</TotalPages>");
- sb.AppendLine("</ListInfo>");
- sb.AppendLine("<Tracks>");
-
- int number = 1;
-
- for (int i = statIndex, Tracknumber = 1; i <= endIndex; i++, Tracknumber++)
- {
- var tempMusicInfo = musicList[i];
-
- if (musicInfo == tempMusicInfo)
- {
- number = Tracknumber;
- }
-
- if (tempMusicInfo.SourceType == "Local")
- {
- tempMusicInfo.URL = "http://" + new NetWiFi().IpAddress + ":" + com.hdl.on.Server.Port + "/" + tempMusicInfo.ID;
- }
-
-
- sb.AppendLine("<Track" + Tracknumber + ">");
- sb.AppendLine("<URL>" + tempMusicInfo.URL + "</URL>");
- sb.AppendLine("<Metadata>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;");
- sb.AppendLine("&lt;DIDL-Lite xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns:song=&quot;www.wiimu.com/song/&quot; xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot;&gt;");
- sb.AppendLine("&lt;upnp:class&gt;object.item.audioItem.musicTrack&lt;/upnp:class&gt;");
- sb.AppendLine("&lt;item id=&quot;0&quot;&gt;");
- sb.AppendLine("&lt;song:subid&gt;&lt;/song:subid&gt;");
- sb.AppendLine("&lt;song:description&gt;unknown&lt;/song:description&gt;");
- sb.AppendLine("&lt;song:skiplimit&gt;6&lt;/song:skiplimit&gt;");
- sb.AppendLine("&lt;song:id&gt;" + tempMusicInfo.ID + "&lt;/song:id&gt;");
- sb.AppendLine("&lt;song:like&gt;0&lt;/song:like&gt;");
- sb.AppendLine("&lt;song:singerid&gt;0&lt;/song:singerid&gt;");
- sb.AppendLine("&lt;song:albumid&gt;" + tempMusicInfo.AlbumId + "&lt;/song:albumid&gt;");
-
- sb.AppendLine("&lt;res protocolInfo=&quot;http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;&quot; duration=&quot;" + "0:0:0.0" + "&quot;&gt;" + tempMusicInfo.URL + "&lt;/res&gt;");
-
- sb.AppendLine("&lt;dc:title&gt;" + tempMusicInfo.Title + "&lt;/dc:title&gt;");
- sb.AppendLine("&lt;dc:creator&gt;DJ Sanny J&lt;/dc:creator&gt;");
- sb.AppendLine("&lt;upnp:artist&gt;" + listName + "&lt;/upnp:artist&gt;");
- sb.AppendLine("&lt;upnp:album&gt;" + tempMusicInfo.Album + "&lt;/upnp:album&gt;");
- sb.AppendLine("&lt;upnp:albumArtURI&gt;unknown&lt;/upnp:albumArtURI&gt;");
- sb.AppendLine("&lt;/item&gt;");
- sb.AppendLine("&lt;/DIDL-Lite&gt;");
- sb.AppendLine("</Metadata>");
- sb.AppendLine("<Id>" + tempMusicInfo.ID + "</Id>");
- sb.AppendLine("<Source>STATION-NETWORK</Source>");//UPnPServer
- sb.AppendLine("<Key>" + tempMusicInfo.URL + "</Key>");
- sb.AppendLine("</Track" + Tracknumber + ">");
- }
- sb.AppendLine("</Tracks>");
- sb.AppendLine("</PlayList>");
- sb.AppendLine("</QueueContext>");
- sb.AppendLine("</u:CreateQueue>");
- sb.AppendLine("</s:Body>");
- sb.AppendLine("</s:Envelope>");
-
- SendMusicLists(A31MusicModel.Current.IPAddress, A31MusicModel.Current.Port, "CreateQueue", sb.ToString());
-
- StringBuilder playString = new StringBuilder();
- playString.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
- playString.AppendLine("<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">");
- playString.AppendLine("<s:Body>");
- playString.AppendLine("<u:PlayQueueWithIndex xmlns:u=\"urn:schemas-wiimu-com:service:PlayQueue:1\">");
- playString.AppendLine("<QueueName>DLNA" + listName + "</QueueName>");
- playString.AppendLine("<Index>" + number + "</Index>");
- playString.AppendLine("</u:PlayQueueWithIndex>");
- playString.AppendLine("</s:Body>");
- playString.AppendLine("</s:Envelope>");
-
- Play(A31MusicModel.Current.IPAddress, A31MusicModel.Current.Port, playString.ToString());
- }
-
- void SendMusicLists(string ip, int port, string soapAction, string listInfo)
- {
- System.Net.WebClient webClient = new System.Net.WebClient();
- webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#" + soapAction + "\"");
- webClient.Headers.Add("CONTENT-TYPE", "text/xml; charset=\"utf-8\"");
- try
- {
- byte[] recevieBytes = webClient.UploadData(new Uri("http://" + ip + ":" + port + "/upnp/control/PlayQueue1"), "POST", System.Text.Encoding.UTF8.GetBytes(listInfo));
- var s = System.Text.Encoding.UTF8.GetString(recevieBytes, 0, recevieBytes.Length);
- }
- catch
- {
-
- }
- }
-
- void Play(string ip, int port, string info)
- {
- System.Net.WebClient webClient = new System.Net.WebClient();
- webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#PlayQueueWithIndex\"");
- webClient.Headers.Add("CONTENT-TYPE", "text/xml; charset=\"utf-8\"");
- try
- {
- byte[] recevieBytes = webClient.UploadData(new Uri("http://" + ip + ":" + port + "/upnp/control/PlayQueue1"), "POST", System.Text.Encoding.UTF8.GetBytes(info));
- var s = System.Text.Encoding.UTF8.GetString(recevieBytes, 0, recevieBytes.Length);
- }
- catch
- {
-
- }
- }
+
}
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MyListMusic.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MyListMusic.cs
index 4a58f1d..0951720 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MyListMusic.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MyListMusic.cs
@@ -25,19 +25,6 @@
topView.topNameBtn.Text = fileListInfo.ListName;
topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
{
-
- if (updateSelectedMusicThread != null)
- {
- try
- {
- if (updateSelectedMusicThread.IsAlive)
- {
- updateSelectedMusicThread.Abort();
- ///鍏抽棴绾跨▼
- }
- }
- catch { }
- }
this.RemoveFromParent();
};
middViewLayout = new VerticalRefreshLayout
@@ -63,99 +50,13 @@
for (int i = 0; i < fileListInfo.MusicInfoList.Count; i++)
{
var songs = fileListInfo.MusicInfoList[i];
- if (string.IsNullOrEmpty(songs.Title))
- {
- //闃叉姝屾洸鍚嶅瓧涓虹┖鎶涘紓甯�
- songs.Title = " ";
- }
- if (string.IsNullOrEmpty(songs.Artist))
- {
- //闃叉姝屾墜鍚嶅瓧涓虹┖鎶涘紓甯�
- songs.Artist = " ";
- }
- RowLayout musicViewFl = new RowLayout
- {
- Width = Application.GetRealWidth(375),
- Height = Application.GetRealHeight(44),
- LineColor = Color.WhiteColor,
- SubViewWidth = Application.GetRealWidth(90),//鏀瑰彉缂栬緫鎺т欢瀹藉害澶氬皯锛�
- };
- middViewLayout.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)
+ View.SongView songView = new View.SongView();
+ songView.SongFrameLayout(middViewLayout, songs);
+ songView.loveIcon.MouseUpEventHandler += (sender, e) =>
{
- 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 loveIcon = new Button
- {
- X = Application.GetRealWidth(291),
- Y = Application.GetRealHeight(8),
- Width = Application.GetMinRealAverage(28),
- Height = Application.GetMinRealAverage(28),
- UnSelectedImagePath = "MusicIcon/love.png",
- SelectedImagePath = "MusicIcon/loveSelected.png",
- };
- musicViewFl.AddChidren(loveIcon);
- loveIcon.MouseUpEventHandler += (sender, e) =>
- {
- loveIcon.IsSelected = !loveIcon.IsSelected;
- if (loveIcon.IsSelected)
+ songView.loveIcon.IsSelected = !songView.loveIcon.IsSelected;
+ if (songView.loveIcon.IsSelected)
{
///鏌ユ壘闊充箰鏄惁瀛樺湪鍦ㄥ垪琛�
var music1 = A31MusicModel.Current.LoveMusicInfoList.Find((m) => m.URL == songs.URL);
@@ -178,15 +79,7 @@
}
A31MusicModel.Save();
};
- var music = A31MusicModel.Current.LoveMusicInfoList.Find((m) => m.URL == songs.URL);
- if (music != null)
- {
- loveIcon.IsSelected = true;
- }
- else
- {
- loveIcon.IsSelected = false;
- }
+
///鍒犻櫎鎺т欢
var delBtn = new Button
{
@@ -195,38 +88,20 @@
TextColor = Color.WhiteColor,
TextSize = TextSize.Text16,
};
- musicViewFl.AddRightView(delBtn);
+ songView.musicViewFl.AddRightView(delBtn);
delBtn.MouseUpEventHandler += (sender, e) =>
{
fileListInfo.MusicInfoList.Remove(songs);
A31MusicModel.Save();
- musicViewFl.RemoveFromParent();
+ songView.musicViewFl.RemoveFromParent();
};
//娣诲姞鍒版垜鐨勫垪琛�
- Button addIcon = new Button
- {
- X = Application.GetRealWidth(335),
- Y = Application.GetRealHeight(8),
- Width = Application.GetMinRealAverage(28),
- Height = Application.GetMinRealAverage(28),
- UnSelectedImagePath = "MusicIcon/addMusic1.png",
- };
- musicViewFl.AddChidren(addIcon);
- addIcon.MouseUpEventHandler = (sender, e) =>
+ songView.addIcon.MouseUpEventHandler = (sender, e) =>
{
new View.DialogView { }.FieListView(songs);
};
-
- //鐐瑰嚮鎺т欢
- Button clickBtn = new Button
- {
- Width = Application.GetRealWidth(280),
- Height = Application.GetRealHeight(44),
- Tag = songs,//鏍囪鎾斁鍝竴棣栨瓕鏇�
- };
- musicViewFl.AddChidren(clickBtn);
///鐐瑰嚮鎾斁浜嬩欢
- clickBtn.MouseUpEventHandler += (sender, e) =>
+ songView.clickBtn.MouseUpEventHandler += (sender, e) =>
{
System.Threading.Tasks.Task.Run(() =>
@@ -235,11 +110,12 @@
Application.RunOnMainThread(() =>
{
//绉婚櫎鐣岄潰
- A31MusicModel.Current.A31PlayStatus.Title = songBtn.Text;
+
+ A31MusicModel.Current.A31PlayStatus.Title = songView.songBtn.Text;
MainPage.BasePageView.RemoveViewByTag("Music");
System.Threading.Tasks.Task.Run(() =>
{
- PushList(songs, fileListInfo.ListName, fileListInfo.MusicInfoList);
+ SendMethod.PushList(songs, fileListInfo.ListName, fileListInfo.MusicInfoList,A31MusicModel.Current);
});
});
});
@@ -251,208 +127,12 @@
/// <summary>
/// 瀹氭椂鏇存柊褰撳墠鎾斁闊充箰
/// </summary>
- System.Threading.Thread updateSelectedMusicThread;
public void UpdateSelectedMusic()
{
- updateSelectedMusicThread = new System.Threading.Thread(() =>
- {
- while (this.Parent != null)
- {
- System.Threading.Thread.Sleep(1000);
- Application.RunOnMainThread(() =>
- {
- try
- {
- for (int i = 0; i < middViewLayout.ChildrenCount; i++)
- {
- RowLayout view = (RowLayout)middViewLayout.GetChildren(i);
- var volIconBtn = (Button)view.GetChildren(0);//鐩存帴RowLayout鐖舵帶浠舵壘鍒拌鎺т欢Button
- var songNameBtn = (Button)view.GetChildren(1);//鐩存帴RowLayout鐖舵帶浠舵壘鍒拌鎺т欢Button
- var artistNameBtn = (Button)view.GetChildren(2);//鐩存帴RowLayout鐖舵帶浠舵壘鍒拌鎺т欢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 { }
-
- });
- }
- });
- updateSelectedMusicThread.Start();
+ UI2.FuntionControlView.Music.UpdateThread.updateThread(this, middViewLayout, A31MusicModel.Current);
}
- /// <summary>
- /// 鎺ㄩ�佹挱鏀惧懡浠�
- /// </summary>
- /// <param name="musicInfo">鎾斁闊充箰</param>
- /// <param name="listName">鍒楄〃鍚嶇О</param>
- /// <param name="musicList">鎺ㄩ�佸垪琛�(榛樿鎺�50棣�)</param>
- public void PushList(MusicInfo musicInfo, string listName, List<MusicInfo> musicList)
- {
-
- //鏈�澶у彂閫佺殑鏉℃暟
- int maxCount = 50;
- //鎵惧嚭褰撳墠鐐瑰嚮闊充箰鐨勭储寮�
- int statIndex = musicList.FindIndex((obj) => { return obj == musicInfo; });
- //鐐瑰嚮鍚庨潰杩樻湁澶氬皯鏉¢煶涔�
- int count = musicList.Count - statIndex;
- int endIndex = 0;
- if (maxCount < count)
- {
- //濡傛灉鍚庨潰鐨勯煶涔愬ぇ浜庢渶澶ф暟锛岃缃悗闈㈡暟鎹殑鏈�澶х储寮�
- endIndex = statIndex + maxCount - 1;
- }
- else
- {
- //濡傛灉鍚庨潰鏁版嵁涓嶅锛屽氨鐢ㄦ�绘暟鍑忓幓鏈�澶ф潯鏁帮紝寰楀埌寮�濮嬬储寮�
- statIndex = musicList.Count - maxCount - 1;
- endIndex = musicList.Count - 1;
- }
- //濡傛灉寮�濮嬬储寮曞皬浜�0锛岄偅灏辫缃负绗竴鏉¢煶涔�
- if (statIndex < 0)
- {
- statIndex = 0;
- }
-
- StringBuilder sb = new StringBuilder();
- sb.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
- sb.AppendLine("<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">");
- sb.AppendLine("<s:Body>");
- sb.AppendLine("<u:CreateQueue xmlns:u=\"urn:schemas-wiimu-com:service:PlayQueue:1\">");
- sb.AppendLine("<QueueContext><?xml version=\"1.0\"?>");
- sb.AppendLine("<PlayList>");
- sb.AppendLine("<ListName>DLNA" + listName + "</ListName>");
- sb.AppendLine("<ListInfo>");
- sb.AppendLine("<Radio>0</Radio>");//
- sb.AppendLine("<SourceName>UPnPServer</SourceName>");//
- sb.AppendLine("<MarkSearch>0</MarkSearch>");
- sb.AppendLine("<TrackNumber>" + (endIndex - statIndex + 1) + "</TrackNumber>");
- sb.AppendLine("<Quality>0</Quality>");
- sb.AppendLine("<UpdateTime>5367</UpdateTime>");
- sb.AppendLine("<LastPlayIndex>2</LastPlayIndex>");
- sb.AppendLine("<SwitchPageMode>0</SwitchPageMode>");
- sb.AppendLine("<CurrentPage>0</CurrentPage>");
- sb.AppendLine("<TotalPages>0</TotalPages>");
- sb.AppendLine("</ListInfo>");
- sb.AppendLine("<Tracks>");
-
- int number = 1;
-
- for (int i = statIndex, Tracknumber = 1; i <= endIndex; i++, Tracknumber++)
- {
- var tempMusicInfo = musicList[i];
-
- if (musicInfo == tempMusicInfo)
- {
- number = Tracknumber;
- }
-
- if (tempMusicInfo.SourceType == "Local")
- {
- tempMusicInfo.URL = "http://" + new NetWiFi().IpAddress + ":" + com.hdl.on.Server.Port + "/" + tempMusicInfo.ID;
- }
-
-
- sb.AppendLine("<Track" + Tracknumber + ">");
- sb.AppendLine("<URL>" + tempMusicInfo.URL + "</URL>");
- sb.AppendLine("<Metadata>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;");
- sb.AppendLine("&lt;DIDL-Lite xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns:song=&quot;www.wiimu.com/song/&quot; xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot;&gt;");
- sb.AppendLine("&lt;upnp:class&gt;object.item.audioItem.musicTrack&lt;/upnp:class&gt;");
- sb.AppendLine("&lt;item id=&quot;0&quot;&gt;");
- sb.AppendLine("&lt;song:subid&gt;&lt;/song:subid&gt;");
- sb.AppendLine("&lt;song:description&gt;unknown&lt;/song:description&gt;");
- sb.AppendLine("&lt;song:skiplimit&gt;6&lt;/song:skiplimit&gt;");
- sb.AppendLine("&lt;song:id&gt;" + tempMusicInfo.ID + "&lt;/song:id&gt;");
- sb.AppendLine("&lt;song:like&gt;0&lt;/song:like&gt;");
- sb.AppendLine("&lt;song:singerid&gt;0&lt;/song:singerid&gt;");
- sb.AppendLine("&lt;song:albumid&gt;" + tempMusicInfo.AlbumId + "&lt;/song:albumid&gt;");
-
- sb.AppendLine("&lt;res protocolInfo=&quot;http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;&quot; duration=&quot;" + "0:0:0.0" + "&quot;&gt;" + tempMusicInfo.URL + "&lt;/res&gt;");
-
- sb.AppendLine("&lt;dc:title&gt;" + tempMusicInfo.Title + "&lt;/dc:title&gt;");
- sb.AppendLine("&lt;dc:creator&gt;DJ Sanny J&lt;/dc:creator&gt;");
- sb.AppendLine("&lt;upnp:artist&gt;" + listName + "&lt;/upnp:artist&gt;");
- sb.AppendLine("&lt;upnp:album&gt;" + tempMusicInfo.Album + "&lt;/upnp:album&gt;");
- sb.AppendLine("&lt;upnp:albumArtURI&gt;unknown&lt;/upnp:albumArtURI&gt;");
- sb.AppendLine("&lt;/item&gt;");
- sb.AppendLine("&lt;/DIDL-Lite&gt;");
- sb.AppendLine("</Metadata>");
- sb.AppendLine("<Id>" + tempMusicInfo.ID + "</Id>");
- sb.AppendLine("<Source>STATION-NETWORK</Source>");//UPnPServer
- sb.AppendLine("<Key>" + tempMusicInfo.URL + "</Key>");
- sb.AppendLine("</Track" + Tracknumber + ">");
- }
- sb.AppendLine("</Tracks>");
- sb.AppendLine("</PlayList>");
- sb.AppendLine("</QueueContext>");
- sb.AppendLine("</u:CreateQueue>");
- sb.AppendLine("</s:Body>");
- sb.AppendLine("</s:Envelope>");
-
- SendMusicLists(A31MusicModel.Current.IPAddress, A31MusicModel.Current.Port, "CreateQueue", sb.ToString());
-
- StringBuilder playString = new StringBuilder();
- playString.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
- playString.AppendLine("<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">");
- playString.AppendLine("<s:Body>");
- playString.AppendLine("<u:PlayQueueWithIndex xmlns:u=\"urn:schemas-wiimu-com:service:PlayQueue:1\">");
- playString.AppendLine("<QueueName>DLNA" + listName + "</QueueName>");
- playString.AppendLine("<Index>" + number + "</Index>");
- playString.AppendLine("</u:PlayQueueWithIndex>");
- playString.AppendLine("</s:Body>");
- playString.AppendLine("</s:Envelope>");
-
- Play(A31MusicModel.Current.IPAddress, A31MusicModel.Current.Port, playString.ToString());
- }
-
- void SendMusicLists(string ip, int port, string soapAction, string listInfo)
- {
- System.Net.WebClient webClient = new System.Net.WebClient();
- webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#" + soapAction + "\"");
- webClient.Headers.Add("CONTENT-TYPE", "text/xml; charset=\"utf-8\"");
- try
- {
- byte[] recevieBytes = webClient.UploadData(new Uri("http://" + ip + ":" + port + "/upnp/control/PlayQueue1"), "POST", System.Text.Encoding.UTF8.GetBytes(listInfo));
- var s = System.Text.Encoding.UTF8.GetString(recevieBytes, 0, recevieBytes.Length);
- }
- catch
- {
-
- }
- }
-
- void Play(string ip, int port, string info)
- {
- System.Net.WebClient webClient = new System.Net.WebClient();
- webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#PlayQueueWithIndex\"");
- webClient.Headers.Add("CONTENT-TYPE", "text/xml; charset=\"utf-8\"");
- try
- {
- byte[] recevieBytes = webClient.UploadData(new Uri("http://" + ip + ":" + port + "/upnp/control/PlayQueue1"), "POST", System.Text.Encoding.UTF8.GetBytes(info));
- var s = System.Text.Encoding.UTF8.GetString(recevieBytes, 0, recevieBytes.Length);
- }
- catch
- {
-
- }
- }
-
+
}
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31USBMusicList.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31USBMusicList.cs
index afca128..1fe9556 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31USBMusicList.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31USBMusicList.cs
@@ -24,19 +24,6 @@
topView.topNameBtn.TextID = StringId.usb;
topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
{
-
- if (updateSelectedMusicThread != null)
- {
- try
- {
- if (updateSelectedMusicThread.IsAlive)
- {
- updateSelectedMusicThread.Abort();
- ///鍏抽棴绾跨▼
- }
- }
- catch { }
- }
this.RemoveFromParent();
};
middViewLayout = new VerticalRefreshLayout
@@ -86,97 +73,13 @@
{
number++;
var songs = A31MusicModel.Current.USBList[i];
- if (string.IsNullOrEmpty(songs.Title))
+ View.SongView songView = new View.SongView();
+ songView.SongFrameLayout(middViewLayout, songs);
+ // 娣诲姞鍠滅埍闊充箰鎺т欢
+ songView.loveIcon.MouseUpEventHandler += (sender, e) =>
{
- //闃叉姝屾洸鍚嶅瓧涓虹┖鎶涘紓甯�
- songs.Title = " ";
- }
- if (string.IsNullOrEmpty(songs.Artist))
- {
- //闃叉姝屾墜鍚嶅瓧涓虹┖鎶涘紓甯�
- songs.Artist = " ";
- }
- FrameLayout musicViewFl = new FrameLayout
- {
- Width = Application.GetRealWidth(375),
- Height = Application.GetRealHeight(44),
- };
- middViewLayout.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 loveIcon = new Button
- {
- X = Application.GetRealWidth(291),
- Y = Application.GetRealHeight(8),
- Width = Application.GetMinRealAverage(28),
- Height = Application.GetMinRealAverage(28),
- UnSelectedImagePath = "MusicIcon/love.png",
- SelectedImagePath = "MusicIcon/loveSelected.png",
- };
- musicViewFl.AddChidren(loveIcon);
- loveIcon.MouseUpEventHandler += (sender, e) =>
- {
- loveIcon.IsSelected = !loveIcon.IsSelected;
- if (loveIcon.IsSelected)
+ songView.loveIcon.IsSelected = !songView.loveIcon.IsSelected;
+ if (songView.loveIcon.IsSelected)
{
///鏌ユ壘闊充箰鏄惁瀛樺湪鍦ㄥ垪琛�
var music1 = A31MusicModel.Current.LoveMusicInfoList.Find((m) => m.URL == songs.URL);
@@ -199,41 +102,14 @@
}
A31MusicModel.Save();
};
- var music = A31MusicModel.Current.LoveMusicInfoList.Find((m) => m.URL == songs.URL);
- if (music != null)
- {
- loveIcon.IsSelected = true;
- }
- else
- {
- loveIcon.IsSelected = false;
- }
-
//娣诲姞鍒版垜鐨勫垪琛�
- Button addIcon = new Button
- {
- X = Application.GetRealWidth(335),
- Y = Application.GetRealHeight(8),
- Width = Application.GetMinRealAverage(28),
- Height = Application.GetMinRealAverage(28),
- UnSelectedImagePath = "MusicIcon/addMusic1.png",
- };
- musicViewFl.AddChidren(addIcon);
- addIcon.MouseUpEventHandler = (sender, e) =>
+ songView.addIcon.MouseUpEventHandler = (sender, e) =>
{
new View.DialogView { }.FieListView(songs);
};
-
- //鐐瑰嚮鎺т欢
- Button clickBtn = new Button
- {
- Width = Application.GetRealWidth(280),
- Height = Application.GetRealHeight(44),
- Tag = number,//鏍囪鎾斁鍝竴棣栨瓕鏇�
- };
- musicViewFl.AddChidren(clickBtn);
+ songView.clickBtn.Tag = number;//鏍囪鎾斁鍝竴棣栨瓕鏇�
///鐐瑰嚮鎾斁浜嬩欢
- clickBtn.MouseUpEventHandler += (sender, e) =>
+ songView.clickBtn.MouseUpEventHandler += (sender, e) =>
{
System.Threading.Tasks.Task.Run(() =>
@@ -242,11 +118,11 @@
Application.RunOnMainThread(() =>
{
//绉婚櫎鐣岄潰
- A31MusicModel.Current.A31PlayStatus.Title = songBtn.Text;
+ A31MusicModel.Current.A31PlayStatus.Title = songView.songBtn.Text;
MainPage.BasePageView.RemoveViewByTag("Music");
System.Threading.Tasks.Task.Run(() =>
{
- SendMethod.ListMusicPlay("USBDiskQueue", clickBtn.Tag,A31MusicModel.Current);
+ SendMethod.ListMusicPlay("USBDiskQueue", songView.clickBtn.Tag, A31MusicModel.Current);
});
});
});
@@ -258,85 +134,9 @@
/// <summary>
/// 瀹氭椂鏇存柊褰撳墠鎾斁闊充箰
/// </summary>
- System.Threading.Thread updateSelectedMusicThread;
public void UpdateSelectedMusic()
{
- updateSelectedMusicThread = new System.Threading.Thread(() =>
- {
- while (this.Parent != null)
- {
- System.Threading.Thread.Sleep(1000);
- 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 { }
-
- });
- }
- });
- updateSelectedMusicThread.Start();
- }
- /// <summary>
- /// 鏁版嵁灏佽
- /// </summary>
- /// <param name="tag"></param>
- void PlayStrinfg(object tag)
- {
- System.Text.StringBuilder sb = new System.Text.StringBuilder();
- sb.AppendLine("<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">");
- sb.AppendLine("<s:Body>");
- sb.AppendLine("<u:PlayQueueWithIndex xmlns:u=\"urn:schemas-wiimu-com:service:PlayQueue:1\">");
- sb.AppendLine("<QueueName>USBDiskQueue</QueueName>");
- sb.AppendLine("<Index>" + tag + "</Index>");
- sb.AppendLine("</u:PlayQueueWithIndex>");
- sb.AppendLine("</s:Body>");
- sb.AppendLine("</s:Envelope>");
-
- Paly(sb.ToString());
- }
- /// <summary>
- /// 鎾斁鍛戒护
- /// </summary>
- /// <param name="s"></param>
- void Paly(string s)
- {
-
- System.Net.WebClient webClient = new System.Net.WebClient();
- webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#PlayQueueWithIndex\"");
- webClient.Headers.Add("CONTENT-TYPE", "text/xml;charset=\"utf-8\"");
- try
- {
- byte[] bytes = webClient.UploadData(new Uri("http://" + A31MusicModel.Current.IPAddress + ":" + A31MusicModel.Current.Port + "/upnp/control/PlayQueue1"), "POST", System.Text.Encoding.UTF8.GetBytes(s));
- var ab = System.Text.Encoding.UTF8.GetString(bytes, 0, bytes.Length);
- }
- catch { }
+ UI2.FuntionControlView.Music.UpdateThread.updateThread(this, middViewLayout, A31MusicModel.Current);
}
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs
index 694e814..54764d1 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs
@@ -619,7 +619,7 @@
return null;
}
/// <summary>
- /// 鎾斁闊充箰鍛戒护
+ /// 鎾斁USB闊充箰鍛戒护
/// </summary>
/// <param name="listName">鍒楄〃鍚嶇О</param>
/// <param name="number">鎾斁绱㈠紩</param>
@@ -646,6 +646,166 @@
catch { }
}
+
+
+ /// <summary>
+ /// 鎺ㄩ�佹挱鏀惧懡浠�
+ /// </summary>
+ /// <param name="musicInfo">鎾斁闊充箰</param>
+ /// <param name="listName">鍒楄〃鍚嶇О</param>
+ /// <param name="musicList">鎺ㄩ�佸垪琛�(榛樿鎺�50棣�)</param>
+ public static void PushList(MusicInfo musicInfo, string listName, List<MusicInfo> musicList, A31MusicModel a31player)
+ {
+
+ //鏈�澶у彂閫佺殑鏉℃暟
+ int maxCount = 50;
+ //鎵惧嚭褰撳墠鐐瑰嚮闊充箰鐨勭储寮�
+ int statIndex = musicList.FindIndex((obj) => { return obj == musicInfo; });
+ //鐐瑰嚮鍚庨潰杩樻湁澶氬皯鏉¢煶涔�
+ int count = musicList.Count - statIndex;
+ int endIndex = 0;
+ if (maxCount < count)
+ {
+ //濡傛灉鍚庨潰鐨勯煶涔愬ぇ浜庢渶澶ф暟锛岃缃悗闈㈡暟鎹殑鏈�澶х储寮�
+ endIndex = statIndex + maxCount - 1;
+ }
+ else
+ {
+ //濡傛灉鍚庨潰鏁版嵁涓嶅锛屽氨鐢ㄦ�绘暟鍑忓幓鏈�澶ф潯鏁帮紝寰楀埌寮�濮嬬储寮�
+ statIndex = musicList.Count - maxCount - 1;
+ endIndex = musicList.Count - 1;
+ }
+ //濡傛灉寮�濮嬬储寮曞皬浜�0锛岄偅灏辫缃负绗竴鏉¢煶涔�
+ if (statIndex < 0)
+ {
+ statIndex = 0;
+ }
+
+ StringBuilder sb = new StringBuilder();
+ sb.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
+ sb.AppendLine("<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">");
+ sb.AppendLine("<s:Body>");
+ sb.AppendLine("<u:CreateQueue xmlns:u=\"urn:schemas-wiimu-com:service:PlayQueue:1\">");
+ sb.AppendLine("<QueueContext><?xml version=\"1.0\"?>");
+ sb.AppendLine("<PlayList>");
+ sb.AppendLine("<ListName>DLNA" + listName + "</ListName>");
+ sb.AppendLine("<ListInfo>");
+ sb.AppendLine("<Radio>0</Radio>");//
+ sb.AppendLine("<SourceName>UPnPServer</SourceName>");//
+ sb.AppendLine("<MarkSearch>0</MarkSearch>");
+ sb.AppendLine("<TrackNumber>" + (endIndex - statIndex + 1) + "</TrackNumber>");
+ sb.AppendLine("<Quality>0</Quality>");
+ sb.AppendLine("<UpdateTime>5367</UpdateTime>");
+ sb.AppendLine("<LastPlayIndex>2</LastPlayIndex>");
+ sb.AppendLine("<SwitchPageMode>0</SwitchPageMode>");
+ sb.AppendLine("<CurrentPage>0</CurrentPage>");
+ sb.AppendLine("<TotalPages>0</TotalPages>");
+ sb.AppendLine("</ListInfo>");
+ sb.AppendLine("<Tracks>");
+
+ int number = 1;
+
+ for (int i = statIndex, Tracknumber = 1; i <= endIndex; i++, Tracknumber++)
+ {
+ var tempMusicInfo = musicList[i];
+
+ if (musicInfo == tempMusicInfo)
+ {
+ number = Tracknumber;
+ }
+
+ if (tempMusicInfo.SourceType == "Local")
+ {
+ tempMusicInfo.URL = "http://" + new Shared.Net.NetWiFi().IpAddress + ":" + com.hdl.on.Server.Port + "/" + tempMusicInfo.ID;
+ }
+
+
+ sb.AppendLine("<Track" + Tracknumber + ">");
+ sb.AppendLine("<URL>" + tempMusicInfo.URL + "</URL>");
+ sb.AppendLine("<Metadata>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;");
+ sb.AppendLine("&lt;DIDL-Lite xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns:song=&quot;www.wiimu.com/song/&quot; xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot;&gt;");
+ sb.AppendLine("&lt;upnp:class&gt;object.item.audioItem.musicTrack&lt;/upnp:class&gt;");
+ sb.AppendLine("&lt;item id=&quot;0&quot;&gt;");
+ sb.AppendLine("&lt;song:subid&gt;&lt;/song:subid&gt;");
+ sb.AppendLine("&lt;song:description&gt;unknown&lt;/song:description&gt;");
+ sb.AppendLine("&lt;song:skiplimit&gt;6&lt;/song:skiplimit&gt;");
+ sb.AppendLine("&lt;song:id&gt;" + tempMusicInfo.ID + "&lt;/song:id&gt;");
+ sb.AppendLine("&lt;song:like&gt;0&lt;/song:like&gt;");
+ sb.AppendLine("&lt;song:singerid&gt;0&lt;/song:singerid&gt;");
+ sb.AppendLine("&lt;song:albumid&gt;" + tempMusicInfo.AlbumId + "&lt;/song:albumid&gt;");
+
+ sb.AppendLine("&lt;res protocolInfo=&quot;http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;&quot; duration=&quot;" + "0:0:0.0" + "&quot;&gt;" + tempMusicInfo.URL + "&lt;/res&gt;");
+
+ sb.AppendLine("&lt;dc:title&gt;" + tempMusicInfo.Title + "&lt;/dc:title&gt;");
+ sb.AppendLine("&lt;dc:creator&gt;DJ Sanny J&lt;/dc:creator&gt;");
+ sb.AppendLine("&lt;upnp:artist&gt;" + tempMusicInfo.Artist + "&lt;/upnp:artist&gt;");
+ sb.AppendLine("&lt;upnp:album&gt;" + tempMusicInfo.Album + "&lt;/upnp:album&gt;");
+ sb.AppendLine("&lt;upnp:albumArtURI&gt;unknown&lt;/upnp:albumArtURI&gt;");
+ sb.AppendLine("&lt;/item&gt;");
+ sb.AppendLine("&lt;/DIDL-Lite&gt;");
+ sb.AppendLine("</Metadata>");
+ sb.AppendLine("<Id>" + tempMusicInfo.ID + "</Id>");
+ sb.AppendLine("<Source>STATION-NETWORK</Source>");//UPnPServer
+ sb.AppendLine("<Key>" + tempMusicInfo.URL + "</Key>");
+ sb.AppendLine("</Track" + Tracknumber + ">");
+ }
+ sb.AppendLine("</Tracks>");
+ sb.AppendLine("</PlayList>");
+ sb.AppendLine("</QueueContext>");
+ sb.AppendLine("</u:CreateQueue>");
+ sb.AppendLine("</s:Body>");
+ sb.AppendLine("</s:Envelope>");
+
+ SendMusicLists(a31player.IPAddress, a31player.Port, "CreateQueue", sb.ToString());
+
+ StringBuilder playString = new StringBuilder();
+ playString.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
+ playString.AppendLine("<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">");
+ playString.AppendLine("<s:Body>");
+ playString.AppendLine("<u:PlayQueueWithIndex xmlns:u=\"urn:schemas-wiimu-com:service:PlayQueue:1\">");
+ playString.AppendLine("<QueueName>DLNA" + listName + "</QueueName>");
+ playString.AppendLine("<Index>" + number + "</Index>");
+ playString.AppendLine("</u:PlayQueueWithIndex>");
+ playString.AppendLine("</s:Body>");
+ playString.AppendLine("</s:Envelope>");
+
+ Play(a31player.IPAddress, a31player.Port, playString.ToString());
+ }
+
+ static void SendMusicLists(string ip, int port, string soapAction, string listInfo)
+ {
+ System.Net.WebClient webClient = new System.Net.WebClient();
+ webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#" + soapAction + "\"");
+ webClient.Headers.Add("CONTENT-TYPE", "text/xml; charset=\"utf-8\"");
+ try
+ {
+ byte[] recevieBytes = webClient.UploadData(new Uri("http://" + ip + ":" + port + "/upnp/control/PlayQueue1"), "POST", System.Text.Encoding.UTF8.GetBytes(listInfo));
+ var s = System.Text.Encoding.UTF8.GetString(recevieBytes, 0, recevieBytes.Length);
+ }
+ catch
+ {
+
+ }
+ }
+
+ static void Play(string ip, int port, string info)
+ {
+ System.Net.WebClient webClient = new System.Net.WebClient();
+ webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#PlayQueueWithIndex\"");
+ webClient.Headers.Add("CONTENT-TYPE", "text/xml; charset=\"utf-8\"");
+ try
+ {
+ byte[] recevieBytes = webClient.UploadData(new Uri("http://" + ip + ":" + port + "/upnp/control/PlayQueue1"), "POST", System.Text.Encoding.UTF8.GetBytes(info));
+ var s = System.Text.Encoding.UTF8.GetString(recevieBytes, 0, recevieBytes.Length);
+ }
+ catch
+ {
+
+ }
+ }
+
+
+
static System.Threading.Thread thread;
/// <summary>
/// 淇敼钃濈墮鍚嶇О
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/UpdateThread.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/UpdateThread.cs
index 2fbe648..8b9cd91 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/UpdateThread.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/UpdateThread.cs
@@ -1,16 +1,21 @@
锘縰sing System;
+using System.Collections.Generic;
using Shared;
using HDL_ON.UI.Music;
-
namespace HDL_ON.UI.UI2.FuntionControlView.Music
{
- public class UpdateThread : FrameLayout
+ public class UpdateThread
{
public UpdateThread()
{
}
-
- public static void updateThread(FrameLayout frame, VerticalRefreshLayout middViewLayout)
+ /// <summary>
+ /// 瀹氭椂鏇存柊褰撳墠鎾斁闊充箰
+ /// </summary>
+ /// <param name="frame">褰撳墠鐣岄潰</param>
+ /// <param name="middViewLayout">姣忎竴鏉¢煶涔愮殑涓绘帶浠�</param>
+ /// <param name="a31MusicModel">鐐瑰墠鎾斁鍣�</param>
+ public static void updateThread(FrameLayout frame, VerticalRefreshLayout middViewLayout, A31MusicModel a31MusicModel)
{
System.Threading.Thread updateSelectedMusicThread = new System.Threading.Thread(() =>
{
@@ -23,11 +28,11 @@
{
for (int i = 0; i < middViewLayout.ChildrenCount; i++)
{
- FrameLayout view = (FrameLayout)middViewLayout.GetChildren(i);
+ RowLayout view = (RowLayout)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())
+ if (a31MusicModel.A31PlayStatus.TrackURL == songNameBtn.Tag.ToString())
{
volIconBtn.Visible = true;
songNameBtn.TextColor = UI.Music.Color.SelectedColor;
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs
index 253b383..9f8854c 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs
@@ -575,20 +575,20 @@
addFlieRow.AddChidren(songNameBtn);
var wText = songNameBtn.GetTextWidth();//鑾峰彇鏂囨湰瀹藉害
- if (wText > 280)
+ if (wText >Application.GetRealWidth(220))
{
- songNameBtn.Width = Application.GetRealWidth(280);
+ songNameBtn.Width = Application.GetRealWidth(220);
}
else
{
- songNameBtn.Width = wText + 5;
+ songNameBtn.Width = wText + Application.GetRealWidth(15);
}
//姝屾墜鎺т欢
Button singerBtn = new Button
{
X = songNameBtn.Right,
Y = Application.GetRealHeight(15),
- Width = Application.GetRealWidth(280 - songNameBtn.Width),
+ Width = Application.GetRealWidth(220)- wText,
Height = Application.GetRealHeight(20),
TextColor = Color.MusicNoTxetColor,
TextSize = TextSize.Text12,
@@ -596,11 +596,6 @@
Text = "-" + player.A31PlayStatus.Artist.Trim(),
};
addFlieRow.AddChidren(singerBtn);
- if (wText > 280)
- {
- ///姝屽悕闀垮害灏忎簬250鎵嶅彲浠ユ樉绀烘瓕鎵嬪嚭鏉�
- singerBtn.Width = Application.GetRealWidth(0);
- }
}
else
{
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/View/SongView.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/View/SongView.cs
index f0174dd..8c088e6 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/View/SongView.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/View/SongView.cs
@@ -7,10 +7,11 @@
/// <summary>
/// 鐖舵帶浠�
/// </summary>
- public FrameLayout musicViewFl = new FrameLayout
+ public RowLayout musicViewFl = new RowLayout
{
Width = Application.GetRealWidth(375),
Height = Application.GetRealHeight(44),
+ LineColor= Color.WhiteColor,
};
/// <summary>
--
Gitblit v1.8.0