/// <summary>
        /// Converts the object to a list of headers
        /// </summary>
        /// <returns><see cref="HeaderCollection"/></returns>
        public HeaderCollection ToHeaders()
        {
            Header hAppName      = new Header(Header.APPLICATION_NAME, this.ApplicationName);
            Header hName         = new Header(Header.NOTIFICATION_NAME, this.Name);
            Header hID           = new Header(Header.NOTIFICATION_ID, this.ID);
            Header hTitle        = new Header(Header.NOTIFICATION_TITLE, this.Title);
            Header hText         = new Header(Header.NOTIFICATION_TEXT, this.Text);
            Header hSticky       = new Header(Header.NOTIFICATION_STICKY, this.Sticky);
            Header hPriority     = new Header(Header.NOTIFICATION_PRIORITY, ((int)this.Priority).ToString());
            Header hIcon         = new Header(Header.NOTIFICATION_ICON, this.Icon);
            Header hCoalescingID = new Header(Header.NOTIFICATION_COALESCING_ID, this.CoalescingID);

            HeaderCollection headers = new HeaderCollection();

            headers.AddHeader(hAppName);
            headers.AddHeader(hName);
            headers.AddHeader(hID);
            headers.AddHeader(hTitle);
            headers.AddHeader(hText);
            headers.AddHeader(hSticky);
            headers.AddHeader(hPriority);
            headers.AddHeader(hCoalescingID);

            if (this.Icon != null && this.Icon.IsSet)
            {
                headers.AddHeader(hIcon);
                headers.AssociateBinaryData(this.Icon);
            }

            this.AddInheritedAttributesToHeaders(headers);
            return(headers);
        }
Beispiel #2
0
        /// <summary>

        /// Converts the object to a list of headers

        /// </summary>

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

        public HeaderCollection ToHeaders()

        {
            Header hName = new Header(Header.APPLICATION_NAME, this.name);

            Header hIcon = new Header(Header.APPLICATION_ICON, this.Icon);



            HeaderCollection headers = new HeaderCollection();

            headers.AddHeader(hName);



            if (this.Icon != null && this.Icon.IsSet)

            {
                headers.AddHeader(hIcon);

                headers.AssociateBinaryData(this.Icon);
            }



            this.AddInheritedAttributesToHeaders(headers);

            return(headers);
        }
Beispiel #3
0
        /// <summary>
        /// Converts the object to a list of headers
        /// </summary>
        /// <returns><see cref="HeaderCollection"/></returns>
        public HeaderCollection ToHeaders()
        {
            Header hName        = new Header(Header.NOTIFICATION_NAME, this.Name);
            Header hDisplayName = new Header(Header.NOTIFICATION_DISPLAY_NAME, this.DisplayName);
            Header hIcon        = new Header(Header.NOTIFICATION_ICON, this.Icon);
            Header hEnabled     = new Header(Header.NOTIFICATION_ENABLED, this.Enabled.ToString());

            HeaderCollection headers = new HeaderCollection();

            headers.AddHeader(hName);
            headers.AddHeader(hEnabled);

            if (this.displayName != null)
            {
                headers.AddHeader(hDisplayName);
            }

            if (this.Icon != null && this.Icon.IsSet)
            {
                headers.AddHeader(hIcon);
                headers.AssociateBinaryData(this.Icon);
            }

            this.AddCustomAttributesToHeaders(headers); // NOTE: dont call AddInheritedAttributesToHeaders because we want to ignore the common attributes
            return(headers);
        }
Beispiel #4
0
        /// <summary>

        /// When converting an <see cref="ExtensibleObject"/> to a list of headers,

        /// this method adds the custom attributes (both text and binary) to the

        /// list of headers.

        /// </summary>

        /// <param name="headers">The <see cref="HeaderCollection"/> to add the custom attributes to</param>

        protected void AddCustomAttributesToHeaders(HeaderCollection headers)

        {
            if (headers != null)

            {
                foreach (KeyValuePair <string, string> item in this.CustomTextAttributes)

                {
                    Header customHeader = new CustomHeader(item.Key, item.Value);

                    headers.AddHeader(customHeader);
                }

                foreach (KeyValuePair <string, Resource> item in this.CustomBinaryAttributes)

                {
                    Header customHeader = new CustomHeader(item.Key, item.Value.ToString());

                    headers.AddHeader(customHeader);

                    headers.AssociateBinaryData(item.Value);
                }
            }
        }