private void fetchAndUpdateNotifactionUri() { fetchNotifactionUri((objectId) => { if (objectId == null) { new BmobWindowsPhone().Create(installaction, (resp, ex) => { if (ex == null && resp != null) { MY_INST_OBJECTID = resp.objectId; BmobDebug.D("Installaction设置成功, 对象ID为: " + MY_INST_OBJECTID + "; MPNS: " + NotificationUri); } }); } else { new BmobWindowsPhone().Update(BmobInstallation.TABLE, MY_INST_OBJECTID, new BmobKV().Put("notificationUri", NotificationUri), (resp, ex) => { if (ex == null) { BmobDebug.D("Installaction更新成功, 对象ID为: " + MY_INST_OBJECTID + "; MPNS: " + NotificationUri); BmobDebug.D("Update NotificationUri success."); } else { BmobDebug.E(ex); } }); } }); }
/// <summary> /// 获取列表 /// </summary> /// <typeparam name="U">列表中对象的具体类型</typeparam> /// <param name="name">字段名</param> public List <U> getList <U>(String name) { IList raw = getListRaw(name); if (raw == null) { BmobDebug.D("获取" + name + "的列表数据为空!"); return(null); } Type type = typeof(U); List <U> result = new List <U>(raw.Count); foreach (var element in raw) { result.Add(Parse <U>(element)); } return(result); }
protected R Execute <R>(Func <String, String, String, Byte[], IDictionary <String, String>, Action <String, Status, BmobException>, R> request, String url, String contentType, Byte[] postData, IDictionary <String, String> headers, BmobCallback <T> fCallback) { BmobDebug.T("\r\n\t请求的URL : " + url + "\r\n\t交互对象(以请求的数据为准): " + JsonAdapter.JSON.ToRawString(receiver) + "\r\n\t请求的数据: " + JsonAdapter.JSON.ToJsonString(receiver.Data)); return(request.Invoke(url, receiver.Method, contentType, postData, headers, (resp, status, ex) => { if (BmobDebug.Debug) { BmobDebug.D("返回数据内容为: " + resp); } else { var rp = resp.Length > 400 ? resp.Substring(0, 200) + " ... ... ... ... ... ... " + resp.Substring(resp.Length - 200) : resp; BmobDebug.I("返回数据内容为: " + rp); } onPostExecute(resp, status, ex, fCallback); })); }