using System; using System.Drawing; using Config.CalendarEvent; namespace TBF.UI.Calendar { /// /// An event that defines a calibration due date /// public class CalibrationDueDateEvent : ICalendarEvent { public DateTime Date { get; set; } /// The Date that the event occurs public Frequency Frequency { get; set; } /// A value indicating how often the event occurs public bool AllDay { get; set; } /// True if the time component of the date can be ignored public bool TriggerOnExactDayOnly { get; set; } /// If this is a recurring event, set this to true to make the event show up only from the day specified forward public string Source { get; set; } /// Source of this calendar event (becomes the source of the triggered event) public string Title { get; set; } /// The name of the event (becomes the text of the triggered event) public AutoAction AutoAction { get; set; } /// Automated action to be done or event to be triggered (becomes Severity) public string Parameters { get; set; } /// Automated action parameters (e.g. name of a procedure to start) public int Rank { get; set; } /// The ranking of the event that determines the order in which it is displayed on a particular day public bool Hidden { get; set; } /// True if the event is enabled, otherwise false public bool ReadOnly { get; set; } /// True if the event details cannot be modified public int BackColor { get; set; } /// The color that the event show up in on the calendar: (MSB)AARRGGBB(LSB) public int TextColor { get; set; } /// The text color of the event: (MSB)AARRGGBB(LSB) public bool TooltipEnabled { get; set; } /// True if a tooltip should be displayed when hovering over the event public Config.CalendarEvent.CustomRecurringFrequenciesHandler CustomRecurringFunction { get; set; } /// /// CalibrationDueEvent Constructor /// public CalibrationDueDateEvent() { /// Date Frequency = Frequency.Once; AllDay = true; TriggerOnExactDayOnly = false; /// Source /// Text AutoAction = AutoAction.Error; Parameters = string.Empty; Rank = 1; Hidden = false; ReadOnly = true; BackColor = unchecked((int)0xFFA00000); TextColor = unchecked((int)0xFFFFFFFF); TooltipEnabled = true; } public CalibrationDueDateEvent(DateTime date, string source, string text) : this() { Date = date; Source = source; Title = text; } public ICalendarEvent Clone() { return new CalibrationDueDateEvent { Date = this.Date, Frequency = this.Frequency, AllDay = this.AllDay, TriggerOnExactDayOnly = this.TriggerOnExactDayOnly, Source = this.Source, Title = this.Title, AutoAction = this.AutoAction, Parameters = this.Parameters, Rank = this.Rank, Hidden = this.Hidden, ReadOnly = this.ReadOnly, BackColor = this.BackColor, TextColor = this.TextColor, TooltipEnabled = this.TooltipEnabled, CustomRecurringFunction = this.CustomRecurringFunction, }; } public override string ToString() { if (string.IsNullOrEmpty(Source)) { return Title; } return string.Format("{0}: {1}", Source, Title); } } }