GetXml() private method

private GetXml ( ) : string
return string
Exemplo n.º 1
0
        /// <summary>
        /// Gets the XML.
        /// </summary>
        /// <returns>string representation of xml</returns>
        internal string GetXml()
        {
            var sb = new StringBuilder("<toast");

            if (!string.IsNullOrEmpty(LaunchArgs))
            {
                sb.Append($" launch=\"{LaunchArgs}\"");
            }

            if (ActivationType.HasValue)
            {
                sb.Append($" activationType=\"{ActivationType.Value}\"");
            }

            if (Scenario.HasValue)
            {
                sb.Append($" scenario=\"{Scenario.Value.ToString().ToLower()}\"");
            }

            if (!string.IsNullOrEmpty(People))
            {
                sb.Append($" hint-people=\"{People}\"");
            }

            sb.Append(">");

            if (_visual != null)
            {
                sb.AppendLine(_visual.GetXml());
            }

            if (Audio != null)
            {
                sb.AppendLine(Audio.GetXml());
            }

            if (_actions != null && _actions.Any())
            {
                sb.AppendLine("<actions>");
                foreach (var action in _actions)
                {
                    sb.AppendLine(action.GetXml());
                }

                sb.AppendLine("</actions>");
            }

            sb.AppendLine("</toast>");
            return(sb.ToString());
        }