Esempio n. 1
0
        public ActionResult RegisterDevice(string deviceId)
        {
            DeviceIds.Add(deviceId);

            var service = new NotificationService();
            var response = service.SendNotificationByUrlencoded(deviceId, "註冊成功!");
            return Json(response);
        }
Esempio n. 2
0
 public ActionResult SendMessage(string message)
 {
     //foreach (var deviceId in DeviceIds)
     //    SendNotificationByUrlencoded(deviceId, message);
     var service = new NotificationService();
     service.SendNotification(DeviceIds, message);
     return RedirectToAction("Index");
 }
Esempio n. 3
0
        private void SaveSignature(Favorate[] favorates, string signature)
        {
            var container = GetContainer();

            var blockBlob = container.GetBlockBlobReference(Guid.NewGuid().ToString() + ".png");
            var bytes = Convert.FromBase64String(signature.Split(',')[1]);
            //var blockBlob = container.GetBlockBlobReference("aaaa.mp4");
            var stream = new MemoryStream(bytes);
            var ints = favorates.Select(x => x._id);
            blockBlob.Metadata["Favorates"] = JsonConvert.SerializeObject(ints);
            blockBlob.UploadFromStream(stream);

            Thread.Sleep(5000);
            var service = new NotificationService();
            service.SendNotification(NotificationsController.DeviceIds, "已收到訂單!");
        }