Пример #1
0
        /// <summary>
        /// If payload type is HAlert.
        /// </summary>
        /// <returns>The payload of HAlert type.</returns>
        public HAlert GetPayloadAsHAlert()
        {
            HAlert payload = null;

            try
            {
                payload = new HAlert(JObject.Parse(this["payload"].ToString()));
            }
            catch (Exception e)
            {
                Debug.WriteLine("{0} : Can not fetch the payload attribute", e.ToString());
            }
            return(payload);
        }
Пример #2
0
 public void SetPayload(HAlert payload)
 {
     try
     {
         if (payload == null)
         {
             this.Remove("payload");
         }
         else
         {
             this["payload"] = payload;
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not update the payload attribute", e.ToString());
     }
 }
Пример #3
0
 public HMessage BuildMessage(string actor, string type, HAlert payload, HMessageOptions mOptions)
 {
     return InnerBuildMessage(actor, type, payload, mOptions);
 }
Пример #4
0
        /// <summary>
        /// The client MUST be connected to access to this service.
        /// Allow a hubapp client to create a hMessage with a hAlert payload.
        /// </summary>
        /// <param name="actor"></param>
        /// <param name="alert"></param>
        /// <param name="mOptions"></param>
        /// <returns></returns>
        public HMessage BuildAlert(string actor, string alert, HMessageOptions mOptions)
        {
            if (actor == null || actor.Length <= 0)
                throw new MissingAttrException("actor");
            if (alert == null || alert.Length <= 0)
                throw new MissingAttrException("alert");

            HAlert halert = new HAlert();
            halert.SetAlert(alert);

            HMessage message = BuildMessage(actor, "hAlert", halert, mOptions);
            return message;
        }
Пример #5
0
 public void SetPayload(HAlert payload)
 {
     try
     {
         if (payload == null)
         {
             this.Remove("payload");
         }
         else
         {
             this["payload"] = payload;
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not update the payload attribute", e.ToString());
     }
 }
Пример #6
0
 /// <summary>
 /// If payload type is HAlert.
 /// </summary>
 /// <returns>The payload of HAlert type.</returns>
 public HAlert GetPayloadAsHAlert()
 {
     HAlert payload = null;
     try
     {
         payload = new HAlert(JObject.Parse(this["payload"].ToString()));
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not fetch the payload attribute", e.ToString());
     }
     return payload;
 }