| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using HDL_ON.Entity; |
| | | using Shared; |
| | | using HDL_ON.Entity; |
| | | |
| | | namespace HDL_ON.UI.Music |
| | | { |
| | |
| | | static A31MusicModel() |
| | | { |
| | | Refresh(); |
| | | //Type = DeviceType.A31MusicModel; |
| | | } |
| | | |
| | | static List<System.Threading.Thread> updataMusicStatesListThread = new List<System.Threading.Thread>(); |
| | | |
| | | /// <summary> |
| | | /// 读取音乐状态 |
| | | /// </summary> |
| | | public static void ReadMusicStates() |
| | | { |
| | | |
| | | var threads = updataMusicStatesListThread.FindAll((obj) => { return obj.Name == "A31"; }); |
| | | for (int i =0;i< updataMusicStatesListThread.Count;) |
| | | { |
| | | try |
| | | { |
| | | var thread = updataMusicStatesListThread[i]; |
| | | if (thread.IsAlive) |
| | | { |
| | | thread.Abort(); |
| | | } |
| | | updataMusicStatesListThread.Remove(thread); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | MainPage.Log("clearA31Threads error : " + e.Message); |
| | | } |
| | | finally |
| | | { |
| | | MainPage.Log("clearA31Threads over"); |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i < A31MusicModelList.Count; i++) |
| | | { |
| | | var a31player = A31MusicModelList[i]; |
| | | var musicThread = new System.Threading.Thread(() => |
| | | { |
| | | while (true) |
| | | { |
| | | System.Threading.Thread.Sleep(1000); |
| | | if (!a31player.IsOnLine) |
| | | { |
| | | continue; |
| | | } |
| | | //A31MusicModel.ReadMusicStates(); |
| | | SendMethod.ReadStatus(a31player); |
| | | } |
| | | }) |
| | | { IsBackground = true, Name = "A31" }; |
| | | musicThread.Start(); |
| | | updataMusicStatesListThread.Add(musicThread); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | ///保存当前音乐列表 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 音乐播放器名称 |
| | | /// </summary> |
| | | public string Name=string.Empty; |
| | | public string Name = string.Empty; |
| | | /// <summary> |
| | | /// 上一次更新的时间 |
| | | /// 记录数据反馈的时间(因为有时间网络差数据不回复,导致刷新当前播放音乐时间不正确) |
| | |
| | | /// <summary> |
| | | /// 是否是播放器列表最后一个(true) |
| | | /// </summary> |
| | | public bool IsEnd=false; |
| | | public bool IsEnd = false; |
| | | |
| | | public int A31DeviceType; |
| | | |
| | | //public string a31Source = "wifi"; |
| | | //public string a31Source = string.Empty; |
| | | /// <summary> |
| | | /// 音乐播放器ID |
| | | /// </summary> |
| | | public string UniqueDeviceName = string.Empty; |
| | | |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// usb列表 |
| | | /// </summary> |
| | | public List<MusicInfo> USBList= new List<MusicInfo>(); |
| | | public List<MusicInfo> USBList = new List<MusicInfo>(); |
| | | /// <summary> |
| | | /// Tidal喜爱列表 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | ///创建音乐文件列表 |
| | | /// </summary> |
| | | public List<FileListInfo> FileLists= new List<FileListInfo>(); |
| | | public List<FileListInfo> FileLists = new List<FileListInfo>(); |
| | | /// <summary> |
| | | /// 当前的A31音乐播放器 |
| | | /// </summary> |
| | | public static A31MusicModel Current; |
| | | |
| | | public int _ServerClientType; |
| | | /// <summary> |
| | | /// -1表示从的0表示默认1表示主的 |
| | | /// </summary> |
| | | public int ServerClientType; |
| | | public int ServerClientType |
| | | { |
| | | get |
| | | { |
| | | return _ServerClientType; |
| | | } |
| | | set |
| | | { |
| | | _ServerClientType = value; |
| | | if(value == 0) |
| | | { |
| | | name = Name; |
| | | } |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 记录主播放器IP |
| | | /// </summary> |
| | | public string MainPlayIP = string.Empty; |
| | | |
| | | public string _MainPlayName = string.Empty; |
| | | /// <summary> |
| | | /// 记录主播放器名称 |
| | | /// </summary> |
| | | public string MainPlayName = string.Empty; |
| | | public string MainPlayName |
| | | { |
| | | get |
| | | { |
| | | return _MainPlayName; |
| | | } |
| | | set |
| | | { |
| | | _MainPlayName = value; |
| | | if(ServerClientType == 1) |
| | | { |
| | | name = value; |
| | | } |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 记录主播放器是否被收藏 |
| | | /// </summary> |
| | | public bool MainPlayCollection = false; |
| | | |
| | | public Slaves Slave = new Slaves(); |
| | | |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | #region 组合属性 |
| | | |
| | | |
| | | #endregion |
| | | |
| | | } |
| | | [System.Serializable] |
| | |
| | | public string version = string.Empty; |
| | | public string uuid = string.Empty; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |