| | |
| | | { |
| | | public class SendMethod |
| | | { |
| | | private static SendMethod sMethod=null; |
| | | private static SendMethod sMethod = null; |
| | | public static SendMethod mMethod |
| | | { |
| | | get |
| | |
| | | { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | DriverLayer.Control.Ins.SendWriteCommand(function, dic); |
| | | DriverLayer.Control.Ins.SendWriteCommand(function, dic,false,0); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | //记录歌曲播放时间 |
| | | private int songPlayTime = -1; |
| | | /// <summary> |
| | | /// 获取设备最新的状态 |
| | | /// </summary> |
| | |
| | | { |
| | | try |
| | | { |
| | | // RefreshDeviceStatus(functionIds); |
| | | a31Music.LastDateTime = DateTime.Now; |
| | | //RefreshDeviceStatus(functionIds); |
| | | //a31Music.LastDateTime = DateTime.Now; |
| | | ///从缓存里面查找音乐播放器对象<缓存数据收到推送过来的状态会更新缓存数据> |
| | | var allLocalFuntion = FunctionList.List.GetDeviceFunctionList(); |
| | | var localFunction = allLocalFuntion.Find((obj) => obj.sid == sid); |
| | |
| | | } |
| | | ///更新的数据 |
| | | a31Music.functionMusic = localFunction; |
| | | if (int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(UI2.FuntionControlView.Music.KeyProperty.playing_time)) != songPlayTime) |
| | | { |
| | | ///歌曲记录时间和当前时间不一样,立即更新数据反馈时间 |
| | | a31Music.LastDateTime = DateTime.Now; |
| | | ///歌曲记录时间和当前时间不一样,立即更新歌曲播放时间 |
| | | songPlayTime = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(UI2.FuntionControlView.Music.KeyProperty.playing_time)); |
| | | } |
| | | |
| | | } |
| | | catch { } |
| | |
| | | { |
| | | return; |
| | | } |
| | | |
| | | } |
| | | catch { } |
| | | } |
| | |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("deviceIds", new List<string> { music.deviceId }); |
| | | var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_PlayerList); |
| | | if (responsePackNew.Code != "0"||responsePackNew.Data == null ||responsePackNew.Data.ToString() == "") |
| | | if (responsePackNew.Code != "0" || responsePackNew.Data == null || responsePackNew.Data.ToString() == "") |
| | | { |
| | | return; |
| | | } |
| | |
| | | var palyLists = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PalyListInfo>>(str); |
| | | if (palyLists == null) |
| | | { |
| | | palyLists =new List<PalyListInfo>(); |
| | | palyLists = new List<PalyListInfo>(); |
| | | } |
| | | if (palyLists.Count > 0) |
| | | { |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | ///请求服务器(与住宅有关:例如;homeId) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew RequestServerhomeId(object o, string api_Url, int mTimeout = 5) |
| | | public ResponsePackNew RequestServerhomeId(object o, string api_Url, int mTimeout = 5) |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(o); |
| | | return HttpUtil.RequestHttpsPostFroHome(api_Url, requestJson, mTimeout); |