2020-03-05 12:59:43 +00:00
using System ;
using System.Drawing ;
using Config.CalendarEvent ;
namespace TBF.UI.Calendar
{
/// <summary>
/// An event that defines a calibration due date
/// </summary>
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
2023-04-18 12:01:23 +00:00
public bool AllDay { get ; set ; } /// True if the time component of the date can be ignored
2020-03-05 12:59:43 +00:00
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)
2023-04-18 12:01:23 +00:00
public string Title { get ; set ; } /// The name of the event (becomes the text of the triggered event)
2020-03-05 12:59:43 +00:00
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
2023-04-18 12:01:23 +00:00
public bool Hidden { get ; set ; } /// True if the event is enabled, otherwise false
2020-03-05 12:59:43 +00:00
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 ; }
/// <summary>
/// CalibrationDueEvent Constructor
/// </summary>
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 ) ;
}
}
}