wjc
2022-08-25 7b96ea115d51fb721130fef8622500740dea7b08
HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs
@@ -12,16 +12,16 @@
{
    public class SendMethod
    {
        private static SendMethod sMethod = null;
        public static SendMethod mMethod
        private static SendMethod s_Current= null;
        public static SendMethod Current
        {
            get
            {
                if (sMethod == null)
                if (s_Current == null)
                {
                    sMethod = new SendMethod();
                    s_Current = new SendMethod();
                }
                return sMethod;
                return s_Current;
            }
        }
@@ -60,7 +60,7 @@
            {
                //RefreshDeviceStatus(functionIds);
                //a31Music.LastDateTime = DateTime.Now;
                ///从缓存里面查找音乐播放器对象<缓存数据收到推送过来的状态会更新缓存数据>
                ///从缓存里面查找音乐播放器对象<收到推送过来的状态会更新缓存数据>
                var allLocalFuntion = FunctionList.List.GetDeviceFunctionList();
                var localFunction = allLocalFuntion.Find((obj) => obj.sid == sid);
                if (localFunction == null)
@@ -152,6 +152,77 @@
            }
        }
        /// <summary>
        /// 获取列表名列表
        /// </summary>
        /// <param name="music"></param>
        /// <returns></returns>
        public List<GroupList> GetListName(Function music)
        {
            try
            {
                Dictionary<string, object> d = new Dictionary<string, object>();
                d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
                d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
                d.Add("deviceIds", new List<string> { music.deviceId });
                var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_GroupList);
                if (responsePackNew.Code != "0" || responsePackNew.Data == null || responsePackNew.Data.ToString() == "")
                {
                    return new List<GroupList>();
                }
                //数据返序列化为Function对象
                var str = Newtonsoft.Json.JsonConvert.SerializeObject(responsePackNew.Data);
                var groupLists = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupList>>(str);
                if (groupLists == null)
                {
                    groupLists = new List<GroupList>();
                }
                return groupLists;
            }
            catch
            {
                return new List<GroupList>();
            }
        }
        /// <summary>
        /// 获取列表音乐
        /// </summary>
        /// <param name="music"></param>
        /// <param name="listName">列表名</param>
        /// <returns></returns>
        public PalyList GetListMusic(Function music, string listName)
        {
            try
            {
                Dictionary<string, object> d = new Dictionary<string, object>();
                Dictionary<string, object> d1 = new Dictionary<string, object>();
                Dictionary<string, object> d2 = new Dictionary<string, object>();
                d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
                d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
                d2.Add("group", listName);
                d1.Add("sid", music.sid);
                d1.Add("groupList", new List<Dictionary<string, object>> { d2 });
                d.Add("sidGroups", new List<Dictionary<string, object>> { d1 });
                var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_GroupPlayerList);
                if (responsePackNew.Code != "0" || responsePackNew.Data == null || responsePackNew.Data.ToString() == "")
                {
                    return new PalyList();
                }
                //数据返序列化为Function对象
                var str = Newtonsoft.Json.JsonConvert.SerializeObject(responsePackNew.Data);
                var palyLists = Newtonsoft.Json.JsonConvert.DeserializeObject<PalyList>(str);
                if (palyLists == null)
                {
                    palyLists = new PalyList();
                }
                return palyLists;
            }
            catch
            {
                return new PalyList();
            }
        }
        /// <summary>
        ///请求服务器(与住宅有关:例如;homeId)