// 发送查询命令
 private void Send(TransferCmd tcmd)
 {
     if (client != null && client.Connected)
     {
         client.Send(JsonExtendFun.CoverseJsonString <TransferCmd>(tcmd));
     }
 }
        // 发送操作命令
        public void SendCmd <T>(JSoundClientCmd cmd, T obj)
        {
            TransferCmd tcmd = new TransferCmd()
            {
                devkey  = devKey,
                funtion = (int)cmd,
                datas   = obj != null?JsonExtendFun.CoverseJsonString(obj) : string.Empty
            };

            try
            {
                var nid  = ViewModelHelper.GetPropertyValue(obj, "id");
                var ncmd = ViewModelHelper.GetPropertyValue(obj, "cmd");

                if (nid == null || ncmd == null)
                {
                    return;
                }
                List <TransferCmd> tempitem = new List <TransferCmd>();
                tempitem.AddRange(transferCmds);

                foreach (var item in transferCmds)
                {
                    var _obj = JsonExtendFun.CoverseJsonObject <T>(item.datas);

                    var oid = ViewModelHelper.GetPropertyValue(_obj, "id");

                    var ocmd = ViewModelHelper.GetPropertyValue(_obj, "cmd");



                    if (oid.Equals(nid) && ocmd.Equals(ncmd))
                    {
                        tempitem.Remove(item);
                    }
                }
                transferCmds = new ObservableCollection <TransferCmd>(tempitem);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }

            transferCmds.Add(tcmd);
        }
        // 心跳包线程
        public void HeartTimer_Tick(object sender, EventArgs e)
        {
            JSoundClientCmd jcCmd;

            if (dataService.id == string.Empty)
            {
                jcCmd = JSoundClientCmd.GetAllInfo;
            }
            else
            {
                jcCmd = JSoundClientCmd.GetPlayerMessage;
            }

            TransferCmd tcmd = new TransferCmd
            {
                devkey  = "0000",
                funtion = (int)jcCmd,
                datas   = ""
            };

            GC.Collect();
            Send(tcmd);
        }