Example #1
0
 public void UpdateCommodity(Commodity commodity)
 {
     _bmobWindows.Update(commodity, (responseInfo, exception) =>
     {
         if (exception != null)
         {
             Debug.WriteLine("修改失败: " + exception.Message);
             MessageBox.Show("修改失败: " + exception.Message);
             return;
         }
         MessageBox.Show("修改成功");
     });
 }
Example #2
0
        public static void InitPushService(PushNotificationChannel channel, string tableName, Action action)
        {
            BmobQuery query = new BmobQuery();

            query.WhereEqualTo("DeviceId", UUID);
            bmob.Find <Push>(tableName, query, (resp, ex) =>
            {
                if (ex != null || resp.results.Count == 0)
                {
                    Push push      = new Push();
                    push.LeftTime  = channel.ExpirationTime.UtcDateTime;
                    push.CURL      = channel.Uri;
                    push.DeviceId  = UUID;
                    push.ProductId = CurrentApp.AppId.ToString("D");
                    bmob.Create(tableName, push, (s, e) =>
                    {
                        action?.Invoke();
                    });
                    return;
                }
                if (resp.results.Count == 1)
                {
                    var push      = resp.results[0];
                    push.LeftTime = channel.ExpirationTime.UtcDateTime;
                    push.CURL     = channel.Uri;
                    bmob.Update(tableName, push.objectId, push, (s, e) =>
                    {
                        action?.Invoke();
                    });
                }
            });
        }