93 lines
4.1 KiB
C#
93 lines
4.1 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using Config.CalendarEvent;
|
|
|
|
namespace TBF.UI.Calendar
|
|
{
|
|
/// <summary>
|
|
/// An event that defines a calibration reminder
|
|
/// </summary>
|
|
public class CalibrationReminderEvent : 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 (triggered event 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; }
|
|
|
|
|
|
private CalibrationReminderEvent() { }
|
|
|
|
/// <summary>
|
|
/// CalibrationReminderEvent Constructor
|
|
/// </summary>
|
|
public CalibrationReminderEvent(AutoAction autoAction)
|
|
{
|
|
/// Date
|
|
Frequency = Frequency.Once;
|
|
AllDay = true;
|
|
TriggerOnExactDayOnly = false;
|
|
/// Source
|
|
/// Text
|
|
AutoAction = autoAction;
|
|
Parameters = string.Empty;
|
|
Rank = 1;
|
|
Hidden = true;
|
|
ReadOnly = true;
|
|
BackColor = unchecked((int)0xFFA00000); /// (MSB)AARRGGBB(LSB) ... red
|
|
TextColor = unchecked((int)0xFFFFFFFF); /// (MSB)AARRGGBB(LSB) ... white
|
|
TooltipEnabled = true;
|
|
}
|
|
|
|
public CalibrationReminderEvent(AutoAction autoAction, DateTime date, string source, string text)
|
|
: this(autoAction)
|
|
{
|
|
Date = date;
|
|
Source = source;
|
|
Title = text;
|
|
}
|
|
|
|
public ICalendarEvent Clone()
|
|
{
|
|
return new CalibrationReminderEvent
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
}
|