Пример #1
0
        internal static RemoteNotification FromGxUserType(GxUserType sdt)
        {
            RemoteNotification notification = new RemoteNotification();
            JObject            jobj         = sdt.GetJSONObject() as JObject;

            if (jobj != null)
            {
                object deviceTypeObj = jobj["DeviceType"];
                if (deviceTypeObj is Int16)
                {
                    notification.DeviceType = (short)deviceTypeObj;
                }
                else
                {
                    notification.DeviceType = -1;
                }

                notification.DeviceToken       = TryGetObjectPropertyValue(jobj, "DeviceToken");
                notification.Message           = TryGetObjectPropertyValue(jobj, "Message");
                notification.Title             = TryGetObjectPropertyValue(jobj, "Title");
                notification.Icon              = TryGetObjectPropertyValue(jobj, "Icon");
                notification.Sound             = TryGetObjectPropertyValue(jobj, "Sound");
                notification.Badge             = TryGetObjectPropertyValue(jobj, "Badge");
                notification.Delivery.Priority = TryGetObjectPropertyValue(jobj["Delivery"] as JObject, "Priority", "normal");
                notification.ExecutionTime     = 0;
                notification.Parameters        = new NotificationParameters();

                JObject eventObj = jobj["Event"] as JObject;
                if (eventObj != null)
                {
                    notification.Action = eventObj["Name"] as string;
                    object executionTime = eventObj["Execution"];
                    if (executionTime is Int16)
                    {
                        notification.ExecutionTime = (short)executionTime;
                    }

                    if (eventObj.Contains("Parameters"))
                    {
                        JArray arr = eventObj["Parameters"] as JArray;
                        for (int i = 0; i < arr.Length; i++)
                        {
                            notification.Parameters.Add(arr.GetObject(i)["Name"] as string, arr.GetObject(i)["Value"] as string);
                        }
                    }
                }
            }
            return(notification);
        }
Пример #2
0
 public void Add(RemoteNotification notification)
 {
 }
Пример #3
0
        public void Add(GxUserType sdt)
        {
            RemoteNotification notification = RemoteNotification.FromGxUserType(sdt);

            Add(notification);
        }
Пример #4
0
 public void Add(RemoteNotification notification)
 {
     m_notifications.Add(notification);
 }