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/MusicMain.cs | 139 +++++++++++++++++++++++++++++++++++----------
1 files changed, 107 insertions(+), 32 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs
index bd49772..01c7106 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs
@@ -8,21 +8,31 @@
public class MusicMain : FrameLayout
{
- //FrameLayout Frame = null;
- //public MusicListViewMain() {
- // Frame = this;
- //}
+ /// <summary>
+ /// MusicMain瀵硅薄鏋勯�犲嚱鏁�
+ /// </summary>
public MusicMain()
{
Tag = "MusicMain";
+ //杩涙潵闊充箰鍒楄〃鐣岄潰鍏堢Щ闄や箣鍓嶇嚎绋�;
+ A31MusicModel.RemoveListThread();
}
+ /// <summary>
+ /// 閲嶅啓RemoveFromParent鏂规硶
+ /// </summary>
public override void RemoveFromParent()
{
base.RemoveFromParent();
clearA31Threads();
+ A31MusicModel.ReadMusicStates();//杩涙潵娌℃湁闊充箰琚敹钘忚繃锛岄��鍑烘湁闊充箰琚敹钘忚繃
}
+ /// <summary>
+ /// 鍒涘缓绾跨▼鍒楄〃
+ /// </summary>
static List<System.Threading.Thread> threadLists = new List<System.Threading.Thread>();
-
+ /// <summary>
+ /// 绉婚櫎绾跨▼
+ /// </summary>
static void clearA31Threads()
{
var threads = threadLists.FindAll((obj) => { return obj.Name == "A31"; });
@@ -33,25 +43,29 @@
threadLists.Remove(thread);
if (thread.IsAlive)
{
+ ///寮哄埗绾跨▼鎶涘紓甯�
thread.Abort();
}
}
catch (Exception e)
{
- System.Console.WriteLine(e.Message);
+ MainPage.Log("clearA31Threads error : " + e.Message);
}
}
}
/// <summary>
/// 鏄剧ず鍔犺浇鐣岄潰
/// </summary>
- public static Loading loading = new Loading();
+ public static Loading loading = new Loading();
+ /// <summary>
+ /// 瀹氫箟鍏ㄥ眬瀵硅薄
+ /// </summary>
VerticalRefreshLayout verticalRefresh;
-
public void Show()
{
- #region 鐣岄潰甯冨眬
- this.BackgroundColor = Color.ViewColor;
+
+ #region 鐣岄潰甯冨眬
+ this.BackgroundColor = MusicColor.ViewColor;
var topView = new TopView();
this.AddChidren(topView.TopFLayoutView());
topView.topNameBtn.TextID =StringId.a31Music;
@@ -126,11 +140,14 @@
a31MusicModel.IsOnLine = true;
}
}
- catch (Exception e) { System.Console.WriteLine(e.Message); }
+ catch (Exception e) { MainPage.Log(e.Message); }
});
}
}
-
+ /// <summary>
+ /// 鍒锋柊鎾斁鍣ㄥ垪琛�
+ /// </summary>
+ /// <param name="Yes">鏄惁鏄剧ず鍒锋柊鍥炬爣</param>
void SeachMusic(bool Yes = false)
{
for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
@@ -181,6 +198,7 @@
}
MusicListView(a31player);
}
+ //A31MusicModel.ReadMusicStates();
});
return;
@@ -191,6 +209,7 @@
//涓嶆槸鎴戜滑鏀寔鐨勫搧鐗屼笉鏀寔
if (obj.Name != null)
{
+ obj.sid = "030101123456780909020123AABB" + obj.UniqueDeviceName;
A31MusicModel.A31MusicModelList.Add(obj);
}
}
@@ -210,22 +229,49 @@
/// </summary>
void MusicListView(A31MusicModel a31player)
{
-
-
MusicView musicView = new MusicView();
musicView.View(verticalRefresh);
musicView.singerBtn.Text = a31player.A31PlayStatus.Artist;
musicView.songNameBtn.Text = a31player.A31PlayStatus.Title;
musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(a31player);
- musicView.regionBtn.TextID = StringId.region;
- if (a31player.IsEnd) {
- musicView.muiscFl.Height =Application.GetRealHeight(12 + 139 + 12);
+ if (a31player.IsEnd)
+ {
+ musicView.muiscFl.Height = Application.GetRealHeight(12 + 139 + 12);
}
+
+ musicView.collectIconBtn.MouseUpEventHandler += (sender, e) =>
+ {
+ musicView.collectIconBtn.IsSelected = !musicView.collectIconBtn.IsSelected;
+ if (a31player.ServerClientType == 1)
+ {
+ if (musicView.collectIconBtn.IsSelected)
+ {
+ a31player.MainPlayCollection = true;
+ }
+ else
+ {
+ a31player.MainPlayCollection = false;
+ }
+ }
+ else
+ {
+ if (musicView.collectIconBtn.IsSelected)
+ {
+ a31player.collect = true;
+ }
+ else
+ {
+ a31player.collect = false;
+ }
+ }
+ A31MusicModel.Save();
+ };
+
EventHandler<MouseEventArgs> clickMergence = (sender, e) =>
{
if (a31player.ServerClientType == 0)
{
- new View.DialogView { }.PlayMergence();
+ new View.DialogView { }.PlayMergence(a31player);
}
else if (a31player.ServerClientType == 1)
{
@@ -237,15 +283,21 @@
musicView.mergeBtn.MouseUpEventHandler += clickMergence;
musicView.mergeIconBtn.MouseUpEventHandler += clickMergence;
-
- musicView.clickBtn.MouseUpEventHandler += (sender, e) =>
- {
- A31MusicModel.Current = a31player;//褰撳墠鎾斁鍣�
+ EventHandler<MouseEventArgs> clickPlayView = (sender, e) =>
+ {
+ A31MusicModel.Current = a31player;//褰撳墠鎾斁鍣�
var a31PlayMusicPage = new A31PlayMusicPage();
- MainPage.BasePageView.AddChidren(a31PlayMusicPage);
- a31PlayMusicPage.Show();
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
- };
+ MainPage.BasePageView.AddChidren(a31PlayMusicPage);
+ a31PlayMusicPage.Show();
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ };
+ musicView.musicIfonFl.MouseUpEventHandler += clickPlayView;
+ musicView.clickBtn.MouseUpEventHandler += clickPlayView;//
+ musicView.singerBtn.MouseUpEventHandler += clickPlayView;
+ musicView.songNameBtn.MouseUpEventHandler += clickPlayView;//
+ musicView.musicNameBtn.MouseUpEventHandler += clickPlayView;
+ musicView.regionBtn.MouseUpEventHandler += clickPlayView;//
+
///涓婁竴鏇茬偣鍑讳簨浠�
musicView.prevBtn.MouseDownEventHandler += (sender, e) =>
{
@@ -283,10 +335,8 @@
musicView.nextBtn.IsSelected = false;
};
- System.Threading.Tasks.Task.Run(() =>
+ var musicThread = new System.Threading.Thread(() =>
{
- System.Threading.Thread.CurrentThread.Name = "A31";
- threadLists.Add(System.Threading.Thread.CurrentThread);
while (true)
{
System.Threading.Thread.Sleep(1000);
@@ -308,12 +358,36 @@
{
musicView.playBtn.IsSelected = false;
}
+ musicView.regionBtn.Text = a31player.GetRoomListName();
+ if (a31player.ServerClientType == 1)
+ {
+ if (a31player.MainPlayCollection)
+ {
+ musicView.collectIconBtn.IsSelected = true;
+ }
+ else
+ {
+ musicView.collectIconBtn.IsSelected = false;
+ }
+ }
+ else
+ {
+ if (a31player.collect)
+ {
+ musicView.collectIconBtn.IsSelected = true;
+ }
+ else
+ {
+ musicView.collectIconBtn.IsSelected = false;
+ }
+ }
});
}
- });
-
+ })
+ { IsBackground = true, Name = "A31" };
+ musicThread.Start();
+ threadLists.Add(musicThread);
}
-
/// <summary>
/// 璇诲彇涓讳粠鍏崇郴
/// </summary>
@@ -371,6 +445,7 @@
{
A31MusicModel.A31MusicModelList.Add(new A31MusicModel
{
+ sid = "030101123456780909020123AABB" + slave.uuid.Replace("uuid:", ""),
ServerClientType = -1,//浠庣殑
IPAddress = slave.ip,
MainPlayIP = a31player.IPAddress,
--
Gitblit v1.8.0