/// <summary>
        /// Creates a new <see cref="CallbackContext"/> from a list of headers
        /// </summary>
        /// <param name="headers">The <see cref="HeaderCollection"/> used to populate the object</param>
        /// <returns><see cref="CallbackContext"/></returns>
        public new static CallbackContext FromHeaders(HeaderCollection headers)
        {
            CallbackDataBase baseObj = CallbackDataBase.FromHeaders(headers);

            CallbackContext context = new CallbackContext(baseObj.Data, baseObj.Type);

            return(context);
        }
        /// <summary>
        /// Creates a new <see cref="CallbackDataBase"/> from a list of headers
        /// </summary>
        /// <param name="headers">The <see cref="HeaderCollection"/> used to populate the object</param>
        /// <returns><see cref="CallbackDataBase"/></returns>
        public static CallbackDataBase FromHeaders(HeaderCollection headers)
        {
            string data = headers.GetHeaderStringValue(Header.NOTIFICATION_CALLBACK_CONTEXT, true);
            string type = headers.GetHeaderResourceValue(Header.NOTIFICATION_CALLBACK_CONTEXT_TYPE, true);

            CallbackDataBase context = new CallbackDataBase(data, type);

            return(context);
        }
        /// <summary>
        /// Creates a new <see cref="CallbackDataBase"/> from a list of headers
        /// </summary>
        /// <param name="headers">The <see cref="HeaderCollection"/> used to populate the object</param>
        /// <returns><see cref="CallbackDataBase"/></returns>
        public static CallbackDataBase FromHeaders(HeaderCollection headers)
        {
            string data = headers.GetHeaderStringValue(Header.NOTIFICATION_CALLBACK_CONTEXT, true);
            string type = headers.GetHeaderResourceValue(Header.NOTIFICATION_CALLBACK_CONTEXT_TYPE, true);

            CallbackDataBase context = new CallbackDataBase(data, type);

            return context;
        }
Esempio n. 4
0
        /// <summary>

        /// Creates a new <see cref="CallbackData"/> from a list of headers

        /// </summary>

        /// <param name="headers">The <see cref="HeaderCollection"/> used to populate the object</param>

        /// <returns><see cref="CallbackData"/></returns>

        public new static CallbackData FromHeaders(HeaderCollection headers)

        {
            try

            {
                CallbackDataBase baseObj = CallbackDataBase.FromHeaders(headers);

                CallbackResult result = CallbackResult.TIMEDOUT;



                string resultString = headers.GetHeaderStringValue(Header.NOTIFICATION_CALLBACK_RESULT, true);

                if (!String.IsNullOrEmpty(resultString))
                {
                    result = (CallbackResult)Enum.Parse(typeof(CallbackResult), resultString, true);
                }



                string notificationID = headers.GetHeaderStringValue(Header.NOTIFICATION_ID, false);



                CallbackData context = new CallbackData(baseObj.Data, baseObj.Type, result, notificationID);



                return(context);
            }

            catch

            {
                return(null);
            }
        }