Example #1
0
        /// <summary>
        /// Return an alarm class in RFC-2445 format
        /// </summary>
        internal string GetFormattedElement()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("BEGIN:VALARM");
            string trigger = this.GetTriggerString();

            if (!string.IsNullOrEmpty(trigger))
            {
                sb.AppendLine("TRIGGER" + trigger);
            }
            if (this.Repeat.HasValue)
            {
                sb.AppendLine("REPEAT:" + this.Repeat.Value);
            }

            var duration = FormatHelper.FormatTimeSpan(this.Duration);

            if (!string.IsNullOrEmpty(duration))
            {
                sb.AppendLine("DURATION:" + duration);
            }

            sb.AppendLine("ACTION:DISPLAY");
            if (!string.IsNullOrEmpty(this.Description))
            {
                sb.AppendLine("" + this.Description);
            }

            sb.AppendLine("END:VALARM");
            return(sb.ToString());
        }
 /// <summary>
 /// Format the trigger data
 /// </summary>
 protected override string GetTriggerString()
 {
     return(":-" + FormatHelper.FormatTimeSpan(this.BeforeTime));
 }